Install tmux with and Without Root Access

Install tmux with Root Access

sudo apt-get install tmux

*Tested on Ubuntu 18.04 LTS

Install tmux without Root Access

Download bash script from Sudhir Mitharwal 


Execute the script and follow the instruction

chmod +x

*Tested on Ubuntu 16.04 LTS

tmux Quick Reference


Command Description
tmux Start a new tmux session
tmux ls List all running sessions
tmux attach -t 0 Connect to session named 0
tmux new -s database Create a new session named `database`
tmux rename-session -t 0 database Rename existing session from `0` to `database`

Command Keys

Keys Description
C-b % Split a pane into left and right
C-b " Split a pane into top and bottom
C-b <arrow key> Navigate to different pane
exit or Ctrl-d Close the pane
C-b c Create a new window
C-b p Go to the previous window
C-b n Go to the next window
C-b <number> Go to specific window number
C-b d Detach from the current session
C-b D Choose which session to detach
C-b z Toggle the pane fullscreen
C-b , Rename current window
C-b ? List available commands

*C-b means press and hold the Ctrl key and press b.


Shell Script Learning Resources

Debian Package Commands

Uninstalling Package

List installed packages

sudo apt list --installed

Remove package

sudo apt remove package_name
sudo apt remove package_name1 package_name2

Remove package with its configuration files

sudo apt purge package_name

Remove unused/orphaned packages

sudo apt autoremove

Install Podman, Buildah, and Skopeo on Ubuntu 18.04

Install podman and the gang

Execute the following commands to install podman, buildah, and skopeo from Kubic package repository.

. /etc/os-release
echo "deb${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L${VERSION_ID}/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman buildah skopeo

Install slirp4netns

In order to forward ports from container run by podman, you need to install slirp4netns by downloading the executable binary into a directory.

LATEST_VERSION=$(curl -s | jq -r '.tag_name')
curl -fL -o slirp4netns${LATEST_VERSION}/slirp4netns-$(uname -m)
chmod +x slirp4netns

Add the directory into PATH variable by appending this line to shell init script (e.g. ~/.bashrc or ~/.zshrc) and restart the shell or source it.

export PATH=/path/to/binaries:$PATH

Test podman

Run a httpd container and forward port 8080 -> 18080

podman run -dt -p 18080:8080/tcp

If you see the error ERRO[0001] unable to write pod event: "write unixgram @00018->/run/systemd/journal/socket: sendmsg: no such file or directory", you seem to run podman in WSL2. Then you need to use the flag --events-backend=file to suppress this error:

podman run -dt -p 18080:8080/tcp --events-backend=file

Check the container status

podman ps

Podman will search in default registries if you don't specify full image name. The default registries are defined in /etc/containers/registries.conf. You can use command podman info to see the list of registries.

You should see the container's name and its status should be up like this:

CONTAINER ID  IMAGE                                 COMMAND               CREATED         STATUS            PORTS                    NAMES
6ffe71fff383  /usr/bin/run-http...  44 seconds ago  Up 5 seconds ago>8080/tcp  priceless_saha

Try to access the web page at http://localhost:18080 and you should see a HTML response.

curl http://localhost:18080

Dont' forget to stop and remove the container:

podman container stop priceless_saha
podman container rm priceless_saha

Test buildah

Buildah works the same as docker build, you just need to use podman build instead and everything works the same.

Clone the repository

git clone

Build the image

buildah bud -t flask-app .

List all the image on local

buildah images
podman images

Run the image in a container

podman run -d -p 5000:5000 --events-backend=file flask-app

Check container status

podman ps

Try accessing applciation at http://localhost:5000/ 

Test skopeo

Use the following command to inspect an image properties on a remote repository:

skopeo inspect docker://

Use the following command to inspect an image configuration on a remote registry:

skopeo inspect --config docker:// | jq

If you don't have jq installed, you can download it from

You can also inspect your local images pulled by podman by using containers-storage transport.

skopeo inspect containers-storage:localhost/flask-app:latest

Copy an image from local registry to

skopeo copy --dest-creds=$user:$password containers-storage:localhost/flask-app:latest docker://


How to Mount a New Hard Drive on Ubuntu

Display all connected hard drives.

sudo fdisk -l

Manage drive partition.

sudo fdisk /dev/sdc

Create a mount point.

sudo mkdir /data

Edit /etc/fstab.

sudo vim /etc/fstab

And append the following line:

/dev/sdc1    /data    ext4    defaults    0    0

Create file system.

sudo mkfs.ext4 /dev/sdc1

Mount partition.

sudo mount /data