My Linux Cheat Sheet

Frequently needed but always forgotten.


cd ~ 
echo 'set tabstop=2'>>.vimrc
echo 'set shiftwidth=2'>>.vimrc
echo 'filetype indent on'>>.vimrc
echo 'set hlsearch'>>.vimrc


git config --global ''
git config --global 'Kevin FOO'
git config --global core.editor "vim"
git config --global credential.helper store
git config --global credential.helper 'cache --timeout 2592000'

2592000 = 30 days in seconds.

To add all files in current directory

git add .

To commit and push

git commit
git push


Install Virtualbox guest additions. Tested working in Linux Mint 20 Ulyana. Ran properly for a while for Elementary OS 5.1.5 Hera, then crash. Did not manage to get it working with Ubuntu Mate 20.04, maybe I missed something.

sudo apt update
sudo apt upgrade -y
sudo apt install virtualbox-guest-x11 -y
Image for post
Image for post
Image for post
Image for post

After setting up the shared folder, run the command below to grant permission to the folder.

sudo adduser $USER vboxsf


Start a new session


Start a new session with a name

tmux new -s session_name

List all tmux sessions

tmux ls

Attach last used session

tmux a

Attach session using session name

tmux attach -t session_name

Kill a session

tmux kill-session -t session_name

Run a script in a new tmux session and detach it

tmux new -s session_name -d '~/'

Within tmux

Detach a session = Ctrl+b, d
Previous window = Ctrl+b, p
Next window = Ctrl+b, n
Select window 1 = Ctrl+b, 1
Close window = Ctrl+d
New window= Ctrl+b, c

< Back to all the stories I had written

Written by

A software engineer, a rock climbing, diving & rollerblading enthusiast, a husband, a father.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store