5 Nifty Linux Commands
Here are 5 nifty commands that help me get work done.
1. The conventional way of deleting most files is to move them to the recycle bin, and at some point later in the future empty it. With sensitive files you do not want them sitting in the recycle bin for days or weeks. Even when deleted, with the right tools someone could still recover that file. Shred is an awesome command that allows you to completely nuke the file so that nobody will be able to recover it. From the description of shred on its man page:
“Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.”
Basically, it allows you to securely and safely delete an files that you may have. It does this by writing random data to the file multiple times (default is 25). Here’s the shred command and arguments that I usually run.
shred -uz foo.bar
The -z has the last write be zeroes and the -u deletes the file.
2. Have you ever run a command and had the output fly across the terminal? Pipe (|) the command to more! More lets you see the output from a command, one page at a time.
ls | more
3. Alias allows you to define a different name for a command. This can be handy for a ton of reasons. In Windows the cls command clears the command line. On Linux if you run cls you will get a “command not found” error, because clear is the correct command. To map cls to clear, type the following code at the command line.
alias cls=clear
4. Grep is a very useful command. Its man page has a good, short and succinct description.
“grep - print lines matching a pattern”
It can search through files for the pattern, or results from other commands can be piped to it. Lets say that there is a Firefox process that is unresponsive on your system. Hitting the x in the top right of the window does not close it. What to do? You could use the ps command to pipe process information to grep which finds the information you need about the runaway process.
mikeyp@bender:~$ ps -ef | grep firefox
mikeyp 7077 1 8 20:59 ? 00:04:10 /usr/lib/firefox-3.0.3/firefox
mikeyp 8474 7039 0 21:49 pts/0 00:00:00 grep firefox
The first row is the unresponsive process and the second column is the process id. So now you can use the kill command to end the process.
kill -9 7077
5. Man is my #1 reference when I need to figure out exactly what a command is capable of. I regularly use it to research what arguments are available. Its very simple to use.
man command
You can use the arrow keys, pgup and pgdn to navigate through the manual. The q key will quit you out.

