# how to make all of this in one command

**URL:** <https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119>\
**Category:** Solaris\
**Created:** [June 22, 2010, 7:36am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119 "2010-06-22T07:36:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxmasrawy](https://community.unix.com/letter_avatar/xxmasrawy/32/5_5575768a8748004e209b776fc1b2916d.png) [@xxmasrawy](https://community.unix.com/u/xxmasrawy)\
**Post date:** [June 22, 2010, 7:36am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119/1 "2010-06-22T07:36:48Z")

</div>

dears  
what i need to make is  
cp -irp file\_name filename  
tar cvf filename.tar filename  
gzip filename.tar

in one commane using exec  
it that prossible and how can i do that

---

<div class="post-metadata">

**Author:** ![ygemici](https://community.unix.com/letter_avatar/ygemici/32/5_5575768a8748004e209b776fc1b2916d.png) [@ygemici](https://community.unix.com/u/ygemici)\
**Post date:** [June 22, 2010, 9:28am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119/2 "2010-06-22T09:28:33Z")

</div>

you want to overwrite all file to a file name called filename ?

```nohighlight
find . -name "file_name*" -exec cp -irp {} filename \; ; tar cvf - filename | gzip > filename.tar.gz 

```

---

<div class="post-metadata">

**Author:** ![System\_Shock](https://community.unix.com/user_avatar/community.unix.com/system_shock/32/368_2.png) [@System\_Shock](https://community.unix.com/u/System_Shock)\
**Post date:** [June 22, 2010, 9:37am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119/3 "2010-06-22T09:37:24Z")

</div>

What's the benefit of doing this in "one line" and using exec ?  
Wouldn't it be easier to make a small script and call that?

---

<div class="post-metadata">

**Author:** ![niyazi](https://community.unix.com/letter_avatar/niyazi/32/5_5575768a8748004e209b776fc1b2916d.png) [@niyazi](https://community.unix.com/u/niyazi)\
**Post date:** [June 23, 2010, 3:24am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119/4 "2010-06-23T03:24:22Z")

</div>

> [@system shock](#):
>
> What's the benefit of doing this in "one line" and using exec ?  
> Wouldn't it be easier to make a small script and call that?

You can run it on remote machines over ssh since it's a single line command.

Was it the purpose ?

---

<div class="post-metadata">

**Author:** ![xxmasrawy](https://community.unix.com/letter_avatar/xxmasrawy/32/5_5575768a8748004e209b776fc1b2916d.png) [@xxmasrawy](https://community.unix.com/u/xxmasrawy)\
**Post date:** [June 23, 2010, 11:10am UTC](https://community.unix.com/t/how-to-make-all-of-this-in-one-command/268119/5 "2010-06-23T11:10:08Z")

</div>

thanks all  
ygemici : thanks for your command really it is very nice  
System Shock : i hope i could do that but i can't written script - i don't have concept of programming

---------- Post updated at 10:10 AM ---------- Previous update was at 10:03 AM ----------

i am try this command but it doesn't work

```nohighlight
$ tar cvf xxmasrawy.tar xxmasrawy -exec gzip 

```
