Operations 9 min read

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.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
Efficient Linux Command Cheat Sheet

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=1024

Several 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.py

File 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 -1G

Process 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 -9

Network 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 -n

Finally, the article includes useful sed one‑liners for in‑place text replacement, line deletion, and insertion.

Automationshellcommand linesysadminscriptingbashlinux
Java Tech Enthusiast
Written by

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!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.