Piping is very, very powerful. Piping is like process some shit and transfer it to something else. For example
ls -l | tr -s ' ' ' '
What this does use the ls command with the -l option. Instead of creating neat columns. Let's take out all the spaces and just leave one space to be processed with something later.
Another one that is used a lot
cat textfile | more
The cat command list the textfile and pipes it to the more command. The more command displays a full screen at a time and waits for your response to continue. The less command does the samething as more.
Quote:
1) Search the subdirectories to find files over a given size (say 20MB for example)
|
Just use the du command and then use the redirect command like > or >>. The > is make a file and empty it out. It also takes an existing file and empties it out, so be careful. The >> is make a file and append or add to the file. If it exists just add to it.
You could probably just use the find command. Check the manual several times to get an idea.
Quote:
2) A command that will search the subdirectories and find/list all subdirectories that contain more than 10,000 files
|
You can use ls command or you could use find.
[quote]
3) A command that will search the subdirectories and delete all files that are older than 180 days.
[quote]
Just use the find command. Something like
find /var/vpopmail/domains -mtime 180 -exec rm -vf {} \;
You probably want to redirect the output to a file for a log. mtime will be in 180 days and if its true delete it. The {} designates a place holder for files. Check the manual to make sure I'm right and some other options to tweak it to better suit you.
I suggest playing with certain commands then place them in a script.