A comprehensive list of Linux CLI tools, with examples.
grep : Searching text within files, for example finding a specific string in a log file.
awk : Text processing and data extraction from files.
sed : stream editing for transforming text in a pipeline.
curl : Transferring data from or to a server, often used for making HTTP requests.
wget : Non-interactive network downloader, useful for retreiving files from the web.
ssh : Securely connecting to remote servers.
scp : Securely copying files between hosts on a network
rsync : Synchronizing files and directories between two locations.
tar : Archiving files into a single file and extracting files from an archive.
gzip : Compressing files.
top/htop : Displaying real-time system processes and resouce usage.
ps : Displaying information about active processes.
df : Displaying disk space usage.
du : Estimating file space usage.
netstat/ss: Network statistics, useful for monitoring network connections and routing tables.
ping : Checking the connectivity between the local host and remote network host.
traceroute : Tracing the route packets take to reach a network host.
ip : Displaying and manipulating routing, network devices, interfaces, and tunnels.
iptables : Setting up, maintaining, and inspecting the tables of IP packet filter rules in the linux kernel
cron : Scheduling automated tasks to run at specified intervals.
systemcl : Managing system services.
The grep
command in linux is a powerful tool used for searching text using patterns. It has many options that can be combines to perform complex text searches.
grep PATTERN FILE
-i
: Ignores case distinctions.
grep -i "pattern" pattern.txt
-v
: Invert match, showing lines that do not match the pattern.
grep -v "pattern" pattern.txt
-c
: Count the number of matching lines.
grep -c "pattern" pattern.txt"
-l
: List file names with matches.
grep -l "pattern" *.txt
-L
: List file names with the matchs.
grep -L "pattern" *.txt
-n
: Show line numbers with output.
grep -n "pattern" pattern.txt
-r / -R
: Recursively search directories.
grep -r "pattern" ~/patterns
-w
: Match whole words
grep -w "pattern" pattern.txt
-x
: Match whole line.
grep -x "pattern" pattern.txt
-o
: Show only matched parts of a line.
grep -o "pattern" pattern.txt
-q
: Quiet mode ( no output, exit status indicates match)
grep -q "pattern" pattern.txt