LFCS / reference
reference
find / -size +100M -type f 2>/dev/nullFiles over 100MB, suppress errors
find /etc -name '*.conf' -mtime -7Conf files modified in last 7 days
grep -rin 'error' /var/logRecursive, case-insensitive, with line numbers
sed -i 's/old/new/g' fileIn-place global replace
awk -F: '{print $1}' /etc/passwdFirst colon-field of each line
cut -d: -f1,7 /etc/passwdFields 1 and 7
sort file | uniq -c | sort -rnCount + rank duplicate lines
tar czf a.tgz dir / tar xzf a.tgz -C /dstCreate / extract gzip tar
ln -s target linkSymbolic link (hard: omit -s)
systemctl enable --now svcStart now + at boot
systemctl status|restart|reload svcInspect / restart / reload
systemctl daemon-reloadReload unit files after editing
systemctl mask|unmask svcBlock / unblock a service
systemctl get-default / set-default TView / set boot target
journalctl -u svc -fFollow a unit's logs
journalctl -b -p errThis boot, errors only
systemctl --failedList failed units
systemctl list-timersShow all timers
crontab -e / crontab -lEdit / list user cron
modprobe mod / modprobe -r modLoad / unload kernel module
apt install x / dnf install xInstall package
dpkg -S /path / rpm -qf /pathWhich package owns a file
useradd -m -s /bin/bash -G grp uCreate user w/ home, shell, group
usermod -aG grp uAppend user to group
usermod -L u / usermod -U uLock / unlock account
chage -M 90 -E 2026-12-31 uMax age + expiry
passwd uSet password
visudo -f /etc/sudoers.d/uSafely edit a sudoers drop-in
chmod 750 f / chmod g+s d / chmod +t dOctal / SGID / sticky
chown u:g f / chgrp g fChange owner / group
setfacl -m u:carol:rwx f / getfacl fSet / view ACL
setfacl -d -m u:carol:rwx dDefault (inherited) ACL
chattr +i f / lsattr fImmutable bit / view attrs
ip a / ip route / ip link set eth0 upShow addrs / routes / iface up
hostnamectl set-hostname namePersistent hostname
ss -tlnpListening TCP ports + PIDs
ufw allow 80/tcp / ufw statusDebian firewall
firewall-cmd --add-port=80/tcp --permanent && firewall-cmd --reloadRHEL firewall (persist)
nmcli con add/mod/up / nmtuiRHEL persistent networking
ssh-keygen / ssh-copy-id u@hostKeys / push key
timedatectl set-timezone Z / set-ntp trueTimezone / NTP
chronyc sources / chronyc trackingChrony status
nginx -t / apachectl configtestTest web config
restorecon -Rv /pathFix SELinux file context
semanage port -a -t http_port_t -p tcp 8088Allow SELinux port
setsebool -P bool on / getsebool -aPersist / list SELinux booleans
getenforce / setenforce 0SELinux mode
lsblk -f / blkid / findmntInspect block devices / mounts
parted -s /dev/sdb mklabel gpt mkpart ...Partition
mkfs.ext4|xfs /dev/sdb1Make filesystem
mount -a / findmnt --verifyTest fstab safely
pvcreate / vgcreate / lvcreate -L 4G -n lv vgLVM build
lvextend -r -L +2G /dev/vg/lvGrow LV + filesystem
resize2fs /dev/vg/lv / xfs_growfs /mntGrow FS (ext / xfs)
mkswap f / swapon f / swapon --showSwap
cryptsetup luksFormat|luksOpen /dev/sdd nameLUKS encryption
partprobeRe-read partition table