Operating Systems



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 

wget https://gist.githubusercontent.com/sudkumar/6062def9d56d946b98b6a3853093ee74/raw/66f9bcc5d341e39233d763a7ecfe3402e9de0743/install_tmux_locally.sh

Execute the script and follow the instruction

chmod +x install_tmux_locally.sh

*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 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${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 https://api.github.com/repos/rootless-containers/slirp4netns/releases/latest | jq -r '.tag_name')
curl -fL -o slirp4netns https://github.com/rootless-containers/slirp4netns/releases/download/${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 registry.fedoraproject.org/f29/httpd

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 registry.fedoraproject.org/f29/httpd

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  registry.fedoraproject.org/f29/httpd  /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 https://github.com/pacroy/flask-app.git

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://registry.fedoraproject.org/fedora:latest

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

skopeo inspect --config docker://registry.fedoraproject.org/fedora:latest | jq

If you don't have jq installed, you can download it from https://stedolan.github.io/jq/.

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 docker.io:

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



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



Setting up Perfect Windows 10

based on Setting up the perfect Windows 10 Installation | Faster, Lighter, and Functional - YouTube 

Turn off Allow downloads from other PCs

To stop using bandwidth to send updates to another computers


Disable Windows Update (Optional)

Disable Windows Update service


The service can be sometime reset back enabled so you need a 3rd-party tool to keep checking and disable it.



Windows 10 Debloater

For more up-to-date scrip, visit https://christitus.com/debloat-windows-10-2020/.

Download from https://github.com/Sycnex/Windows10Debloater and run the Windows10DebloaterGUI.ps1 script with Administrator. Click Remove All Bloatware and Disable Cortana.



Turn off all general privacy


Turn off everything in Speech and Inking & Typing personalization

Disable feedback frequency


Turn off location as it unneccessary drains your battery


Turn off Backgroup apps


Turn off App diagnostics


Power Settings

Select High Performance power plan

Turn Off File Content Indexing

This option significantly slows down the computer. Turning off will take sometime to apply to all files on harddrive. Click Ignore All if problem pops up.


Disable Windows Firewall (Optional)

This steps does not recommended on laptop. Run wf.msc and add Allow All inbound rule.