You are here

Linux

Technical Notes

These notes are my personal online notebook of useful commands and "how-to's". You are welcome to make use of them if you find them helpful. They obviously don't come with any warranty! Click on one of the category tags above for the notes in any category.

Unsnap Firefox

Five Steps

sudo snap remove firefox

sudo add-apt-repository ppa:mozillateam/ppa

echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox

echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

sudo apt install -y --allow-downgrades firefox
Topic: 

Repairing grub boot in EFI system running Ubuntu

sudo fdisk -l
#now identify EFI and linux partitions and set them here
#e.g.:
EFI=/dev/nvme0n1p1
LIN=/dev/nvme0n1p6

sudo apt -y install grub-efi
sudo mkdir /media/root && sudo mount $LIN /media/root
sudo mkdir /media/efi && sudo mount $EFI /media/efi
sudo grub-install --target=x86_64-efi $EFI --efi-directory=/media/efi --boot-directory=/media/root/boot

Topic: 

Preventing false mouse double-clicks under linux

Newer versions of Kubuntu are missing the advanced mouse options which let you debounce the mouse

sudo apt install xserver-xorg-input-evdev
sudo mkdir -p /etc/X11/xorg.conf.d

Then edit /etc/X11/xorg.conf.d/xorg.conf

and append:

Section "InputClass"
    Identifier "evdev-mouse"
    MatchIsPointer "yes"
    Driver "evdev"
EndSection

You may have to reboot at this point

Topic: 

Fixing a Linux broken boot

If the system has been corrupted, and there is no grub menu, then boot from a live CD, open a terminal and do this:

Topic: 

Compress a folder into a single file for backup

tar -cvjSf filename.tar.bz2 foldername
-c create
-v verboase
-j bzip2
-S Sparse files handled efficiently
-f filename

Topic: 

Wiping a Hard Drive Clean

To securely wipe a hard drive of all data, do:

apt install wipe
shred -vfz -n 2 /dev/sdb
  • Options above are verbose, force, zero out in an extra pass
  • Number of passes: -n 2

An alternative “light” way of doing this is to simply copy random bytes

Topic: 

iptables configuration on a linux server

  • List current tables with line numbers and stats
iptables -L INPUT --line-numbers -v
  • Append another rule
iptables -A INPUT -s 58.245.23.126/24 -j DROP
  • Delete rule #3
iptables -D INPUT 3
  • The moment you apply IPTABLE rule it immediately becomes active.But it will not survive a reboot.
  • To be able to survive IPTABLES a reboot in your network configuration file /etc/network/interfaces file (referring to a Debian/Ubuntu system) you need to add:
Topic: 

A simple way of restoring the content of deleted text files

Undeleting a file is not easy in Linux.
However, if it's a text file, and you know a phrase from it, you can search the whole drive for the contents:
```
grep -a -C 200 -F "words in file" /dev/hda1 | more #change /dev/hda1 to whatever is appropriate
```

Topic: 

Pages

Subscribe to RSS - Linux