Efficient Linux Command Cheat Sheet
This cheat sheet delivers a compact set of Linux command-line shortcuts—including brace expansion for bulk file creation, dd for test files, multiple file‑truncation methods, powerful find queries, background execution with nohup, process termination pipelines, tcpdump traffic captures, and handy sed one‑liners—to boost daily efficiency for administrators and developers.
This article provides a concise collection of practical Linux command-line tricks aimed at improving daily workflow efficiency for system administrators and developers.
It starts with a quick method to create multiple files of the same type using brace expansion: touch haodao{1..100}.py To generate a large test file, the dd command can be used:
dd if=/dev/zero of=/root/haodaolinux/test.txt bs=1M count=1024Several ways to truncate or clear a file are presented, for example:
cat /dev/null > haodao.py echo -n "" > haodao.py true > haodao.py : > haodao.py truncate -s 0 haodao.pyFile searching examples include locating a specific file, all .py files, files with certain permissions, and size ranges:
find . -name haodao.py find . -name "*.py" find . -type f -perm 755 find . -type f -size +100M -size -1GProcess management snippets show how to run commands in the background with nohup and how to kill processes matching a name pattern:
nohup ping www.baidu.com & ps aux | grep xxx | grep -v grep | awk '{print $2}' | xargs kill -9Network traffic capture examples using tcpdump demonstrate filtering by interface, protocol, source/destination IP, and port ranges:
tcpdump -i ens33 -s 0 -w haodao.cap tcpdump icmp and src 192.168.20.231 -i ens33 -nFinally, the article includes useful sed one‑liners for in‑place text replacement, line deletion, and insertion.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
