Linux hacks for mouse-haters

Things I forget how to do in Linux.

Things I forget how to do in Linux.

Some of these commands are supposed to be run sudo root, and each may irremediably fuck up your computer, your life, and everything you have ever loved. Then it might challenge you to a break dance battle, I dunno. It won’t be my fault.

Open a file in the GUI from the command line

xdg-open filename.ext

Of course! Why did I not realise that open is spelled xdg-open? For the curious, xdg stands for “Expect Delays Googling”, which is how you work out these unintuitive and unhelpful command names.

Which process is bound to $PORT?

this one.

netstat -pntl | grep $PORT # or
fuser -n tcp $PORT

Must secure boot be disabled?

Apparently not. But it is onerous beyond plausible usefulness, without Microsoft signing kernel modules for you, unless you are working for some secret agency; in which case, call IT support.

Rebuild all DKMS kernel modules

Missing some modules for some kernel version? Here is how to rebuild all kernel version:

ls /var/lib/initramfs-tools | \
    sudo xargs -n1 /usr/lib/dkms/dkms_autoinstaller start

Pinning kernel version because the drivers/modules

This occurred a couple of times for me; I think compatible versions of something I do not want to know about didn’t match with my manually selected versions of some other thing I don’t want to need to care about. Sidestepping the issue by pinning grub default to boot the good kernel seemed to work.

Filesystem hacks

See Linux FS hacks.

Linux audio

I am so sorry. Read Linux audio.

Debian/Ubuntu package file ownership

Two options:

dpkg -S file
dlocate /path/to/file