Operation Manual

The Linux Command Line
155
Notes:
Lesson 6.2: Command syntax and file structure
Commands take the form:
<Command> | <Switches> | <Parameters> | <Target>
In guides, such as this one, the brackets “<” and “>” are often used to indicate
the place a command would take in a string of text being typed into the CLI.
The horizontal line “|” is used to denote “or. Confused? Okay, let’s look at the
example above. We would read that as saying that commands can be used by
themselves OR they can be used with:
Switches: single letters, preceded by a hyphen, that adjust what the
command does
Parameters: things that the command needs to know in order to work
A target: the thing (such as a file) that the command will be applied to
Let’s look at an example. We’ll start with the “ls” command, which you can use to
see a list of a folder’s contents.
ls -l /home/brian
This command tells the command line to list, in long format, the contents of the
directory “/home/brian”. The command is “ls”; the switch “-l” tells Linux that you
want the list in long format; and the target of this command is the directory
/home/brian”. In this example, there are no parameters, so that part of the
command is just skipped.
ls
Lists the contents of directories.
For a slightly more detailed example, let’s look at the “mount” command, which
tells Linux to incorporate a new file system (such as a CD or DVD) into its own file
system structure so that you can browse it.
mount -F smbfs //workgroup;fred:foo@192.168.1.99/homes /mnt/net
This command tells the operating system to use the username “fred
and password “foo” (parameters) to make the shared drive called “homes” on
the Windows server at 192.168.1.99 (parameter) appear in the directory tree at
the point “/mnt/net” (target) using the Server Message Block Filing System
(the -F switch).
mount
Makes a file structure available at a new location.
Command Switch Target
Command Switch Parameters Target