# 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? netstat -pntl | grep$PORT # or
fuser -n tcp \$PORT

## Copy to the clipboard from the command line

Easy, and yet! Needlessly doesn’t do what you expect per default.

The command i xclip. The argument you need to mean that you can paste what you copied is -selection clipboard. See stackexchange.

cat foo.txt | xclip -selection clipboard

I can never remember this half way through a pipe when I need it, so I put this in my bash profile.

alias pbcopy "xclip -selection clipboard"

Alternatively, in the fish shell, one can use the magical command which works everywhere:

fish_clipboard_copy

## 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.

## Talking to Windows filesystems

Actually worth doing and I really should write down how I did it but deadlines etc.

Short version: NTFS can be whipped into providing a POSIX-compatible FS, with OK performance and is a good interchange system on a dual-boot Windows/Linux maachine. (Although I don’t know how to make it encrypt) FAT32 is a metadata nightmare and causes all sorts of nasty issues. NTFS can be made to not cause these issues, but you need to set it up right. ExFAT is also OK and a little bit faster, but does not have flexible case sensitivity (always case insensitive).

## LVM

Logical Volume manager has been current for a decade, which means that it is one decade newer than what I’m used to.

## Linux audio

I am so sorry. Read Linux audio.

## Debian/Ubuntu package file ownership

Two options:

dpkg -S file
dlocate /path/to/file