1.3 The UNIX Command line
1. Command Syntax: how a command must be entered to run (correctly).
2. Basic Form:
space,tab space,tab
$ Command-name [whitespace] options [whitespace] parameters
0 or more 0 or more
A Command-name is a special word that represents an executable file
or built-in (to memory) program that the Shell will look for in order
to launch.
For most Unix Systems, an option parameter should start with a dash (-)
or plus (+) followed by a letter or a digit. More than one letter or
digit after a dash usually means multiple options are being specified or
it is a full word option.
On Linux versions of Unix, an option parameter can also start with 2 dashes
(--) followed by a whole word, such as help or version. These are called
Long Options or Word options.
A parameter (or an argument) is a word that gives information for the command
to work with (or on), such as a file name.
3. New command: questions for yourself to ask:
¥ What does the command do?
¥ How do I use the options?
¥ How do I use the parameters?
4. Example: ls command
good: no good:
----- --------
$ ls $ ls -lz
$ ls -a [Works on Linux but not others]--> $ ls file1 -la file2
$ ls -l $ -l ls file3
$ ls -la $ file3 -al ls
$ ls file1
$ ls file1 file2 file3
$ ls -l file1 dir1
$ ls -l -a file1 dir1
5. On-line manual shows syntax for ls as:
ls [-aAcCdfFgilLqrRstu1] [filename...] or
ls [--option ] [filename...] where option may be:
help, version, among many others.
6. Run each of the examples in item 4. Which ones on the left
give error messages?
Questions? Robert Katz: rkatz@ned.highline.edu
Last Update September 20, 2005