This content originally appeared on DEV Community and was authored by Shiva Krishna beepeta
Advanced Linux Commands Every Power User Should Know
Intro:
Linux is powerful, and once you move beyond the basics, a whole new world of productivity opens up. This post dives into advanced Linux commands and pro tips to help you work faster, smarter, and more efficiently on the terminal.
1. awk — Text Processing and Reporting
Awk is a scripting language used for manipulating data and generating reports. The awk command programming language requires no compiling and allows the user to use variables, numeric functions, string functions, and logical operators.
awk '{print $1, $3}' file.txt
awk options 'selection _criteria {action }' input-file > output-file
Flags/options with awk command:-
-F Sets a custom field separator
-f Reads awk program from a file
‘{}’ Encloses action to take on match
Use Case: Extract specific columns from structured files.
2. sed — Stream Editor for Modifying Files
The SED command (short for Stream Editor) is one of the most powerful tools for text processing in Linux and Unix systems. It’s commonly used for tasks like search and replace, text transformation, and stream editing.
The basic syntax for using the SED command in Linux is:
sed [OPTIONS] 'COMMAND' [INPUTFILE...]
where,
‘OPTIONS’: These are optional flags that modify the behaviour of the sed command.
‘COMMAND’: This defines the command or sequence of commands to execute on the input file.
‘INPUTFILE’: One or more input files to be processed.
EXAMPLE:-
sed 's/unix/linux/' geekfile.txt
Here the “s” specifies the substitution operation. The “/” are delimiters. The “unix” is the search pattern and the “linux” is the replacement string. By default, the sed command replaces the first occurrence of the pattern in each line and it won’t replace the second, third…occurrence in the line.
To replace only the nth occurance of a word in a line, use the following syntax:
> sed 's/old_word/new_word/n' filename
Use Case: Find and replace text in-place across files.
3. strace — Trace System Calls
‘strace’ is a powerful tool for monitoring and diagnosing processes in Linux. It is primarily used for debugging programs, troubleshooting issues, intercepting and recording system calls, and tracing running processes.
strace -p <PID>
Use Case: Debug processes or binaries by inspecting their system calls.
4. lsof — List Open Files
In the world of Linux, understanding and managing open files is crucial for system administrators and users alike. The Linux operating system provides a powerful utility called lsof (List Open Files) that allows users to gain insights into the files currently open on their system
lsof
Use Case: Identify which process is using a port or file.
5. watch — Repeat Commands Every N Seconds
The ‘watch’ command in Linux is a powerful utility that allows you to execute a command periodically, displaying its output in fullscreen mode.
watch -n 2 df -h
Use Case: Monitor disk usage or other outputs in real-time.
6. rsync — Efficient File Transfer
rsync or remote synchronization is a software utility for Unix-Like systems that efficiently sync files and directories between two hosts or machines.
rsync -avz /src/ user@host:/dest/
Use Case: Fast, incremental backups or file transfers.
Bonus Tips:
Use alias to speed up repeated commands.
Combine find, xargs, and grep for powerful one-liners.
Learn bash functions to automate routine terminal tasks.
Final Thoughts
Mastering these commands can dramatically improve your Linux workflow. Whether you’re managing servers, writing scripts, or troubleshooting systems, these tools give you the power and flexibility that make Linux truly shine.
This content originally appeared on DEV Community and was authored by Shiva Krishna beepeta