Introduction
Nearly all conventions on Linux originate from Unix or POSIX
Shell Prompt
The prompt is what is displayed when you start a terminal, the default looks like
user@server:~$
This is useful to know which server we're connected to
I might abbreviate this to just $
(simple user), #
(root), or >
(non-shell prompt)
For example
$ sudo su -
# mysql
mysql> exit
Command line arguments
[]
is used for optional argument
$ ls [filename]
...
is used for repeated arguments
$ ls [filename,...]
<>
is used for a mandatory argument
$ cp <source> <destination>
Program Options
Single dash -
is followed by multiple single character options. If multiple characters are specified, each character is a specific option
The following is equivalent
$ ls -ltr
$ ls -l -t -r
A single dash -
, when used in the place of a filename, is a synonym for stdin
. Here we concatenate bar and foo from stdin
$ echo foo | cat bar -
Double dash --
is followed by a single, multi character option
$ ls --all
A single double dash --
without trailing characters shows the end of options. It's useful if an argument starts with a double dash
$ ls -al --annoying-filename
ls: unrecognized option '--annoying-filename'
Try 'ls --help' for more information.
$ ls -al -- --annoying-filename
-rw-r--r-- 1 tatref tatref 0 Dec 20 22:33 --annoying-filename