Difference between revisions of "CSC231 Bash Tutorial 3"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- <bluebox> In this lab you will learn about the manual pages, and pipes. </bluebox> <br /> =Manual Pages= <br /> * Linux contains its own documentation. It's calle...")
 
(Manual Pages)
Line 14: Line 14:
 
* the line <tt> ls [OPTION]... [FILE]... </tt> indicates that the command takes ''optional'' arguments, or ''switches'', and ''optionally'' the name of a file.  The line below indicates that <tt>-a</tt> ls will not ignore entries starting with a dot.
 
* the line <tt> ls [OPTION]... [FILE]... </tt> indicates that the command takes ''optional'' arguments, or ''switches'', and ''optionally'' the name of a file.  The line below indicates that <tt>-a</tt> ls will not ignore entries starting with a dot.
 
* Let's see how to apply this information (do not type the text in parentheses):
 
* Let's see how to apply this information (do not type the text in parentheses):
+
{|
 +
|
 
  cd
 
  cd
  ls            ''(this will list all the files)''
+
  ls             
ls *.asm  ''(this will list only the files ending with .asm)''
+
ls *.asm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ls -a        ''(this will list all the files in your '''home''' directory, including the '''hidden''' files)''
+
ls -a       
           
+
|
 +
''(go back to your home directory)''
 +
''(this will list all the files)''
 +
''(this will list only the files ending with .asm)''
 +
''(this will list all the files in your '''home''' directory, including the '''hidden''' files)''
 +
|}           
 
* Other man pages you should look at:
 
* Other man pages you should look at:
 
   
 
   

Revision as of 10:25, 16 February 2017

--D. Thiebaut (talk) 10:23, 16 February 2017 (EST)


In this lab you will learn about the manual pages, and pipes.


Manual Pages


  • Linux contains its own documentation. It's called the Linux Manual Pages, and you access them using the man command.
  • Let's get the manual pages for some of the commands you know:
man ls
 
  • the line ls [OPTION]... [FILE]... indicates that the command takes optional arguments, or switches, and optionally the name of a file. The line below indicates that -a ls will not ignore entries starting with a dot.
  • Let's see how to apply this information (do not type the text in parentheses):
cd
ls             
ls *.asm         
ls -a         

(go back to your home directory) (this will list all the files) (this will list only the files ending with .asm) (this will list all the files in your home directory, including the hidden files)

  • Other man pages you should look at:
man rm
man cp
man mkdir
man rmdir

  • If for some reason you want to use a command but you don't know its name, try searching the man pages for a keyword. For example, you forgot the command name hexdump, but remember that it displays information in hexadecimal...
man -k hexadecimal

If you go up the list, you should find hexdump.



The man pages were created at a time when search engines did not exist, and they were the quick way for Linux users to have access to the documentation of Linux commands. Nowadays you can probably get less cryptic and more informative examples by using Google to search for various commands, either by name, or by keywords. None the less, what you will get on Google will only be a variation on the original contents of the man pages.