Linux cheatsheet

Basics
history # show command history
!!      # repeat the last command
!<n>    # refers to command 'n'
exit    # log out of current sess
env     # display environment variables
clear   # clear content on window
Navigate
pwd
ls
ls -a|-all -l -h|--human-readable
tree
tree -a
cd foo
cd ~|-
Files
touch foo.txt
mktemp -t bar.txt
cat foo.txt
head bar.txt
mv foo.txt bar.txt
cp foo.txt bar.txt
rm bar.txt
Directories
mkdir foo
mkdir -p|--parents foo/bar
mktemp -d|--directory

rmdir foo
rm -r|--recursive foo
Permissions
chmod +100 foo.sh
chmod -100 foo.sh
chmod u+x foo.sh
chmod g+x foo.sh
chmod u-x,g-x foo.sh
chmod u+x,g+x,o+x foo.sh
chmod a+x foo.sh
chmod +x foo.sh
shell
shell