literate-dotfiles/documentation/unix-commands.org
2019-01-31 09:41:03 +01:00

1.4 KiB
Raw Blame History

Unix Commands

Navigation

  • pwd Print Working Directory
  • ls List Segments: list files

    • -a All - show hidden files
    • -l Long
    • -t Time - in order of modification time
  • cd Change Directory
  • mkdir Make Directory

Manipulation

  • cp : copies files
  • mv : moves and rename files
  • rm : remove files
  • rm -r : remove directories (-r : Recursive)

Redirection

  • > : redirects output of a command to a file, overwriting previous content
  • >> : redirects output of a command to a file, appending new content to previous content
  • < : redirects standard input to a command
  • | : redirects standard output of a command to another command
  • sort : sort lines of text alphabetically
  • uniq : filters duplicate, adjacent lines of text
  • grep : searches for a text pattern and outputs it
  • sed : searches for a text pattern, modifies it, and outputs it

Environnement

  • ~ (alt+n) : users home directory
  • nano : line text editor
  • \.bash_profile : is where environment settings are stored

    • export VARIABLE='Value'
    • USER : the name of the current user
    • HOME : home directory (not to customize)
    • env : return a list of environment variables

Grep

grep texte nomfichier

  • -i : ne pas tenir compte de la casse (majuscules / minuscules)
  • -n : connaître les numéros des lignes
  • -v : inverser la recherche : ignorer un mot
  • -r : rechercher dans tous les fichiers et sous-dossiers