List of some Linux commands that I use, with a description of what they do. Primarily intended as my personal reminder, but if it helps anyone else – great! 🙂
1. Warning
Just a few things you should have in mind when reading this:
Firstly, there are three rules when running Linux commands you find on the Internet (copy/paste):
- Don’t run a command unless you understand exactly what it does.
- Don’t run a command unless you understand exactly what it does.
- Don’t run a command unless you understand exactly what it does.
This goes for the commands shown here as well.
Secondly, I am not a Linux expert.
(Any additions or corrections are more than welcome)
Thirdly, I’m mostly running this on Linux Mint or Ubuntu (depending on which PC or laptop I’m working at). I suppose this should also work with most other Debian-based Linux distributions, but I haven’t tested it.
2. Linux commands list (random order)
Every Linux system I’ve worked with so far opens the command prompt via a keyboard shortcut:
(left-side control keys) ALT + CTRL + T (letter).
2.1. System info
To get useful help from the Linux Mint forum and similar places, it’s best to share your computer info – so any experts can have an idea of what you’re working with.
Operating system version display (and your computer name):
hostnamectlHardware and installed drivers list:
lshw
2.2. Network and Internet
Computer’s IP address:
ifconfigDNS settings list:
systemd-resolve --statusFlush DNS cache:
sudo resolvectl flush-caches
OR
sudo /etc/init.d/dns-clean startRestart network services:
sudo systemctl restart systemd-resolved
sudo systemctl restart NetworkManagerNetwork (bandwidth) usage statistics:
sudo apt install vnstat
sudo systemctl enable vnstat
vnstat -mWindows PowerShell command to save ping results in a text file (until I make a dedicated Windows-related article 🙂 ):
ping.exe -t www.google.com|Foreach{"{0} - {1}" -f (Get-Date),$_} >> c:\test\ping-result-2023-10-18.txtCode language: PHP (php)Chrome update was not working on Ubuntu (22.04) – this fixed it:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get install -fCode language: JavaScript (javascript)Ubuntu 22.04 Viber installation:
wget https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
sudo apt install ./viber.debCode language: JavaScript (javascript)
2.3. System tweaking
For some basic fixes and patches, see the Linux Tweaking section.
Computer is powered off (shut-down) using:
sudo shutdown -h nowRemoving old kernel versions (enter “y” after running the command):
dpkg-query -W -f '${Version}\n' 'linux-image-[^g]*'|sort -u|sed -e '/^$/d' -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/$(uname -r|sed 's/-generic//')/d" -e 's/.*/linux-*-&*/'|tr '\n' ' '|xargs -pr sudo apt-get remove --purge -yCode language: JavaScript (javascript)If that fails, for whatever reason, try this:
dpkg-query -W -f '${Version}\n' 'linux-image-[^g]*'|sort -u|sed -e '/^$/d' -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/$(uname -r|sed 's/-generic\|-lowlatency//')/d" -e 's/.*/linux-*-&*/'|tr '\n' ' '|xargs -r sudo apt-get remove --purge -yCode language: JavaScript (javascript)To install Microsoft fonts (Arial and the bunch 🙂 ):
sudo apt-get install msttcorefontsCode language: JavaScript (javascript)2.4. Visuals
Dark Breeze theme for Kate editor and other software:
sudo apt install breeze breeze-icon-themeLast updated:
Originally published:

# get ip address
ip a
# get dns server ip
cat /run/systemd/resolve/resolv.conf
resolvectl status
# flush dns cache
resolvectl flush-caches
# poweroff
poweroff OR halt
# purge old kernels
sudo apt purge $(dpkg -l | awk ‘/linux-(image|headers|modules)/ && !/’$(uname -r | sed -E ‘s/-[a-z]+//’)’/ && !/hwe/ {print $2}’)