Skip to content

Latest commit

 

History

History
94 lines (61 loc) · 1.52 KB

bash.md

File metadata and controls

94 lines (61 loc) · 1.52 KB

BASH basics

  • echo X - repeat the string X back
echo hello
hello


  • !! - re-run the last command
!!
echo hello
hello


  • $X - reference of the variable X
x=100 
echo $x
100


  • ls - list the contents of the current directory

    ls -l - a more detailed list

    cd X - change directory to X

    pwd - print the current (working) directory



  • Shortcuts:

. - working directory

.. - parent directory

~ - home directory


  • mkdir X - create a new directory X

    mv X Y - more the file X to the directory Y





  • cat X - display the contents of a file to the terminal

    less X - display the contents of a file to the terminal with the possibility to search and scroll



  • Managing the less command:

    scroll down - spacebar or down arrow

    scroll up - b key or up arrow

    search - forward slack /

    exit less - q key



  • rm X - permanently delete the file X

    rm -i X - permanently delete the file X but double check first

    rm X Y Z permanently delete the files X, Y, Z

    rmdir X - permanently delete the directory X (should be empty)

    rmdir -r X - permanently delete the directory X with all it's content