PDA

View Full Version : Do you have a favorite unix command?


monaro
09-11-2005, 06:15 AM
G'day, for myself it would have to be the one that lets you copy one or more files to another location.


cp [OPTION]... --target-directory=DIRECTORY SOURCE...

I use this to backup a full domain.

I get scared when I use the one below though,
on a unixcodes.txt file it reads


************************************************** ****
rm -f *.* make dam sure you know where you are in!!!!
************************************************** ****

I'm just interested in learning more about unix and hence the question above :D

thruma
09-28-2005, 01:21 PM
Hey monaro.
Not sure I have a fav unix command but unix/linux itself is my fave OS.

If you're doing backups have a look at the tar command and the gzip command.

you can put these into a script file and run it like a program.

sort of like a DOS batch file.

Say you have a domain called monaro.com

you could do it like this

tar -cvf monaro.com monaro-backup
cp monaro-backup new-backup-directory

then if you need to restore the backup you can just do this

cp new-backup-directory monaro-backup
tar -xvf monaro-backup

Thats without zipping it if you want to save time zipping it up

you can read the entire options for tar or any other command by typing "man tar" at the unix prompt.

Enjoy :D

monaro
09-28-2005, 03:21 PM
G'day, how have you been?

I see your point in using tar in the backup,
I have been going the the actual directory that I want to backup, typing pwd, then copy the full line location you know and then using
cp -Rpf options like you already know.

I might give it a go with the tar option, so thank you for that.

One other thing Thruma, find and replace, im having fun with gawk, to make things a less painless on my side to update or add various hardlinks on 1000's of indexed pages across many domains.

The more time i can save on one task can give myself time to focus on other tasks and so on.

Always :D