2024-04-04 11:37:35 +02:00

2.2 KiB

title tags created published
Linux note software linux 2023-07-01T08:51:23Z true

The following commands have been tested with Arch Linux. They might work in other distributions with a few modifications. The commands assume standard user permissions and will include sudo if root permissions are required.

lsof

List open TCP connections

sudo lsof -PniTCP

List open UDP connections

sudo lsof -PniUDP

nu

Sort files and directories by size

ls -ad | sort-by size | reverse

Filter processes with a high cpu usage

ps | where cpu > 0 | sort-by cpu | reverse

Filter processes with a high memory usage

ps | where mem > 30MB | sort-by mem | reverse

openssl

Show certificate info

openssl x509 -text -noout -in $file

pacman

Install a package

sudo pacman -S $package

Uninstall a package and its dependencies

sudo pacman -Rs $package

List installed packages

pacman -Q

List orphaned packages

pacman -Qtdq

Clear cache

sudo pacman -Sc

rg

Search recursively

rg $text

Search single file

rg $text $file

Disable all filters

rg -uuu $text

rsync

Sync directory with a server

rsync -avz $source $destination

Preview changes

rsync -avz $source $destination --dry-run

systemd

List all running services

systemctl --type=service --state=running

List all enabled services

systemctl list-unit-files --type=service --state=enabled

Follow log messages

journalctl -f

Follow log messages for a specific unit

journalctl -f -u $unit

Show boot time analysis

systemd-analyze blame

Reboot into BIOS

systemctl reboot --firmware-setup

tar

Compress ze vucking files

tar czvf $name.tar.gz .

Extract ze vucking files

tar xzvf $name.tar.gz

users

Add a user

useradd -m $user

Add a group to a user

usermod -aG $group $user

wmctrl

Close all windows

wmctrl -l | awk '{print $1}' | xargs -rn1 wmctrl -ic