Notes
Everyday commands I use at work, up to seven per topic. Replace anything in angle brackets.
- Read a filecat for short files, less to scroll long ones (q to quit).
cat config.yaml less app.log
- Start, end and live tailCheck the latest lines of a log as they arrive.
head -n 20 app.log tail -n 50 app.log tail -f app.log
- Search inside filesRecursive, with line numbers, case-insensitive.
grep -rni "error" ./logs
- Edit a filenano is simplest; in vim press i to edit, Esc then :wq to save.
nano config.yaml vim config.yaml
- Replace text in a fileEvery match, in place.
sed -i 's/old/new/g' config.yaml
- File, folder and disk sizesHuman-readable sizes.
ls -lh du -sh * df -h
- Find filesBy name or by size.
find . -name "*.log" find . -size +100M