Your reference on Linux.
The Linux command line offers a wealth of power and opportunity. If your memory is like mine then you find it hard to remember a large number of details. Fortunately for us there is an easy to use resource that can inform us about all the great things we can do on the command line. That's what we're going to learn about in this section. I know you're keen and eager to get stuck into doing stuff, and we'll get started on that in the next section, I promise, first we need to learn how to use Manual pages however.
The manual pages are a set of pages that explain every command available on your system including what they do, the specifics of how you run them and what command line arguments they accept. Some of them are a little hard to get your head around but they are fairly consistent in their structure so once you get the hang of it it's not too bad. You invoke the manual pages with the following command:
man <command to look up>
Let's break it down:
To exit the man pages press 'q' for quit.
It is possible to do a keyword search on the Manual pages. This can be helpful if you're not quite sure of what command you may want to use but you know what you want to achieve. To be effective with this approach, you may need a few goes. It is not uncommon to find that a particular word exists in many manual pages.
man -k <search term>
If you want to search within a manual page this is also possible. To do this, whilst you are in the particular manual page you would like to search press forward slash '/' followed by the term you would like to search for and hit 'enter' If the term appears multiple times you may cycle through them by pressing the 'n' button for next.
A lot of being proficient at Linux is knowing which command line options we should use to modify the behaviour of our commands to suit our needs. A lot of these have both a long hand and short hand version. eg. Above you will notice that to list all directory entries (including hidden files) we can use the option -a or --all (remember from last section what files and directories beginning with a . are?). The long hand is really just a more human readable form. You may use either, they both do the same thing. One advantage of using long hand is that it can be easier for you to remember what your commands are doing. One advantage of using shorthand is that you can chain multiple together easier.
Look up the man page for ls to find out what that last command is doing.
As you can see, long hand command line options begin with two dashes ( -- ) and short hand options begin with a single dash ( - ). When we use a single dash we may invoke several options by placing all the letters representing those options together after the dash. (There are a few instance where a particular option requires an argument to go with it and those options generally have to be placed separately along with their corresponding argument. Don't worry too much about these special cases for now though. We'll point them out as we encounter them.)
Right, now let's put this stuff into practice. Have a go at the following: