Monday, August 18, 2008

Misc

Remove one dir and all files and its subdirectory
rm -rf dirname

r means recursive.

cp -r ... means copy all subdirectories and their contents.

~ represent home dir, e.g. ls ~

To view help info of one command, use --help, e.g. rm --help
Another way to get help is using "man", e.g. man ls

Finding Files That Contain Specific Text
grep -i linda /etc/*
find find all the files contain "linda"
-i means case insensitive.
-l will only list out the file name.


Piping
The goal of piping is to execute one command and send its output to a second command so
that the second command can do something with it. For instance, ps ef|grep java

ls -l > list_of_files.
In this command, the redirector (>) sign will make sure that the result of the ls -l command is redirected to the file list_of_files. >> will append instead of replacing.

No comments:

Post a Comment