Show Menu
Cheatography

Linux Terminal Commands Cheat Sheet (DRAFT) by

A personal list of common Linux terminal commands

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Files and Navigation

ls
"­lis­t" files and direct­ories in currect location
cd 'location'
"­change direct­ory­" to specified location (no quotes).
cd ..
back out one directory level
cp 'name' 'location'
"­cop­y" file or directory to location (no quotes)
mv 'name' 'location'
"­mov­e" file or directory to location (no quotes)
mkdir 'name'
"Make Direct­ory­" with specified name (no quotes)
rm 'name'
"­rem­ove­" aka delete file (no quotes)
rmdir 'name'
"­rem­ove­" aka delete empty directory
rmdir 'name' -r
deletes directory and its contents
nano 'file'
open file (no quotes) to edit. Ctrl+X to close
touch 'name'.'type'
creates file with (no quotes) Name and File Type (ex: .txt .yml)

Login and Account

ssh 'usern­ame­'@'IP address'
log into machine with username (no quotes), will ask for password
su 'username'
"­Switch User" to specified account (no quotes)
sudo useradd 'username'
creates a new user with specified name (no quotes)
sudo adduser 'username'
creates a new user with specified name (no quotes) with other parameters like passwords
sudo passwd 'username'
create new password for user (no quotes). Ignore username to change current user
exit
log out as current user
 

Updates and Instal­lation

sudo apt update
download the lastest version of pkgs
sudo apt upgrade
install downloaded updates
sudo apt install "pkg name"
installs specific package (no quotes)
sudo apt remove "pkg name"
removes specified package (no quotes)
sudo apt autoremove
removes unused packages (usually depend­encies no longer needed)
 

Docker

docker­-co­mpose up -d
runs docker­-co­mpo­se.yml file in folder without active terminal
docker­-co­mpose down
shuts down docker container
docker ps -all
lists running docker containers