Common CLI Utilities
While there are a lot of command line utilities to be aware of and explore, there are a list of ones that are considered essential. These are mostly common in Unix-based operating systems, like Linux and Mac.
awk- A versatile language for working with files and filtering data.
- Eg:
awk '{print $1}' file.txt - Docs
cat- Concatenate files and print on the standard output.
- Eg:
cat file.txt - Docs
cd- Change the current directory.
- Eg:
cd /path/to/directory - Docs
chmod- Change file mode bits (permissions).
- Eg:
chmod 755 file.txt - Docs
chown- Change file owner and group.
- Eg:
chown user:group file.txt - Docs
cp- Copy files and directories.
- Eg:
cp file.txt /path/to/directory - Docs
curl- Call a URL.
- Eg:
curl https://example.com - Docs
df- Report estimate of total filesystem disk space usage.
- Eg:
df -h - Docs
du- Estimate file space usage for a given path.
- Eg:
du -sh /path/to/directory - Docs
echo- Display a line of text/string that is passed as an argument.
- Eg:
echo "Hello, World!" - Docs
env- Print or set the environment variables.
- Eg:
env | grep PATH - Docs
export- Set or export the environment variable.
- Eg:
export PATH=$PATH:/usr/local/bin - Docs
find- Search for files in a directory hierarchy.
- Eg:
find /path/to/directory -name "*.txt" - Docs
grep- Print lines matching a pattern.
- Eg:
grep "pattern" file.txt - Docs
head- Output the first part of files.
- Eg:
head file.txt - Docs
kill- Send a signal to a process, usually to stop the process.
- Eg:
kill -9 1234 - Docs
less- Opposite of more.
- Eg:
less file.txt - Docs
ln- Create a symbolic link to a file.
- Eg:
ln -s /path/to/file link - Docs
ls- List directory contents.
- Eg:
ls -l - Docs
man- Format and display the on-line manual pages.
- Eg:
man ls - Docs
mkdir- Make directories.
- Eg:
mkdir directory - Docs
mv- Move files.
- Eg:
mv file.txt /path/to/directory - Docs
netstat- Show network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
- Eg:
netstat -an - Docs
ps- Report a snapshot of the current processes.
- Eg:
ps aux - Docs
pwd- Print name of current/working directory.
- Eg:
pwd - Docs
rm- Remove files or directories.
- Eg:
rm file.txt - Docs
sed- Stream editor for filtering and transforming text.
- Eg:
sed 's/old/new/g' file.txt - Docs
sort- Sort lines of text files.
- Eg:
sort file.txt - Docs
tail- Output the last part of files.
- Eg:
tail file.txt - Docs
tar- The GNU version of the tar archiving utility.
- Eg:
tar -czvf archive.tar.gz /path/to/directory - Docs
top- Display Linux processes. It provides a dynamic real-time view of the running system.
- Eg:
top - Docs
touch- Change file timestamps.
- Eg:
touch file.txt - Docs
uname- Print system information.
- Eg:
uname -a - Docs
wget- The non-interactive network downloader.
- Eg:
wget https://example.com - Docs
which- Show the full path of commands.
- Eg:
which ls - Docs
who- Show who is logged on.
- Eg:
who - Docs
xargs- Build and execute command lines from standard input.
- Eg:
find /path/to/directory -name "*.txt" | xargs grep "pattern" - Docs