Random Helpful Linux Commands

For the past few months, I’ve been working with Linux a lot more than I used to. With that increased exposure has come some helpful commands that I’ve come across, so I thought I’d share a few of them here. I’m sure many of them are fairly common knowledge, but I’ll share them nonetheless…


Shows the you last part of a particular file. Works best with the follow option (-f), which continues to output new information added to the file in real-time. For example:

tail -f error_log

More info on tail is available on about.com

Find & Locate

Another couple of my favorites, Find allows you to find a file (Duh). Locate does essentially the same thing, however it requires you to update the servers database (# updatedb) in order to be accurate.

find ./ -iname [filename]

locate [filename]

Find the 10 largest Files/Directories

du -a / | sort -n -r | head -n 10

Delete files older than 5 days

find /path/to/files* -mtime +5 -exec rm {} ;

I’ll post more in the future, probably with a little more thought behind the commands.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: