Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

      emacs Reference Card (more intuitive)
      vi Reference Card (available on all Linux systems)

Special characters

/Separates directories in a file path, represents the root directory when used at the start of a path
#Used to start a comment in Bash
$Used to reference the value of a variable
;Allows the execution of multiple commands on the same line

&

Executes the preceding command in the background
|"Pipe", passes the output of one command as input to another
!Negates the exit status of the command that follows it, also used for history expansion
\Escape character. Nullifies the special meaning of the next character, including the invisible "new line" character

Directory abbreviations





~Represents the home directory of the current user in a file path

.

Represents the current directory in a file path
..Represents the parent directory in a file path

Command I/O

>Redirects the output of a command to a file, overwriting the file if it exists
>>Redirects the output of a command to a file, appending to the file if it exists
<Redirects input from a file to a command
<<Redirects a string into the standard input of a command

Wild cards

A number of characters are interpreted by shell before any other action takes place. These characters are known as wildcard characters. Usually these characters are used in place of filenames or directory names.

*An asterisk matches any number of characters in a filename, including none.
?The question mark matches any single character.
[ ]Brackets enclose a set of characters, any one of which may match a single character at that position.
-A hyphen used within [ ] denotes a range of characters.
~A tilde at the beginning of a word expands to the name of your home directory. If you append another user's login name to the character, it refers to that user's home directory.

...

'\' prevents the following character from being "interpreted". There are several "special characters" in shell which have a certain "meaning" and functions as little "commands".
Unfortunately '\' has different meanings depending on where/how it gets used.
Examples:
    $  person=Alex
    $  echo $person
    Alex
    $  echo \$person
    $person              => No evaluation done !!!
    $  echo "\$person"
    $person              => No evaluation done !!!
    $  echo '\$person'
    Alex                   => Evaluation done !!!

When used as the very last character in a line it will surpress the "new line".
    $ cat > text_file << EOF
    > Hello
    > How are you?
    > EOF
    $ cat text_file
    Hello
    How are you?

    $ cat > text_file << EOF
    > Hello, \
    > how are you?
    > EOF
    $ cat text_file
    Hello, how are you?



Command I/O

      >   :command output redirection (create new)
      >> : command output redirection(append)
      <   :command input redirection (from file)
      << : command input (from script orstandard or standard input)

Example:
    $ cat > text_file << EOF
    > Hello
    > How are you?
    > EOF
    $ cat text_file
    Hello
    How are you?

...