Wednesday, October 21, 2009

Deleting Files Based on Date Time

Today I needed to delete files based on date and time:
Here is the command I used for deleting file last modified on 21 Oct 2009 16:30:
ls -lh | sed -n '/Oct\ 21\ 16:30/p' | awk '{print $9}' >> 1.txt
rm -f `cat 1.txt`
ls -lh (lists all files)
sed -n  '/Oct\ 21\ 16:30/p' (find files at given date from list)
awk '{print $9}' (print only file names on list) and >> 1.txt put list of files to 1.txt
rm -f (force to delete)

Wednesday, October 14, 2009

Recursively Download FTP

Sometimes, you may need to move one server to another. At that time, you may use wget command to move your files without any pain.
Here is the command for recursive download on ftp via wget:

wget -r
Yes, thats all folks!

Thursday, October 8, 2009

List of users on Linux

To list the users in linux you may use following command:

cat /etc/passwd | cut -d ":" -f1