My Linux Cheat Sheet

Frequently needed but always forgotten.

Vim

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

Git

git config --global user.email 'email@oofnivek.com'
git config --global user.name '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

Virtualbox

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

Tmux

Start a new session

tmux

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 '~/script.sh'

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