Useful Linux commands

A few things that have helped me in my Linux journeys. I’ll add to these as I find new helpful things. These commands are for an Arch-based setup.

Systemd errors

Where -p 3 means priority error, -x provides extra message information, and -b means since last boot. Useful for finding out if a service (systemd) didn’t start or errored out. Of course, this command assumes you run systemd as an init process.

journalctl -p 3 -xb

What video card driver is running?

lspci -k | grep -EA3 'VGA|3D|Display'

Reset X screen resolution.

Useful if a game or an application leaves your screen all screwy. This assumes you have xorg-xrandr installed.

xrandr -s 0

Remap capslock

This remaps capslock ( a useless key by default ) to compose, so you can easily type in œ and ů etc, without needing to worry about what your compose key is. For a permanent solution, place this line in an init script like .xinitrc or .bashrc.

Note that in KDE this won’t work, as it ignores both of these startup scripts. This page explains what to do if you run KDE. Otherwise:.

setxkbmap -option compose:caps

Network Manager

Installing Arch Linux, and not getting any internet connectivity with a USB tethered phone despite setting it up using ip link? Do dhcpcd name-of-device and it should connect.

Can’t start Network Manager on Arch Linux? Although the app is called networkmanager when you download it, the actual installed app is called NetworkManager – note the capitalisation. So, to enable and run it, it’s:

sudo systemctl {enable|start} NetworkManager

Delete key not working as expected?

If you’re using the zsh shell, the delete key may insert a tilde (~) rather than erase. The fix for this is delightfully simple. First, find out what your delete key is referenced as by typing in cat then pressing the delete key. It should be: ^[[3~ Press Ctrl-C to exit cat.

In your .zshrc add:

bindkey "^[[3~" delete-char

Save file, then source .zshrc

©1996-present Peter Greenwell Text and images Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.