- 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
-
curl 'http://www.google.com' - download the page
curl -L -o some_file.html 'http://www.google.com' - download the page following redirects (-L) and outputing the result to the some_file.html (-o)
-
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