Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active November 19, 2024 22:46
Show Gist options
  • Save dewomser/b47dcd881fa2e38f3989f8bc6d6abf8b to your computer and use it in GitHub Desktop.
Save dewomser/b47dcd881fa2e38f3989f8bc6d6abf8b to your computer and use it in GitHub Desktop.
selten genutzte Bashkommandos: factor, column, bind , find, pv

Schreibmaschine

Anzeige mit Verzögerung

echo "lolo is a dancer"| pv -qL 5

Mehr Infos: https://www.baeldung.com/linux/terminal-simulate-typing-effect

Begriffe suchen in einem Ordner und Unterordnern

find ./ -type f -exec grep -Hn "upload_max_filesize" {} \;

Es wird die Zeile des Suchergebnisses mit Nummer angezeigt.

Findet Dupletten

find . -type f -exec md5sum {} + | sort | uniq -w32 -D

Für Primfaktorzerlegung gibts ein factor-Kommando

Parameter -h gibt's erst seit GNU coreutils 9.2, Debian 12 kommt noch mit coreutils 9.1

factor 24

24: 2 2 2 3

und

factor -h 24

24: 2^3 3

https://de.wikipedia.org/wiki/Primfaktorzerlegung

Mount nur /dev

Alles was gemountet ist als dev oder von dev. Für Mensch übersichtlich gelistet:

mount | grep /dev | column -t -W 6

Tastatur-Shortcut-Handling in Bash geht mit bind

Achtung nicht das

"bind a name to a socket"

sondern

"Bash bind builtin command"

bind -p zeigt alle Shortcuts an

Mehr Infos zu bind: https://www.computerhope.com/unix/bash/bind.htm

cat or no cat ?

$(<file) ist äquivalent zu $(cat file), nur schneller.

Beispiel : P=( $(</etc/passwd) ); echo ${P[0]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment