Skip to content

Instantly share code, notes, and snippets.

@OdinsPlasmaRifle
Last active December 21, 2022 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OdinsPlasmaRifle/1c00d10e080a9a11791880d4693fdc28 to your computer and use it in GitHub Desktop.
Save OdinsPlasmaRifle/1c00d10e080a9a11791880d4693fdc28 to your computer and use it in GitHub Desktop.

Linux Cheatsheet

Docker Maintenance

Remove dangling images:

docker image prune

Remove all images not used by existing containers:

docker image prune -a

Remove stopped containers:

docker container prune

Remove all unused volumes:

docker volume prune

System prune:

docker system prune

Package Maintenance

Delete all cached versions of installed and uninstalled packages, except for the most recent (3 by default):

paccache -r

Clear out all cached packages that ar enot currently installed

pacman -Sc

Clear out all cached packages:

pacman -Scc

Network Connections

Find connection interfaces:

ip link

Bring a connection interface up:

ip link set dev {interface} up

Configure:

dchpcd

Use netctl to view and control network connections:

netctl list

netctl start {connection}

SSH

Create SSH Key for email address:

$ ssh-keygen -t rsa -b 4096 -C "email@address.com"

Basic SSH key gen:

$ ssh-keygen -t rsa

VPN

Run localhost VPN to server:

$ ssh -L 3128:localhost:8888 -N root@111.111.111.11

or:

$ ssh -L 3128:localhost:8888 -N -i ~/.ssh/key_rsa root@111.111.111.11

Command format:

$ ssh -L {port}:{localhost} -N -i {/path/to/key.rsa} {user}@{host}

To get this to work, change network settings to use localhost (port 3128) as the proxy.

Mounting

To mount an ISO onto a USB drive:

$ dd bs=4M if=/path/to/file.iso of=/dev/sdx status=progress && sync

Displays

xrandr --output HDMI-2 --auto --right-of eDP-1
~/.config/bspwm/bspwmrc

Audio

aplay -l output

LVM on LUKS status

Find out whether a device has full disk encryption.

Show the main drive device:

sudo fdisk -l /dev/sda

Show the device mapper status:

sudo dmsetup status

Show the cryptsetup for the device mapper volume (should point to /dev/sda):

sudo cryptsetup status /dev/mapper/volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment