Linux Cheat Sheets

Table of Contents

Fork me on GitHub

1 Linux Commands

cautionary.png

Basic Shortcuts

  • Don't forget that on Unix systems ~/ means HOME
  • Clear the screen
CTRL l
  • Re-enter last command
CURSOR UP
  • Quit a running process
CTRL c

Navigation

  • list directories and files
ls
# to list a specific directory
ls ~/some/directory/path
  • list directories and files including hidden ones
ls -a
  • change directory
cd ~/some/directory/apth
#To go up one level
cd ..
  • print working directory
pwd

File and Driectory manipulation

  • Show the contents of a file
cat name-of-file
  • Create a directory
mkdir name-of-directory
  • Rename a file
mv oldname.txt newname.txt
  • Move a file
mv myfile.txt path/to/new/location/myfile.txt
  • Copy a file
cp myfile.txt myfile.bac
  • Copy a directory containing files
cp -r myFullDirectory myFullDirectory.bac
  • Remove a file
#WARNING - THIS IS A ONE WAY DEAL
rm myfile.txt
  • Remove an empty directory
rmdir mydirectory
  • Remove a driectory along with everything it contains
#SERIOUSLY - MAKE SURE YOUR WANT TO DELETE THIS
rm -r myDirectory
  • Create a file
touch myfile.txt

Install Software

  • Installing binaries and applications
sudo apt-get update
sudo apt-get install some-cool-software
  • Installing Python libraries
pip3 install my-new-library