Command Types Explained
Command Classification Overview
Shell commands in Linux can be categorized based on their functionality and execution method. Understanding these types helps users effectively navigate and utilize the command-line interface.
graph TD
A[Command Types] --> B[Built-in Commands]
A --> C[External Commands]
A --> D[Shell Script Commands]
A --> E[Executable Commands]
Built-in Commands
Built-in commands are integral to the shell itself and execute directly within the shell environment.
## Examples of built-in commands
echo "Hello, World!"
cd /home/user
pwd
type cd
Command Type |
Characteristics |
Performance |
Built-in |
Executed within shell |
Faster execution |
External |
Separate executable files |
Slightly slower |
External Commands
External commands are standalone executable files stored in system directories.
## External command examples
ls /usr/bin/
which ls
which grep
Shell Script Commands
Shell script commands are custom scripts combining multiple commands for complex tasks.
#!/bin/bash
## Simple shell script example
for file in *.txt; do
echo "Processing $file"
grep "error" "$file"
done
Executable Commands
Executable commands are binary files that can be directly run by the system.
## Checking executable permissions
ls -l /usr/bin/python3
chmod +x script.sh
These command types provide Linux users with versatile tools for system interaction and task automation.