100% found this document useful (1 vote)
143 views

Linux Ubuntu Commands Cheat Sheet by Linuxsimply

The document provides a cheat sheet of common Linux commands for Ubuntu, including commands for system information, shell built-ins, system monitoring, system administration, file management, compression and archiving. It lists commands such as free, ps, uptime, uname, bash, top, sudo, ls, touch, diff, zip, tar.

Uploaded by

jaf42747
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
143 views

Linux Ubuntu Commands Cheat Sheet by Linuxsimply

The document provides a cheat sheet of common Linux commands for Ubuntu, including commands for system information, shell built-ins, system monitoring, system administration, file management, compression and archiving. It lists commands such as free, ps, uptime, uname, bash, top, sudo, ls, touch, diff, zip, tar.

Uploaded by

jaf42747
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Linux Cheat Sheet

Ubuntu Commands
System Information Shell Built-in Commands
Sets environment variables that are used by
Displays the amount of free and used
free export processes started by the shell that exported the
memory in the system
variable
Displays text on the screen or redirects it to a
ps Displays a snapshot of the current processes echo
file or variable
Displays detailed information about all Creates a shortcut or alternate name for a
ps aux alias
processes currently running command
Removes an alias previously created with the
uptime Displays the current uptime of the system unalias
"alias" command.
w Displays the list of currently logged-in users exit Closes the current shell or terminal session
uname Displays system information clear Clears the terminal screen
Enables users to interact with Linux Operating
uname -a Displays detailed system information bash
System
Declares variables and specifies their attributes,
hostname Displays the name of the current host declare
such as their data type or scope
Executes a script in the current shell
Provides access to the documentation of
info source environment rather than creating a new
various installed software packages
subshell to run the script
lshw Lists hardware configuration of the system System Monitoring
Displays a list of previously executed Displays information about the active processes
history top
commands running on the system
Displays information about built-in shell Shows a list of all the running processes
help htop
commands throughout the system
Shows detailed information about system
Displays the manual page for a specified
man vmstat performance, including memory usage, CPU
command
utilization, and Input/Output (I/O) statistics
Reports the file name of the terminal Displays the total amount of free and used
tty device that is currently used to interact free memory in the system, as well as the buffers
with the shell and cached memory used by the kernel

Displays information about the active processes


System Administration ps on the system, including their process ID (PID),
CPU usage, memory usage, and other details
Allows users to run programs with the
Displays how long the system has been running
sudo security privileges of another user, typically uptime
and the current system load averages
the root user
Measures the execution time of a command or
sudo -s Starts a shell with root privileges time
script
Displays the kernel ring buffer messages, which
sudo -s -u - Starts a shell with the privileges of the
dmesg include system boot messages and other kernel-
user specified user
related messages
sudo -k Invalidates the user's cached credentials
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
Displays information about a user, including
sudo visudo Opens the sudoers file for editing finger their login name, full name, home directory,
login shell, and the time they last logged in
sudo -H
nautilus
Opens the file browser with root privileges File Management and Manipulation
sudo
Restarts the GDM (GNOME Display Manager)
/etc/init.d/g ls Lists files in a directory
service
dm restart
sudo
Restarts the KDM (KDE Display Manager) Lists all files in a directory, including hidden
/etc/init.d/k ls -al
service files, with detailed information
dm restart
Lists files in a directory and all of its
passwd Allows users to change their password ls -R
subdirectories
shutdown Shuts down the system in a safe way ls -a Lists all files in a directory, including hidden files
Forces all file system changes to be written to Modifies timestamps of a file or creates an
sync touch
disk empty file if it doesn't exist
Compares two files line by line and shows the
reboot Reboots the system diff
differences between them
Installs one or more packages on a Linux
install
system using a package manager Compression and Archiving
Displays the status of the SELinux security Archives files and directories into a compressed
setstatus zip
system zip archive format
Controls system services, such as starting,
service unzip Extract the contents of a zip archive file
stopping, and restarting them
Compresses files using the Burrows-Wheeler
getent Retrieves entries from databases bzip2 block sorting text compression algorithm and
Huffman coding
Displays the current environment variables or Compresses files using the Lempel-Ziv
env gzip
sets a new environment variable algorithm and Huffman coding
Displays a list of jobs running in the Decompresses files that have been compressed
jobs gunzip
background of a shell using gzip
Permission Management tar Creates and manipulates archive files
Changes the permissions of file and
chmod determines who can read, write, or execute a Package Management
file
Changes the owner and/or group of a file or apt-get
chown Updates the list of available packages
directory update
apt-get Upgrades all installed packages to their latest
File and Directory Management upgrade version
apt-get dist- Upgrades all installed packages to their latest
mkdir Creates a new directory
upgrade version
apt-get
pwd Prints the current working directory Installs a package
install pkg
Changes the current working directory to a apt-get Completely removes a package, including its
cd
specified directory purge pkg configuration files
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
Changes the current working directory to the apt-get -f Attempts to fix any broken dependencies and
cd ..
parent directory of the current directory install install missing packages

Applies a patch file to an original file, making


patch dpkg -l Lists all installed packages
the changes specified in the patch file
dpkg - - Configures all packages that have been
rm [file] Removes a file
configure -a unpacked but not yet configured
dpkg -i
rm -r [dir] Removes a directory and its contents Installs a package from a .deb file
pkg.deb
rm -f [file] Forces the removal of a file snap Installs and manage applications on systems
Forces the removal of a directory and its apt-get Removes any packages that were installed as
rm -rf [dir]
contents autoremove dependencies and are no longer needed
Compares two files byte-by-byte and reports
cmp the first byte and line that differs between Disk Management
them
Compares two sorted files line by line and
Displays the disk usage statistics for the file
comm displays the lines that are common or unique df
system
to each file
Searches for files in a database that contains Displays the disk usage statistics for the file
locate df -h
a cached record of all files on the system system in human-readable format
Displays detailed information about a file,
stat including its size, permissions, owner, and du Estimates the file space usage
modification time
Allows users to create, delete, and modify
cp Copies files or directories fdisk partitions on hard drives, flash drives, and other
storage devices
Lists all open files and the processes that Securely deletes files by overwriting them
lsof shred
opened them multiple times with random data
Changes the group ownership of files and Copies and converts data between files,
chgrp dd
directories partitions, and devices at the block level
Determines the type of a file by examining its Mounts a file system, making it accessible at a
file mount
contents specified mount point in the directory tree

Creates a new file system on a specified device


fsck Checks and repairs a file system for errors mkfs and supports various file system types such as
ext2, ext3, ext4, NTFS, and FAT32
Creates a new ext2/ext3/ext4 file system on a
mv Moves or renames files or directories mke2fs
specified device
Network Management Text Processing
Displays and manipulates network interfaces Counts the number of lines, words, and
ip wc
and routing tables characters in a text file
Sends a packet to a host and measures the Sorts the lines of a text file in alphabetical or
ping sort
response time numerical order
Remotely logs into a server or other device
ssh nano Allows users to create and edit text files
over a network
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
Opens up a powerful text editor that supports
scp Transfers files between hosts on a network jed
multiple modes and macros
Opens up a powerful text editor that uses
User Management vi modal editing to allow for quick and efficient
editing
Creates a new user account, including setting
Merges lines from multiple files and writes
useradd up a home directory and assigning a paste
them to the standard output
password
Searches a text file for lines that match a
Creates a new user account interactively or
adduser egrep specified pattern using extended regular
using command-line options
expressions
Displays information about the users who are Extracts specific columns or fields from a text
who cut
currently logged in file
Displays the current username of the user Locates the binary, source, and manual page
whoami whereis
who is logged in files for a command
Dissplays the user and group IDs of a
id whatis Displays a brief description of a command
specified user or the current user
Modifies a user account, such as changing the
Displays the location of a command or script in
usermod user's login name, password, home directory, which
the system's PATH
or group membership
Displays a list of usernames of users who are Schedules a one-time command or script to run
users at
currently logged in at a specified time
Switches the current user to another user
Redirects the output of a command to a file and
su account, usually with elevated privileges, by tee
to the screen
prompting for the target user's password
Modifies the password expiry information for
chage date Displays the current date and time
a user
Opens up a more advanced version of the vi
Deletes a user account and all associated files
userdel vim editor with additional features such as syntax
and directories
highlighting and plugins
Splits a text file into smaller files based on the
addgroup Creates a new user group split
number of lines or bytes
A stream editor that performs editing
groupadd Creates a new user group sed
operations on a text stream or file
Modifies the properties of an existing user Translates or deletes characters in a text stream
groupmod tr
group or file
Network Configuration & Firewall
uniq Filters out duplicate lines from a sorted text file
Management
wget Downloads files from the internet cat Displays the contents of a file on the terminal
Displays the first ten lines of a file on the
ifconfig Shows network interface configuration head
terminal
Shows wireless network interface
iwconfig tail Displays the last ten lines of a file
configuration

Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
sudo iwlist Searches for a specific pattern or text in a file or
Scans for available wireless networks grep
scan output
sudo
systemctl
Displays the contents of a file one page at a
restart Restarts the networking service less
time, allowing scrolling back and forth
networking.s
ervice
Display the contents of a text file one screen at
a time allowing user to scroll up and down
ifup interface Brings up a network interface more
through the file, search for specific text, and
navigate to specific lines
ifdown
interface
Brings down a network interface Miscellaneous
Allows users to configure and manage the Lists information about all available or specified
firewall -cmd
firewall settings block devices and can also display the
lsblk
ufw enable Enables the firewall relationship between the different devices,
ufw disable Disables the firewall such as partitions and logical volumes
ufw default Enables or disables a service at startup or a
Sets the default policy to allow traffic enable
allow specific hardware device or driver
Command-line calculator that allows for
ufw default
Sets the default policy to deny traffic bc floating-point arithmetic and advanced
deny
mathematical functions
Automates tasks to run at specified times or
ufw status Shows the status of the firewall cron
intervals
ufw allow Schedules periodic commands or scripts to run
Opens a port crontab
port at specified intervals
ufw deny
Closes a port ncal Displays a calendar for a given month or year
port
ufw deny Displays system information and an ASCII art
Blocks traffic from a specific IP address neofetch
from ip logo of the operating system
Displays a directory tree structure in a
tree
hierarchical format
Ubuntu Terminal Shortcuts
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
Performs a history search for commands that match the
CTRL+R
user's input
CTRL+C Stop the active process
CTRL+ D Closes the current terminal
Sends the signal SIGSTOP to temporarily halt the active
CTRL+Z
process
Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
Ubuntu Terminal Shortcuts
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


Switches between the current cursor position and the start
CTRL+XX
line
CTRL+]+A Moves the cursor forward to next character of A

ALT+CTRL+]+A Backs the cursor to the preceding character of A

Prepared By: Lamisa Musharrat Copyright ©2023 linuxsimply.com| All rights reserved.

You might also like