Useful Linux Commands

Find files older than 60 days
find * -mtime +60

Delete files in backup folder which are older than 60 days
rm -f `find /backup/ -mtime +60`

Search for a string inside files
grep -H -r “search me” /var/www

Find files owned by apache user
find /var/www/ -user apache

Find directories owned by apache user
find /var/www/ -user apache -type d

Listing files in a directory
ls -lh

Copy an entire directory (files + subdirectories)
cp -R existingdir/ newdir/

Zip up an entire directory
zip -r zipefilename foldername

Count total number of files in a directory
ls -1 | wc -l
find . -type f | wc -l

Get directory size
du -hs /var/www

Get amount of free disk space available
df -h

Get Linux version details
uname -a
cat /proc/version

Recommended Book

Profile PicHello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more about me or have a look at some of the tips & resources I've written.
Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
We do NOT spam.
Your name:  
Your email:  

Tips & Resources

Tips & Resources
WordPress Web Hosting
Recommended web hosting providers for WordPress 3.0
iPhone Native App Development
Important steps into iPhone app development for beginners
iPhone Web App Development
Tips for iPhone web app development
Coupons for Web Developers
Get discounts on web hosting, domain names, templates, etc
10 Useful jQuery Snippets
Easy-to-use jQuery snippets for any website
HTML Email Newsletter
Step-by-step tutorial on how to code an HTML email newsletter
  • bluehost Hosting $6.95/month
  • Joomla Templates