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
Lists files and directories present in the current folder/directory:
To view more details like the owner, group, size, and relevant timestamps to the listed files and directories.
$ ls -l
You can also list the files of a specific file/directory.
$ ls -l bin
To view hidden files (if any) within a directory. Hidden files’ naming convention starts with a period e.g.
$ ls -a
The pwd (print working directory) commands points a user to the absolute path of the current working directory:
Effective in navigating to a different directory location by specifying its absolute path:
$ cd Apps $ cd /home/dnyce $ cd Documents $ cd ~ $ cd -
Reveals the type of file/directory existing on our Linux machine:
$ file bin $ file emm.jpg $ file passwd
Linux File Manipulation Commands
Creates a new non-existing directory:
$ mkdir new $ ls
Creates a new blank file.
$ touch new.txt $ ls -l new.txt
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
Open an existing file content in read-only mode.
$ cat file
Delete a file.
$ rm new.txt $ ls
Deletes a directory with files and other sub-directories
$ rm -r new
Renames an existing file/directory.
$ mv file renamed_file $ mv newer renamed_newer
Copies an existing file/directory to a targeted location:
$ cp renamed_file backup $ cp renamed_newer backup $ ls -l backup
Linux File System Search Commands
Locate the instances of a file or directory name from the current working directory.
$ find backup $ find * renamed_file
Linux Basic Administration Commands
Prints currently logged in system user.
$ whoami dnyce
Enables the execution of root/sudoer-user-privileged commands.
$ sudo apt update
Restart your machine.
Power off your machine.
Linux File System Storage Commands
See used and available storage space on mounted partitions.
$ df $ df -h
Retrieve information on all active storage/partitions.
$ sudo fdisk -l
Prints disk usage info of the current working directory.
Mount an ISO file or storage device:
$ sudo mount file_to_mount target_mount_location
Unmount a mounted ISO file or Storage device:
$ sudo umount mounted_location
Linux File Compression Commands
Makes uncompressed tar archive.
$ tar cf name.tar target_directory
Makes a gzip-compressed tar archive.
$ tar cfz backup.tar backup
Extract a tar archive.
$ tar xf backup.tar
Makes gzip compression out of a file.
$ gzip renamed_file
Decompresses a gzip compressed file.
$ gunzip renamed_file.gz
Linux Networking Commands
Displays all active interface info like IP address.
$ ip a
Displays default gateway IP address.
$ ip r
Test reachability of network device via its IP.
$ ping 192.168.100.3
Enables users to connect to remote machines via their IP.
$ ssh 192.168.100.3
Linux File Permission Commands
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
Changes file/directory ownership.
$ chown root script.sh
Change file/directory group ownership.
$ chgrp root script.sh
Linux User Management Commands
Create a new user account (low-level utility).
$ sudo useradd new_user
Create a user account (high-level utility).
$ sudo adduser new_user
Remove the user account.
$ sudo deluser new_user
Modify user account like login.
$ sudo usermod -i john_doe second_user
Add user group.
$ sudo groupadd linuxshelltips
Remove the user group.
$ sudo delgroup linuxshelltips
Linux Hardware Information Commands
Provides an informative display of all attached hardware components.
Lists all plugged-in USB devices.
Provides motherboard, chassis, BIOS, etc info.
$ sudo dmidecode
Other Useful Inbuilt Linux Commands
||Can display a line of text and even write text to a file.|
||Search for specific patterns within a file.|
||Prints a complete user manual associated with the usage of a Linux command.|
||Traces all files on the Linux system matching a specific name pattern.|
||Used to peruse through a large text file from the Linux terminal.|
||Will print the first 10 lines of a text file.|
||Will print the last 10 lines of a text file.|
||Closes the terminal window.|
||List commands executed currently logged in Linux user.|
||Clear all printouts on the Linux terminal screen.|
||Display available signals.|
||Display all running processes with their process Ids (PID).|
||Terminate a running process via its PID.|
||Delays the execution of a Linux command by specifying a periodic value in seconds (s), minutes (m), or hours (h).|
||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.