Tuesday, March 21, 2006

Useful commands

Search and remove files ending with .trc and are a day old
find . -name "*.trc" -mtime +1 -exec rm {} \;

You can change the +1 to ex:- +3 if you need to removes files that are 3 days old.

List files that have been modified lately and in reverse order
ls -ltr

Get a Summary of the the disk space under a given directory.
$cd foo/
$du -h -s

Need to make a copy of a directory?
Use the command
(cd /old/directory; tar cf - .) | (cd /new/directory; tar xf -)

List all Open files
Use the command
$lsof

If you need to check the all files open by a user john
$lsof -u john

Look at a log file in the reverse
tac filename | more
"tac" is the command which allows you to do that

$arch

this command list the architecture of your machine

# kernelversion
2.6

# dnsdomainname
example.com













No comments: