du -hx / | sort -h ))Benutzer nach Benutzernummer sortiert ausgeben:
sort -t : -k 3n -r /etc/passwd===== uniq ===== Doppelte Zeilen loswerden:
egrep -v '^#' /etc/httpd/conf/httpd.conf | uniqWelcher Benutzer hat wie viele Prozesse laufen:
ps -e --no-headers -o user | sort | uniq -c===== expand ===== Tabs in Spaces
tr : "\t" < /etc/passwd | cat -T tr : "\t" < /etc/passwd | expand -t 15,17,23,29,60,80===== unexpand ===== Spaces in Tab
unexpand -a <<EOF | cat -T
eins 1 drei 3 fünf 5 sechs 6 sieben 7 acht 8
EOFAber nicht:
unexpand -a <<EOF | cat -T
eins 1 drei 3 fünf 5 sechs 6 sieben 7 acht 8
EOF===== fmt =====
wget -q -O - www.gnu.org/licenses/gpl-3.0.txt | fmt -w 40===== pr =====
wget -q -O - www.gnu.org/licenses/gpl-3.0.txt | pr===== join =====
sort -t: -k 3 /etc/group > group sort -t: -k 4 /etc/passwd > passwd join -t: -1 4 -2 3 -o 1.1 2.1 passwd groupAber:
join -t: -1 4 -2 3 -o 1.1 2.1 passwd /etc/group | wc -l wc -l /etc/passwdWo ist der Rest? Alternative:
perl -F: -ane 'BEGIN {$GROUPFILE=shift; open GROUPFILE; %h=map {(split /:/)[2,0]} <GROUPFILE> }; print "$F[0]: $h{$F[3]}\n"' /etc/group /etc/passwd===== head =====
ps ax | head===== tail =====
tail -f /var/log/messages===== hexdump =====
dd if=/dev/sda count=1 bs=1M | hexdump | less===== wc =====
wget -q -O - www.gnu.org/licenses/gpl-3.0.txt | wc===== sed ===== a und b vertauschen:
sed y/ab/ba/ /etc/hostssubnetz ersetzen:
sed -i s/192.168/10.0/g /etc/hostsVerzeichnisweit ersetzen:
find -type f -name "*.c" -exec sed -i s/bla/blub/ {} \;Benutzer nutzer22 aus /etc/passwd entfernen:
sed -e '/^nutzer22/d' /etc/passwd===== tr =====
tr abc xyz < /etc/hosts