Karambir Singh Nain

Simple Linux Tips and Tricks


Using Ubuntu(Pop!_OS) and Arch for a decade and I still forget how to do simple tasks. I am documenting a few here and will keep updating this for future reference.

tar archives

Tar has following options

  • -c is crate archive mode, others are options in that mode
  • -x is extract archive mode
  • -v verbosepopOS
  • -z create gzip
  • -f tar filename

Create and Extract

tar -cvzf test.tar.gz test-dir/
tar -xvzf test.tar.gz /op/test

Split and combine large files

Split command can be used to split large files into many smaller ones:

e.g. split -b 50M thunderbird-profile.tar.gz "profile.tar.gz.part."

Similarly to combine these files again, use cat:

e.g. cat profile.tar.gz.part.* > thunderbird.profile.tar.gz

Combine multiple pdf files

Poppler is a PDF rendering library which provides a lot of utilities to work with PDF files. To combine multiple pdf files to one, we can use pdfunite

sudo apt install poppler-utils
pdfunite input1.pdf input2.pdf input3.pdf output.pdf

How to remove password from pdf file

  1. Install pdftk
  2. sudo apt install pdftk
  3. pdftk <path-to-encrypted.pdf> input_pw <password> output <new-file.pdf>

Socks proxy

ssh -D 8123 -f -C -q -N <user@example.com>

I have this setup as my bash alias.

Monitor ongoing tcp traffic

sudo tcpdump -i eth0

List open TCP ports

sudo netstat -plnt

Disable Gnome tracker daemon

It hogs cores when files are changing fast.

From here

tracker daemon -t
cd ~/.config/autostart
cp -v /etc/xdg/autostart/tracker-*.desktop ./
for FILE in tracker-*.desktop; do echo Hidden=true >> $FILE; done
rm -rf ~/.cache/tracker ~/.local/share/tracker

Flatpack nextcloud autostart setup

Flatpack provided nextcloud doesn't do autostart by itself. Create a file at ~/.config/autostart/flatpak-nextcloud.desktop with following content:

[Desktop Entry]
Exec=flatpak run com.nextcloud.desktopclient.nextcloud --background
Comment[en_IN]=custom command - flatpak
Comment=custom command - flatpak

Install obs virtual camera

From here

sudo apt install v4l2loopback-dkms

Flash windows ISO to usb


sudo add-apt-repository ppa:tomtomtom/woeusb
sudo apt-get update
sudo apt install woeusb wimtools

Then flash ISO

sudo woeusb --device windows.iso /dev/sda