- by x32x01 ||
In the previous article, we talked about Bash environment variables and how they affect shell scripting. Now, it’s time to explore another crucial part of Linux scripting - Bash external commands 🔥.
External commands are programs that exist outside the shell itself, unlike built-in commands such as echo, test, or which. These commands are usually separate executables located in directories like
They allow you to perform powerful tasks - from file management and user control to data compression, searching, and system monitoring. 💪
These external programs are standalone utilities installed in your system, and you can easily combine them in scripts to automate complex tasks.
👉 For example:
Here, grep and less are external commands working together to filter and view log files efficiently.
They help you:
Combine them with loops, variables, and conditionals - and you’ll unlock the full power of Linux automation 🐧💻
External commands are programs that exist outside the shell itself, unlike built-in commands such as echo, test, or which. These commands are usually separate executables located in directories like
/bin or /usr/bin.They allow you to perform powerful tasks - from file management and user control to data compression, searching, and system monitoring. 💪
⚙️ What Are Bash External Commands?
When you use a command like grep, ls, or cat, Bash doesn’t handle it internally - it actually calls an external program.These external programs are standalone utilities installed in your system, and you can easily combine them in scripts to automate complex tasks.
👉 For example:
Code:
grep "error" /var/log/syslog | less 📜 List of Common Bash External Commands
Below is a handy list 🧾 of the most useful Bash external commands you’ll use every day while working with Linux:🗜️ File Compression and Archiving
- bzip2 - Compress files using the Burrows-Wheeler algorithm and Huffman coding.
- gzip - GNU’s compression tool using Lempel-Ziv compression.
- compress - The original Unix file compression utility.
- tar - Archive multiple files and directories into one single file.
- zip - Unix version of the Windows PKZIP utility.
📂 File and Directory Management
- cat - Display file contents.
- cp - Copy files to another location.
- mv - Move or rename a file.
- rm - Delete a file.
- mkdir - Create a new directory.
- rmdir - Remove an empty directory.
- ls - List directory contents.
- touch - Create a new empty file or update timestamps.
- pwd - Print the current working directory.
- stat - Display detailed file information.
👥 User and Group Management
- useradd - Create a new user account.
- usermod - Modify existing user details.
- userdel - Delete a user account.
- groupadd - Create a new group.
- groupmod - Modify group settings.
- chage - Set password expiration rules.
- passwd - Change a user’s password.
- chsh - Change a user’s default shell.
- chfn - Modify user info like full name or phone.
- chgrp - Change a file’s group ownership.
- chown - Change file ownership.
- chpasswd - Bulk update of user passwords.
💾 Disk and System Utilities
- df - Display disk space usage.
- du - Show disk usage for directories or files.
- mount - Mount storage devices.
- umount - Unmount storage devices.
- file - Detect file type.
- finger - Display user account details.
- ps - Show running processes.
- killall - Kill processes by name.
🔍 Searching and Text Processing
- grep - Search files for specific patterns or text.
- sort - Sort lines of text files.
- head - Show the first few lines of a file.
- tail - Show the last few lines of a file.
- less - Advanced file viewer.
- more - Simple file viewer that pauses per screen.
- link - Create a hard link to a file.
- expr - Evaluate expressions.
- cut - Extract specific sections from text lines.
🚀 Why External Commands Matter in Bash
External commands are the building blocks of Linux shell scripting.They help you:
- Automate system administration tasks ⚙️
- Analyze and process large files efficiently 📊
- Manage users, permissions, and resources easily 🔐
🧩 Final Thoughts
Whether you’re managing users, analyzing logs, or organizing data, Bash external commands are your best tools for the job.Combine them with loops, variables, and conditionals - and you’ll unlock the full power of Linux automation 🐧💻
Last edited: