Operations 9 min read

15 Essential Linux Command-Line Tricks to Boost Productivity

This article presents fifteen practical Linux command‑line techniques—including quick file truncation, large file generation, secure disk wiping, system‑disk creation, process runtime inspection, real‑time log monitoring, timestamp conversion, execution timing, ASCII lookup, handling garbled filenames, retrieving public IP, batch downloading, and command‑history shortcuts—to help users automate tasks and improve efficiency.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
15 Essential Linux Command-Line Tricks to Boost Productivity

Linux command line is a powerful tool for automation and efficiency; this article shares fifteen practical tips to boost productivity.

1. Quickly empty a file Use the shortest command: $ > access.log Other common methods include:

: > access.log
true > access.log
cat /dev/null > access.log
echo -n "" > access.log
echo > access.log
truncate -s 0 access.log

2. Generate a large file Use dd to create a 1 GB file: $ dd if=/dev/zero of=file.img bs=1M count=1024 3. Securely erase disk data Overwrite a disk with random data: $ dd if=/dev/urandom of=/dev/sda 4. Quickly create a bootable system disk Write an ISO image to a USB or disk: $ dd if=ubuntu-server-amd64.iso of=/dev/sdb 5. View a process’s running time Use ps -p PID -o etimes,etime to see elapsed time, or ps -p PID -o rss for memory usage.

$ ps -p 10167 -o etimes,etime
ELAPSED     ELAPSED
1712055 19-19:34:15

6. Dynamically monitor logs Tail a file with -f and stop on a pattern:

$ tail -f test.log
$ tail -f test.log | sed '/Failed/ q'

7. Convert timestamps Turn a Unix timestamp into a readable date:

$ date -d@1234567890 +"%Y-%m-%d %H:%M:%S"
2009-02-14 07:31:30

Get the current timestamp with date +%s.

8. Measure program execution time Use time to obtain real, user, and sys times and understand their differences.

$ time ./test
real    0m1.003s
user    0m0.000s
sys     0m0.000s

9. View ASCII table Run man ascii to see character codes.

10. Delete files with garbled names Find by inode and remove:

$ ls -i
138957 a.txt 138959 T.txt 132395 �?.txt
$ find . -inum 132395 -exec rm {} \;

11. Get your public IP address Simple curl queries:

$ curl ip.sb
$ curl ifconfig.me

12. Batch download web resources Use wget with filters:

$ wget -r -nd -np --accept=pdf http://fast.dpdk.org/doc/pdf-guides/

13. History command shortcuts Examples: !!, !N, !pw, !$.

14. Quickly search command history Press Ctrl+r and type a keyword.

15. Hide sensitive commands from history Prefix a command with a space so it is not recorded.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

automationLinuxproductivity
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

0 followers
Reader feedback

How this landed with the community

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.