Start » Linux » Tweaking » BikeGremlin Linux command notes

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


Hardware and installed drivers list:


– T.O.C. –

2.2. Network and Internet

Computer’s IP address:


DNS settings list:

systemd-resolve --status

Flush DNS cache:

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

– 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

– 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}’)


Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.