Complete List of Bash Built-in Commands

x32x01
  • by x32x01 ||
Bash (Bourne Again Shell) is the default command-line shell in most Linux distributions 🐧.
It’s open-source and released under the GNU Public License (GPL), meaning you can freely install or modify it. You can also download its C language source code from the GNU Foundation.

While Linux offers many different shells, Bash remains the most widely used because of its flexibility, scripting capabilities, and built-in features.

🧠 What Are Bash Built-in Commands?​

Bash built-in commands are core commands integrated directly into the Bash shell - they don’t require any external programs to run.

That means they are faster ⚡ and always available, even if your system is in single-user mode or certain partitions aren’t mounted.

For example:
Bash:
cd /home
echo "Hello World!"
exit
All three (cd, echo, exit) are built-in commands that run instantly without calling external binaries.



💡 Why Bash Built-ins Matter​

Built-in commands are the foundation of shell scripting and Linux administration.
They let you:
  • Navigate directories and manage sessions 📂
  • Handle variables, loops, and conditions 🔁
  • Control process execution and system limits ⚙️
These commands are faster, safer, and ideal for scripting automation.



📜 List of All Bash Built-in Commands​

Here’s a categorized list of all Bash built-in commands you’ll use in daily scripting and administration 🧾👇

🧭 Navigation & Directory Management​

  • cd - Change the current directory.
  • dirs - Display the directory stack.
  • pushd - Add a directory to the stack.
  • popd - Remove entries from the directory stack.
  • pwd - Print the current working directory.



🧮 Variables & Shell Control​

  • declare - Define variables or their types.
  • export - Make variables available to sub-shells.
  • local - Create variables limited to a function.
  • readonly - Mark a variable as read-only.
  • unset - Remove variables or shell attributes.
  • set - Display or set shell attributes.
  • shopt - Toggle optional shell behavior.



🔁 Loops, Logic & Control Flow​

  • break - Exit from a loop.
  • continue - Skip to the next iteration in a loop.
  • return - Exit from a function with a value.
  • exit - Exit the shell with a status code.
  • test - Evaluate conditional expressions.
  • let - Evaluate arithmetic expressions.
  • eval - Combine arguments and execute as a command.



⚙️ Process & Job Control​

  • bg - Resume a job in the background.
  • fg - Bring a background job to the foreground.
  • jobs - List active jobs.
  • disown - Remove a job from the shell’s job table.
  • kill - Send a signal to terminate a process.
  • wait - Wait for a process to finish.
  • suspend - Suspend the current shell session.



🧩 Command Execution & Management​

  • alias - Create a shortcut for a command.
  • unalias - Remove an alias.
  • builtin - Run a shell built-in command directly.
  • command - Run a command without shell lookup.
  • hash - Remember command paths for faster execution.
  • exec - Replace the shell with another process.
  • type - Show how a word will be interpreted.



📖 Input, Output & Display​

  • echo - Display text on the terminal.
  • printf - Print formatted text.
  • read - Accept user input.
  • help - Display help information.
  • times - Show accumulated CPU usage time.
  • trap - Execute a command when a signal is received.



🧰 History & Session Management​

  • history - Show the command history.
  • fc - Edit or list previous commands.
  • getopts - Parse positional parameters.
  • logout - Log out from a login shell.



🔐 System & Permissions​

  • ulimit - Set resource limits for users.
  • umask - Define default file permissions.
  • enable - Enable or disable built-in commands.
  • caller - Show context of active function calls.



🧩 Example: Using Multiple Built-ins Together​

Here’s a quick script combining multiple built-in commands 👇
Bash:
#!/bin/bash
echo "Welcome, $USER!"
cd /var/log
pwd
echo "Listing the first 5 log files:"
ls | head -5
exit 0
This small script uses echo, cd, pwd, and exit - all Bash built-ins that execute quickly and efficiently.



🚀 Final Thoughts​

Mastering Bash built-in commands is a must for anyone working with Linux 🐧.
They’re fast, reliable, and always available - making them the core tools for every system administrator and developer.

By learning how to combine them effectively, you’ll write cleaner, more efficient scripts and gain full control over your system 💪⚙️
 
Last edited:
Related Threads
x32x01
  • x32x01
Replies
0
Views
67
x32x01
x32x01
x32x01
Replies
0
Views
916
x32x01
x32x01
x32x01
Replies
0
Views
940
x32x01
x32x01
x32x01
Replies
0
Views
802
x32x01
x32x01
x32x01
Replies
0
Views
808
x32x01
x32x01
x32x01
Replies
0
Views
744
x32x01
x32x01
x32x01
Replies
0
Views
2K
x32x01
x32x01
x32x01
Replies
0
Views
136
x32x01
x32x01
x32x01
Replies
0
Views
730
x32x01
x32x01
x32x01
Replies
0
Views
784
x32x01
x32x01
Register & Login Faster
Forgot your password?
Forum Statistics
Threads
628
Messages
632
Members
64
Latest Member
alialguelmi
Back
Top