Skip to main content

Nützliche Befehle & Links

Große Ordner sortiert auflisten

du -h /dein/direcotory/ | sort -rh | head -n 20

Auf welchem Port läuft etwas?

lsof -i :PORT -S

root@server:/# lsof -i :9201 -S
COMMAND   PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
java    81378 user   21u  IPv6 5091945      0t0  TCP *:9201 (LISTEN)

Hostname ändern

Quelle: https://www.tecmint.com/set-hostname-permanently-in-linux/

  • mit SystemD: hostnamectl set-hostname NEW_HOSTNAME

Software RAID erstellen

http://www.prontosystems.org/tux/software_raid

Print all lines between two line numbers

awk: https://www.commandlinefu.com/commands/view/9889/print-all-lines-between-two-line-numbers

sed: https://www.commandlinefu.com/commands/view/9890/print-all-lines-between-two-line-numbers

Get line number from pattern

https://unix.stackexchange.com/questions/182015/find-the-line-number-which-contains-the-pattern-using-custom-regex-delimiter

grep -n 'pattern' file

Ausgabe:
23: pattern

SSH

Port Weiterleitung

ssh -L Port_lokal:localhost:Port_remote [email protected]
Beispiel:
ssh -L 443:localhost:443 [email protected]