Knowing how to find help in Unix is important, as is knowing how to multitask. In this section, you'll have the chance to practice both as we load the Unix help manual and learn how to switch between running tasks.
Getting Help in Unix
Unix has a few ways to get help. One is the man command, which stands for manual. You can look up the help manual pages for any command in Unix to get more information about that command. Let's look up the ls command.
Step 1.To look at the man pages for thelscommand, type:
man ls Enter
The man command is automatically piped to the less command, so you can navigate through the manual pages just like we did when we used the lesscommand earlier: Spacebar to go forward a page, and b to go back a page.
As you review the manual pages, you will see that there are many options besides -l that can be used with the ls command. One of these is the -a option. As it says in the manual pages:
do not ignore entries starting with.
If you want to try one of the options you could exit the man pages. However if you want to try an option and then refer to the man page again an easier method is to use Unix's multi-tasking feature.
In Windows, you can run more than one application at once and toggle from one to the other by pressing Alt key+Tab keyor using the taskbar. In Unix, you suspend one and start another. All the processes currently running can be seen with the jobs command.
We would like to suspend the man process.
Step 1.To start to suspend the man process, press:
+ Stopped man ls
You may have several processes suspended at once, even though we have only one suspended currently.
Now that we have suspended the man command let's change to our home directory, and try out the -a option.
Issuing the cd command without specifying a directory name will take you to your home directory.
Step 2.To change to your home directory, type:
Step 3.To get a directory listing with hidden dot files, type:
ls -a Enter
You see some filenames that begin with a dot (.) that were previously hidden.
NOTE: We've been viewing the list of our files just like we had specified the flag option (-F). The flag option marks directories with a slash (/) so that we can easily tell them apart from files. We've done this by setting up a replacement for the traditional ls command. We'll see how to change this back a little later.
You can use more than one option with a command at a time. Try these other options with the lscommand and notice the difference in the output.
Returning to the Suspended Job
You return to viewing the results man gave you by foregrounding. You begin by finding out the job number Unix assigned to the man ls command.
Step 1.To see your jobs, type:
+ Stopped man ls (wd: ~/Shared)
Unix has assigned the number "1" to this job. You use that number when you issue the foreground command, fg.
Step 2.To foreground the first job, type:
fg 1 Enter
You return to the man pages for the ls command.
Step 3.To exit the manual pages, press:
That command quits the manual pages, and you are returned to the command prompt.