28 April, 2021

DevOps Notes

Here are some tasks that a dev-ops might use.

Shutdown or Restart

sudo reboot
sudo shutdown -h now

Install and Update

sudo apt install unzip
sudo apt list --installed
sudo apt update
sudo apt list --upgradable
sudo apt upgrade
sudo apt autoremove

Remove packages

sudo apt remove mysql-server


Use tmux to split the console in two.

Create a .ssh/config file

Host 1
  Port 22
  User phyrum


Ctrl+a - Go to the start of line

Ctrl+e - Go to the end of line

Ctrl+d - Delete character

Ctrl+w - Delete word on the left

Ctrl+k - Delete rest of line

Ctrl+u - Delete all left from cursor

!! - Use previous command

Ctrl+y - Paste

Alt+f - Go to next word

Alt+b - Go to previous word

Alt+. - Paste last parameter

Alt+t - Swap previous 2 words

Alt+u - Uppercase next word

Alt+l - Lowercase next word

Ctrl+l - Clear screen



tmux a

tmux a -t x

tmux new -s x

Ctrl+b d - Detach, tmux attach-session

Ctrl+b c - Open new window

Ctrl+b l - Last window

Ctrl+b n - Next window

Ctrl+b p - Previous window

Ctrl+b 0 - Go to window 0

Ctrl+b [ - Copy mode

Ctrl+b % - Split window vertically (left/right arrow switch window)

Ctrl+b " - Split window horizontally (up/down arrow switch window)

Ctrl+b z - Zoom window

Ctrl+b & - Kill window


Show updated files:

git remote update
git diff --name-only origin/master
git diff --name-only origin/master | grep "^Frontend/"

This can be used to check if there are changes:

if git diff --name-only origin/master | grep -q '^Frontend/'; then
  echo "has changes"
  echo "no changes"


Create executable script without extension in daily folder /etc/cron.daily or other cron.* folder.