LFCS / reference

reference

find / -size +100M -type f 2>/dev/null

Files over 100MB, suppress errors

find /etc -name '*.conf' -mtime -7

Conf files modified in last 7 days

grep -rin 'error' /var/log

Recursive, case-insensitive, with line numbers

sed -i 's/old/new/g' file

In-place global replace

awk -F: '{print $1}' /etc/passwd

First colon-field of each line

cut -d: -f1,7 /etc/passwd

Fields 1 and 7

sort file | uniq -c | sort -rn

Count + rank duplicate lines

tar czf a.tgz dir / tar xzf a.tgz -C /dst

Create / extract gzip tar

ln -s target link

Symbolic link (hard: omit -s)