Shape (1)

Consists of three parts … well mostly, this is just convention.

  • Command: executable program, or script, shell alias (see below), or shell builtin (like cd)

  • Options: e.g. -i (short option), oder --interactive (long option)

  • Arguments: file names, mostly

Shape (2)

Example: cp - “Copy”
$ cp -i -r /etc ~/tmp
$ cp -ir /etc ~/tmp
  • Command: cp

  • Options: -i and -r

  • Arguments: /etc and /tmp


  • Alternative: long options; e.g. cp

    • --interactive instead of -i

    • --recursive instead of -r

    • ⟶ shell scripts

    • ⟶ readability

  • “Standard” options

    • -h or --help: brief overview

    • -v or --verbose: log/debug outout as the command runs

    • --version: command version

  • There is no standard, only evolution

    dd, used to copy 20K (20*1024) of NULL bytes into trash bin
    $ dd if=/dev/zero of=/dev/null count=20 bs=1024
    ls -h is not helpful either, but human readable
    $ ls -h
    Documents  Downloads  Pictures

Help and Manual

  • Command explains itself when given the option --help (well, mostly)

    $ find --help
    Usage: find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression]
    default path is the current directory; default expression is -print
    expression may consist of: operators, options, tests, and actions:
    operators (decreasing precedence; -and is implicit where no others are given):
          ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
          EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2
    positional options (always true): -daystart -follow -regextype
  • Complete Description is in the manual page (or man page, for short)

    FIND(1)                                                                                                  General Commands Manual                                                                                                 FIND(1)
           find - search for files in a directory hierarchy
           find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]
           This  manual  page  documents the GNU version of find.  GNU find searches the directory tree rooted at each given starting-point by evaluating the given expression from left to right, according to the rules of precedence (see
           section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name.  If no starting-point is specified, `.' is assumed.
           If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the `Security Considerations' chapter of the findu‐
           tils documentation, which is called Finding Files and comes with findutils.  That document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of information.
           The  -H,  -L  and -P options control the treatment of symbolic links.  Command-line arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins with `-', or the
           argument `(' or `!'.  That argument and any following arguments are taken to be the expression describing what is to be searched for.  If no paths are given, the current directory is used.  If no expression is given, the  ex‐
           pression -print is used (but you should probably consider using -print0 instead, anyway).
    ... 20 kilometers more ...

Man Pages: Navigation

  • When used interactively, the man command uses the less command to page its output.




    Quit man


    Integrated help (same keystrokes apply there) - q for “quit help”


    Go to beginning of page


    Go to bottom of page


    Prompts for pattern, search forward


    Prompts for pattern, search backwards


    Repeat last search, go to next occurence


    Repeat last search, go to previous occurence

Commandline Editing: Moving, Deleting

  • Noob: run away screaming!!

  • Expert: come on, don’t panic!



One character left

One character right


Delete character left of cursor


Delete character below cursor

<HOME> (<POS1>), C-a

Move cursor to beginning of line

<END>, C-e

Move cursor to end of line


Delete character below cursor, until end of line


Delete character left of cursor, until beginning of line

C-l (“ell”)

Clear screen

Commandline Editing: Entire Words



C-<left>, M-b

Move cursor one word left

C-<right>, M-f

Move cursor one word right


Delete word right


Delete word left


  • Arrow keys don’t always work (embedded systems are often misconfigured in this regard) ⟶ best to get used to real keys

  • Should the M (Meta, Alt) not work, one can use ESC, followed by the combined character.

    For example Alt+d (pressed at the same time) is the same as ESC, followed by d

Commandline Editing: Entire Lines


Keys for freaks, nerds, and Emacs addicts.



C-y, M-y

Insert from kill ring (here)




Transpose characters


Transpose words


Uppercase word


Lowercase word


Capitalize word

The Tabulator Key: Command Completion

  • Usage absolutely recommended

  • Nobody remembers, for example, all commands the start with git

    $ git       # <-- HIT <TAB> HERE AFTER 'git'
    git                 git-p4              git-resurrect       git-upload-archive  gitk
    git-cvsserver       git-receive-pack    git-shell           git-upload-pack     gitview

The Tabulator Key: Filename Completion

  • Usage absolutely recommended

  • Nobody wants to type long paths

  • Single TAB completes until ambiguity

  • Double TAB shows alternatives

$ less ~/Doc             # <-- HIT <TAB> HERE       -> COMPLETES
$ less ~/Documents/      # <-- HIT <TAB> HERE TWICE -> ALTERNATIVES
2021-12-26-Oesterreich-Pre-Travel-Clearance.pdf                          e7d76d19-dd3d-4d52-9394-2c16dc73f9d1_VStV_921302213705_2021___VStVF.pdf  python-3.10.0-docs-html/
boardingpass_1d9xf3dvd1uzt00tsswu68duh.gif                               Einkommensteuerbescheid1.pdf                                   
boardingpass_b6uy9xqgeojspx1hxshogcbbq.gif                               Einkommensteuervorauszahlungsbescheid1.pdf                               RF-Immobilienbewertung-ETW-2022.pdf Confirmation.pdf                                             Fedora 34 ECE 19.ova                                                     Umsatzsteuerbescheid1.pdf
Buchhaltung.csv                                                          H0020211105124337.pdf                                                    VK9VST311192021_0022021.pdf
$ less ~/Documents/Bu    # <-- HIT <TAB>            -> COMPLETES
less ~/Documents/Buchhaltung.csv
... shows boring stuff ...