Ubuntu is a popular open-source operating system used by developers globally. As with any operating system, there are plenty of commands that users must be familiar with in order to interact with the system effectively. Users can use Ubuntu commands to perform complex tasks with a few simple commands, saving time and increasing productivity. So, a Linux Ubuntu Commands Cheat Sheet is a valuable resource that can aid in the process of mastering the Linux terminal. In this article, I will introduce the Linux Ubuntu commands cheat sheet, which is available in multiple formats for free download.
Download Linux Ubuntu Commands Cheat Sheet
What Are Ubuntu Commands in Linux?
Ubuntu commands are based on the Bash shell, a command-line interpreter that allows users to interact with the operating system via a text-based interface called the terminal. The commands are typed into the terminal window.
Ubuntu is a prominent open-source, free operating system built on the Linux platform. In Ubuntu, a command is a set of instructions issued to the operating system through the terminal or command line interface (CLI).
Furthermore, these commands can navigate the file system, manage software packages, change system settings, run programs, and perform many other tasks that can be performed using a Graphical User Interface (GUI). But using these commands gives users advantages over GUI, such as automation, speed, etc.
Linux Ubuntu Commands Cheat Sheet
Here is a list of some of the most crucial Ubuntu commands that every user should be familiar with. These commands will assist you in navigating the system, managing files and directories, installing and updating software, and performing a variety of other tasks, whether you are a novice or an experienced user. Also, the same list will be provided on the Linux Ubuntu commands cheat sheet that you can download for free in multiple formats.
System Information Commands in Ubuntu
System information commands in Ubuntu enable users to retrieve important information about their system such as user information, CPU usage etc.
In this section, I have listed System administration commands that you can use to monitor system performance, install and update software, and other administrative tasks. In this section, I’ve listed the commands you’ll need to change access permissions and perform other system administration tasks. This category contains commands that allow users to monitor system performance and provide real-time information on system resource usage and process activity. The shell directly executes some commands. Here, you can find these commands without the use of an external program. You can use these commands to manage and manipulate files and directories, such as copying, removing, searching, and navigating through them. You’ll find commands in this category that allow users to manage and manipulate files and directories, such as creating, listing and comparing files and directories, making it simple to organize and work with files on your Linux system. This category contains commands that enable users to compress, decompress, and archive files. These commands allow users to manage software packages by installing, removing, updating, and searching for packages. In this category, you’ll find commands for configuring and managing network interfaces and firewall rules in the Linux operating system. These commands allow users to manage network connections, display network information, and troubleshoot network issues. You can use user management commands to manage user accounts and permissions, such as creating, modifying, and deleting user accounts, managing user groups, and setting permissions on files and directories, all of which contribute to the security and accessibility of the system. In this section, you’ll find commands for displaying disk usage, as well as creating, resizing, and formatting disk partitions, as well as mounting and unmounting file systems, to help you optimize storage usage and maintain the health of your Linux system’s storage. In this section, I’ve listed commands for editing, searching, sorting, and transforming text to help you work with large text files and automate text processing tasks. This section contains commands that provide additional functionality and utility, such as task scheduling, time and calendar display, and so on. In this section, you will find some keyboard shortcuts for Ubuntu. Using these shortcuts can help you save time on your tasks. In summary, I attempted to include all commonly used and essential Ubuntu commands and shortcut keys in this article. Moreover, the Linux Ubuntu commands cheat sheet contains a comprehensive list of essential commands to help users navigate the Linux terminal and perform various tasks more efficiently. By referring to the Linux Ubuntu commands cheat sheet, users can save time and avoid errors caused by incorrect command usage. I hope you found this article useful. Please leave a comment if you have any questions or suggestions.Commands
Description
free
Displays the amount of free and used memory in the system
ps
Displays a snapshot of the current processes
ps aux
Displays detailed information about all processes currently running
uptime
Displays the current uptime of the system
w
Displays the list of currently logged-in users
uname
Displays system information
uname -a
Displays detailed system information
hostname
Displays the name of the current host
info
Provides access to the documentation of various installed software packages
lshw
Lists hardware configuration of the system
history
Displays a list of previously executed commands
help
Displays information about built-in shell commands
man
Displays the manual page for a specified command
tty
Reports the file name of the terminal device that is currently used to interact with the shell
System Administration Commands in Ubuntu
Commands
Description
sudo
Allows users to run programs with the security privileges of another user, typically the root user
sudo -s
Starts a shell with root privileges
sudo -s -u -user
Starts a shell with the privileges of the specified user
sudo -k
Invalidates the user’s cached credentials
sudo visudo
Opens the sudoers file for editing
sudo -H nautilus
Opens the file browser with root privileges
sudo /etc/init.d/gdm restart
Restarts the GDM (GNOME Display Manager) service
sudo /etc/init.d/kdm restart
Restarts the KDM (KDE Display Manager) service
passwd
Allows users to change their password
shutdown
Shuts down the system in a safe way
sync
Forces all file system changes to be written to disk
reboot
Reboots the system
install
Installs one or more packages on a Linux system using a package manager
setstatus
Displays the status of the SELinux security system
service
Controls system services, such as starting, stopping, and restarting them
getent
Retrieves entries from databases
env
Displays the current environment variables or sets a new environment variable
jobs
Displays a list of jobs running in the background of a shell
Permission Management Commands
Commands
Description
chmod
Changes the permissions of a file or directory and determines who can read, write, or execute a file
chown
Changes the owner and/or group of a file or directory
System Monitoring Commands
Commands
Description
top
Displays information about the active processes running on the system
htop
Shows a list of all the running processes throughout the system
vmstat
Shows detailed information about system performance, including memory usage, CPU utilization, and Input/Output (I/O) statistics
free
Displays the total amount of free and used memory in the system, as well as the buffers and cached memory used by the kernel
ps
Displays information about the active processes on the system, including their process ID (PID), CPU usage, memory usage, and other details
uptime
Displays how long the system has been running and the current system load averages
time
Measures the execution time of a command or script
dmesg
Displays the kernel ring buffer messages, which include system boot messages and other kernel-related messages
finger
Displays information about a user, including their login name, full name, home directory, login shell, and the time they last logged in
Shell Built-in Ubuntu Commands
Commands
Description
export
Sets environment variables that are used by processes started by the shell that exported the variable
echo
Displays text on the screen or redirects it to a file or variable
alias
Creates a shortcut or alternate name for a command
unalias
Removes an alias previously created with the “alias” command.
exit
Closes the current shell or terminal session
clear
Clears the terminal screen
bash
Enables users to interact with Linux Operating System
declare
Declares variables and specifies their attributes, such as their data type or scope
source
Executes a script in the current shell environment rather than creating a new subshell to run the script
File and Directory Management Commands
Commands
Description
mkdir
Creates a new directory
cd
Changes the current working directory to a specified directory
cd ..
Changes the current working directory to the parent directory of the current directory
pwd
Prints the current working directory
rm [file]
Removes a file
rm -r [dir]
Removes a directory and its contents
rm -f [file]
Forces the removal of a file
rm -rf [dir]
Forces the removal of a directory and its contents
mv
Moves or renames files or directories
cp
Copies files or directories
locate
Searches for files in a database that contains a cached record of all files on the system
cmp
Compares two files byte-by-byte and reports the first byte and line that differs between them
comm
Compares two sorted files line by line and displays the lines that are common or unique to each file
lsof
Lists all open files and the processes that opened them
chgrp
Changes the group ownership of files and directories
file
Determines the type of a file by examining its contents
fsck
Checks and repairs a file system for errors
patch
Applies a patch file to an original file, making the changes specified in the patch file
stat
Displays detailed information about a file, including its size, permissions, owner, and modification time
File Management and Manipulation Commands
Commands
Description
ls
Lists files in a directory
ls -al
Lists all files in a directory, including hidden files, with detailed information.
ls -R
Lists files in a directory and all of its subdirectories
ls -a
Lists all files in a directory, including hidden files
touch
Modifies timestamps of a file or creates an empty file if it doesn’t exist
diff
Compares two files line by line and shows the differences between them
Compression and Archiving Commands
Commands
Description
zip
Archives files and directories into a compressed zip archive format
unzip
Extract the contents of a zip archive file
bzip2
Compresses files using the Burrows-Wheeler block sorting text compression algorithm and Huffman coding
gzip
Compresses files using the Lempel-Ziv algorithm and Huffman coding
gunzip
Decompresses files that have been compressed using gzip
tar
Creates and manipulates archive files
Package Management Commands in Ubuntu
Commands
Description
apt-get update
Updates the list of available packages
apt-get upgrade
Upgrades all installed packages to their latest version
apt-get dist-upgrade
Upgrades all installed packages to their latest version
apt-get install pkg
Installs a package
apt-get purge pkg
Completely removes a package, including its configuration files
apt-get autoremove
Removes any packages that were installed as dependencies and are no longer needed
apt-get -f install
Attempts to fix any broken dependencies and install missing packages
dpkg -l
Lists all installed packages
dpkg – -configure -a
Configures all packages that have been unpacked but not yet configured
dpkg -i pkg.deb
Installs a package from a .deb file
snap
Installs and manage applications on systems
Network Configuration and Firewall Management Commands
Commands
Description
wget
Downloads files from the internet
ifconfig
Shows network interface configuration
iwconfig
Shows wireless network interface configuration
sudo iwlist scan
Scans for available wireless networks
sudo systemctl restart networking.service
Restarts the networking service
ifup interface
Brings up a network interface
ifdown interface
Brings down a network interface
firewall -cmd
Allows users to configure and manage the firewall settings
ufw enable
Enables the firewall
ufw disable
Disables the firewall
ufw default allow
Sets the default policy to allow traffic
ufw default deny
Sets the default policy to deny traffic
ufw status
Shows the status of the firewall
ufw allow port
Opens a port
ufw deny port
Closes a port
ufw deny from ip
Blocks traffic from a specific IP address
Network Management Commands
Commands
Description
ip
Displays and manipulates network interfaces and routing tables
ping
Sends a packet to a host and measures the response time
ssh
Remotely logs into a server or other device over a network
scp
Transfers files between hosts on a network
User Management Ubuntu Commands
Commands
Description
useradd
Creates a new user account, including setting up a home directory and assigning a password
adduser
Creates a new user account interactively or using command-line options
who
Displays information about the users who are currently logged in
whoami
Displays the current username of the user who is logged in
id
Displays the user and group IDs of a specified user or the current user
usermod
Modifies a user account, such as changing the user’s login name, password, home directory, or group membership
users
Displays a list of usernames of users who are currently logged in
su
Switches the current user to another user account, usually with elevated privileges, by prompting for the target user’s password
chage
Modifies the password expiry information for a user
userdel
Deletes a user account and all associated files and directories
addgroup
Creates a new user group
groupadd
Creates a new user group
groupmod
Modifies the properties of an existing user group
Disk Management Commands
Commands
Description
df
Displays the disk usage statistics for the file system
df -h
Displays the disk usage statistics for the file system in human-readable format
du
Estimates the file space usage
fdisk
Allows users to create, delete, and modify partitions on hard drives, flash drives, and other storage devices
shred
Securely deletes files by overwriting them multiple times with random data
dd
Copies and converts data between files, partitions, and devices at the block level
mount
Mounts a file system, making it accessible at a specified mount point in the directory tree
mke2fs
Creates a new ext2/ext3/ext4 file system on a specified device
mkfs
Creates a new file system on a specified device and supports various file system types such as ext2, ext3, ext4, NTFS, and FAT32
Text Processing Ubuntu Commands
Commands
Description
wc
Counts the number of lines, words, and characters in a text file
sort
Sorts the lines of a text file in alphabetical or numerical order
nano
Allows users to create and edit text files
cut
Extracts specific columns or fields from a text file
jed
Opens up a powerful text editor that supports multiple modes and macros
vi
Opens up a powerful text editor that uses modal editing to allow for quick and efficient editing
vim
Opens up a more advanced version of the vi editor with additional features such as syntax highlighting and plugins
paste
Merges lines from multiple files and writes them to the standard output
egrep
Searches a text file for lines that match a specified pattern using extended regular expressions
split
Splits a text file into smaller files based on the number of lines or bytes
sed
A stream editor that performs editing operations on a text stream or file
tr
Translates or deletes characters in a text stream or file
uniq
Filters out duplicate lines from a sorted text file
cat
Displays the contents of a file on the terminal
head
Displays the first ten lines of a file on the terminal
tail
Displays the last ten lines of a file
grep
Searches for a specific pattern or text in a file or output
less
Displays the contents of a file one page at a time, allowing scrolling back and forth.
more
Display the contents of a text file one screen at a time allowing user to scroll up and down through the file, search for specific text, and navigate to specific lines
Miscellaneous Commands
Commands
Description
lsblk
Lists information about all available or specified block devices and can also display the relationship between the different devices, such as partitions and logical volumes
enable
Enables or disables a service at startup or a specific hardware device or driver
bc
Command-line calculator that allows for floating-point arithmetic and advanced mathematical functions
cron
Automates tasks to run at specified times or intervals
crontab
Schedules periodic commands or scripts to run at specified intervals
ncal
Displays a calendar for a given month or year
neofetch
Displays system information and an ASCII art logo of the operating system
tree
Displays a directory tree structure in a hierarchical forma
whereis
Locates the binary, source, and manual page files for a command
whatis
Displays a brief description of a command
which
Displays the location of a command or script in the system’s PATH
at
Schedules a one-time command or script to run at a specified time
tee
Redirects the output of a command to a file and to the screen
date
Displays the current date and time
Ubuntu Terminal Shortcuts
Commands
Description
CTRL+ALT+T
Opens terminal in Ubuntu
CTRL+A
Places the cursor at the start of the active line
CTRL+E
Places the cursor at the end of the active line.
CTRL+U
Removes the entire active line
CTRL+K
Removes the command from the cursor to the right
CTRL+W
Removes the word preceding the cursor.
CTRL+R
Performs a history search for commands that match the user’s input
CTRL+C
Stop the active process
CTRL+ D
Closes the current terminal
CTRL+Z
Sends the signal SIGSTOP to temporarily halt the active process
CTRL+L
Clears terminal display
CTRL+Q
Resumes suspended commands
CTRL+S
Halts command output to the screen
CTRL+Z
Halts the current command and places it in the background
CTRL+G
Exits the history search mode.
CTRL+J
Completes the history search at the current command line.
CTRL+O
Executes the command found in the reverse search.
CTRL+N / Down Arrow
Displays the following command line
CTRL+P / Up Arrow
Displays the preceding command line
CTRL+ _
Undo the last action
ALT+F
Goes forward one word
ALT+B
Goes back one word
ALT+P
Searches the history forward from the current line
CTRL+SHIFT+T
Opens a new tab on the currently active terminal.
CTRL+SHIFT+W
Closes the active tab
CTRL+SHIFT+C
Copies the highlighted characters to the clipboard
CTRL+SHIFT+V or SHIFT+INSERT
Pastes contents of the clipboard to the active line
Up/Down Arrow keys
Allows to quickly execute previous commands multiple times
TAB
Completes the typing command
CTRL+B / Left Arrow
Moves cursor position one character backward
CTRL+F / Right Arrow
Moves cursor position one character forward
CTRL+XX
Switches between the current cursor position and the start line
CTRL+]+A
Moves the cursor forward to next character of A
ALT+CTRL+]+A
Backs the cursor to the preceding character of A
Conclusion