START here

BikeGremlin Linux command notes

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! 🙂

Table Of Contents (T.O.C.):

  1. Warning
  2. Linux commands list (random order)
    2.1. System info
    2.2. Network and Internet
    2.3. System tweaking


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):

  1. Don’t run a command unless you understand exactly what it does.
  2. Don’t run a command unless you understand exactly what it does.
  3. 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 running this on Linux Mint. It probably works on Ubuntu as well. I suppose it should work with most Debian-based Linux distributions, but I haven’t tested it.

– T.O.C. –


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):

hostnamectl

Hardware and installed drivers list:

lshw

– T.O.C. –


2.2. Network and Internet

Computer’s IP address:

ifconfig

DNS settings list:

systemd-resolve --status

Flush DNS cache:

resolvectl flush-caches

OR

sudo /etc/init.d/dns-clean start

Network (bandwidth) usage statistics:

sudo apt install vnstat

sudo systemctl enable vnstat

vnstat -m

Windows 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.txt

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 -f

Ubuntu 22.04 Viber installation:

wget https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb

sudo apt install ./viber.deb

– T.O.C. –


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 now

Removing 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 -y

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 -y

To install Microsoft fonts (Arial and the bunch 🙂 ):

sudo apt-get install msttcorefonts

– T.O.C. –

1 thought on “BikeGremlin Linux command notes”

  1. # 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}’)

Comments are closed.


Please use the BikeGremlin.net forum for any comments or questions.

If you've found any errors or lacking information in the article(s) - please let me know by commenting on the BikeGremlin forum.
You can comment anonymously (by registering with any name/nickname), but I think it is good to publicly document all the article additions (and especially corrections) - even if their author chooses to remain anonymous.

Skip to content