Linux: Bash Built-in Commands Cheat Sheet

All Linux users acknowledge the contributive power of the command-line/terminal environment. It is a wild card when it comes to accomplishing almost 90% of computing tasks associated with any Linux operating system distribution.

By default, any Linux distribution is prepackaged with numerous Inbuilt commands that are useful in meeting day-to-day computing objectives. This list of commands might seem endless and therefore intimidating to newcomers with a thirst for Linux.

Also, expert Linux users might forget the usage syntax associated with such commands. This article guide provides a reference manual for inbuilt Linux commands which will be priceless during your Linux computing routines.

To make this Linux commands more memorable or easy to reference, we will categorically address them:

Linux File System Navigation Commands

ls Command

Lists files and directories present in the current folder/directory:

$ ls
List Files in Linux
List Files in Linux

To view more details like the owner, group, size, and relevant timestamps to the listed files and directories.

$ ls -l
List Files Info in Linux
List Files Info in Linux

You can also list the files of a specific file/directory.

$ ls -l bin
List Files in Directory
List Files in the Directory

To view hidden files (if any) within a directory. Hidden files’ naming convention starts with a period e.g. .i_am_hidden.

$ ls -a
List Hidden Files in Linux
List Hidden Files in Linux

pwd Command

The pwd (print working directory) commands points a user to the absolute path of the current working directory:

$ pwd
Check Present Working Directory
Check Present Working Directory

cd Command

Effective in navigating to a different directory location by specifying its absolute path:

$ cd Apps
$ cd /home/dnyce
$ cd Documents
$ cd ~
$ cd -
Change Directory in Linux
Change Directory in Linux

file Command

Reveals the type of file/directory existing on our Linux machine:

$ file bin
$ file emm.jpg
$ file passwd
Find File Types in Linux
Find File Types in Linux

Linux File Manipulation Commands

mdkir Command

Creates a new non-existing directory:

$ mkdir new
$ ls
Create New Directory in Linux
Create New Directory in Linux

touch Command

Creates a new blank file.

$ touch new.txt
$ ls -l new.txt
Create New File in Linux
Create New File in Linux

cat Command

Creates a new file and lets you key in the needed text. Save the file content by pressing Ctrl + c on your keyboard.

$ cat > file
Create File and Key in Text
Create File and Key in Text

Open an existing file content in read-only mode.

$ cat file

rm Command

Delete a file.

$ rm new.txt
$ ls
Delete File in Linux
Delete File in Linux

Deletes a directory with files and other sub-directories

$ rm -r new
Delete Directory in Linux
Delete Directory in Linux

mv Command

Renames an existing file/directory.

$ mv file renamed_file
$ mv newer renamed_newer
Rename File in Linux
Rename File in Linux

cp Command

Copies an existing file/directory to a targeted location:

$ cp renamed_file backup
$ cp renamed_newer backup
$ ls -l backup
Copy Files in Linux
Copy Files in Linux

Linux File System Search Commands

find Command

Locate the instances of a file or directory name from the current working directory.

$ find backup
$ find * renamed_file
Find Files in Linux
Find Files in Linux

Linux Basic Administration Commands

whoami Command

Prints currently logged in system user.

$ whoami

dnyce

sudo Command

Enables the execution of root/sudoer-user-privileged commands.

$ sudo apt update

reboot Command

Restart your machine.

$ reboot

shutdown Command

Power off your machine.

$ shutdown

Linux File System Storage Commands

df Command

See used and available storage space on mounted partitions.

$ df
$ df -h
Check Linux Disk Space
Check Linux Disk Space

fdisk Command

Retrieve information on all active storage/partitions.

$ sudo fdisk -l 
Check Linux Disk Partitions
Check Linux Disk Partitions

du Command

Prints disk usage info of the current working directory.

$ du
Check Linux Disk Usage
Check Linux Disk Usage

mount Command

Mount an ISO file or storage device:

$ sudo mount file_to_mount target_mount_location
Linux Mount File in Linux
Linux Mount File in Linux

umount Command

Unmount a mounted ISO file or Storage device:

$ sudo umount mounted_location
Linux Unmount File in Linux
Linux Unmount File in Linux

Linux File Compression Commands

tar Command

Makes uncompressed tar archive.

$ tar cf name.tar target_directory
Create Tar Archive in Linux
Create Tar Archive in Linux

Makes a gzip-compressed tar archive.

$ tar cfz backup.tar backup

Extract a tar archive.

$ tar xf backup.tar

gzip Command

Makes gzip compression out of a file.

$ gzip renamed_file
Create Gzip Archive in Linux
Create Gzip Archive in Linux

gunzip Command

Decompresses a gzip compressed file.

$ gunzip renamed_file.gz

Linux Networking Commands

ip Command

Displays all active interface info like IP address.

$ ip a
Check Linux IP Address
Check Linux IP Address

Displays default gateway IP address.

$ ip r

ping Command

Test reachability of network device via its IP.

$ ping 192.168.100.3
Check Network Host
Check Network Host

ssh Command

Enables users to connect to remote machines via their IP.

$ ssh 192.168.100.3
Connect to Remote Linux
Connect to Remote Linux

Linux File Permission Commands

chmod Command

Changes file/directory permissions like read (r), write (w), and execute (x). A plus sign (+) grants permission, a minus sign (-) removes permission, an equal sign (=) grants and removes all others.

$ chmod +x script.sh
$ chmod -x script.sh
$ chmod =x script.sh
Change File Permissions in Linux
Change File Permissions in Linux

chown Command

Changes file/directory ownership.

$ chown root script.sh
Change File Ownership in Linux
Change File Ownership in Linux

chgrp Command

Change file/directory group ownership.

$ chgrp root script.sh
Change File Group Ownership in Linux
Change File Group Ownership in Linux

Linux User Management Commands

useradd Command

Create a new user account (low-level utility).

$ sudo useradd new_user

adduser Command

Create a user account (high-level utility).

$ sudo adduser new_user
Create New User in Linux
Create New User in Linux

deluser Command

Remove the user account.

$ sudo deluser new_user

usermod Command

Modify user account like login.

$ sudo usermod -i john_doe second_user
Modify User in Linux
Modify User in Linux

groupadd Command

Add user group.

$ sudo groupadd linuxshelltips

delgroup Command

Remove the user group.

$ sudo delgroup linuxshelltips

Linux Hardware Information Commands

lshw Command

Provides an informative display of all attached hardware components.

$ lshw
List Linux Hardware Information
List Linux Hardware Information

lsusb Command

Lists all plugged-in USB devices.

$ lsusb
List Linux USB Devices
List Linux USB Devices

dmidecode Command

Provides motherboard, chassis, BIOS, etc info.

$ sudo dmidecode
List Linux Motherboard Info
List Linux Motherboard Info

Other Useful Inbuilt Linux Commands

Command Description
echo "i am LinuxShellTips" Can display a line of text and even write text to a file.
grep -E --color 'Tips' my_file.txt Search for specific patterns within a file.
man grep Prints a complete user manual associated with the usage of a Linux command.
locate file_name Traces all files on the Linux system matching a specific name pattern.
less file_name Used to peruse through a large text file from the Linux terminal.
head file_name Will print the first 10 lines of a text file.
tail file_name Will print the last 10 lines of a text file.
exit Closes the terminal window.
history List commands executed currently logged in Linux user.
clear Clear all printouts on the Linux terminal screen.
kill -l Display available signals.
ps Display all running processes with their process Ids (PID).
kill PID Terminate a running process via its PID.
sleep Delays the execution of a Linux command by specifying a periodic value in seconds (s), minutes (m), or hours (h).
alias create a shortcut name for a command.

This inbuilt Linux commands cheat sheet article should pave way for you to categorically master the usage of the Linux terminal environment in the simplest way possible. Know of other cool inbuilt Linux commands to add to this cheat sheet? Feel free to leave a comment or feedback.

2 thoughts on “Linux: Bash Built-in Commands Cheat Sheet”

  1. You started off strong, but you ended your streak on the third command. You can check if a command is built-in with the “builtin” command. Built-ins run faster because bash is already loaded so the preference is always to run built-in commands. Most of your commands are just general-purpose Linux packages and not builtin.

    Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.