Monthly Archives: January 2012

Lost in the GNU/Linux terminal?

Here are a couple of scenarios and helpful things to try if you are ever left staring at a blinking cursor with no idea what to do next. If you:

1.) Don’t know a command name

The simplest solution is to use “apropos” followed by what you want the command to do. Apropos goes through the manual page summaries and searches them for anything that matches the expression you gave it as an argument. Apropos can search by regex expressions as well.

2.) Don’t know where a config or system file is located

A common scenario: for whichever reason, you need to fiddle around with xorg.conf… again. But you can’t remember where the hell it is… again. In this case, use “whereis” or “locate” followed by file name. It will save you many trips to google.

An interesting fact is that you can use “whereis” on commands as well, to find their location in your system.

3.) Don’t know how to use a command

There are two main ways to do this: one way is very concise, but conveys less information, whereas the other is massive and takes some time to read. Depending on the situation, you might want to use “–help” or “man”.

“man”, the manual page command, is an invaluable resource for learning stuff in the terminal. You can use it by typing man and the name of the command you want to learn about. Then you will be brought to that command’s manual page, which includes info on how to use the command, various options / switches it has and often a technical description of how the command works. You navigate with arrow keys, search by typing “/[insert search term]“, and quit with q.

But often you don’t want to read through an entire manual just to find out how do a simple one-time task. In this case, you can type the name of the command you are curious about followed by -help or –help (depending on the command). However, not all commands have such a switch. This is due to the fact that unlike a manual page, having the –help switch isn’t obligatory for whoever wrote the command to actually implement, but more like a neat thing that everyone expects to be there.

GNU/Linux is a massive and complex system, but thankfully, the short commands and resources listed here greatly simplify the task of navigating and learning its power and potential.