0% found this document useful (0 votes)
7 views

Linux Ubuntu Commands Cheat Sheet by Linuxsimply

Uploaded by

manojrocks07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Linux Ubuntu Commands Cheat Sheet by Linuxsimply

Uploaded by

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

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 export processes started by the shell that exported the
free 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 command
processes currently running
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

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
history commands Displays information about the active processes
top running on the system
Displays information about built-in shell
help commands Shows a list of all the running processes
htop throughout the system
Shows detailed information about system
Displays the manual page for a specified vmstat performance, including memory usage, CPU
man
command
utilization, and Input/Output (I/O) statistics

Reports the file name of the Displays the total amount of free and used
tt terminal device that is currently free memory in the system, as well as the buffers
y used to interact with the shell and cached memory used by the kernel

Displays information about the active processes


System Administration on the system, including their process ID (PID), CPU usage

Allows users to run programs with the


Displays how long the system has been running
security privileges of another user, typically the root user
and the current system load averages

Measures the execution time of a command or


sudo -s Starts a shell with root privileges
script
sudo -s -u -Starts a shell with the privileges of the Displays the kernel ring buffer messages, which
userspecified user dmesg include system boot messages and other kernel-
related messages
sudo -k Invalidates the user's cached credentials
Prepared By: Copyright ©2023 linuxsimply.com| All rights reserved.
Linux Cheat Sheet
Ubuntu Commands
Displays information about a user, including
sudo visudoOpens the sudoers file for editing their login name, full name, home directory, login shell, a

sudo -H
Opens the file browser with root privileges File Management and Manipulation
nautilus
sudoRestarts the GDM (GNOME Display Manager)
/etc/init.d/gservice ls Lists files in a directory
dm restart
sudo Lists files in a directory and all of its
Restarts the KDM (KDE Display Manager) ls -R subdirectories
Lists all files in a directory, including hidden
/etc/init.d/k ls -al
service files, with detailed information
dm restart
Allows users to change their password
shutdown Shuts down the system in a safe way
ls -aLists all files in a directory, including hidden files
Modifies timestamps of a file or creates an
touch empty file if it doesn't exist
reboot Forces
Rebootsallthe
filesystem
system changes to be written to
disk
Compares two files line by line and shows the
differences between them

setstatus
Installs
Displaysone
theor moreofpackages
status on asecurity
the SELinux
system using a package manager
Linux Compression
zip and Archiving
Archives files and directories into a compressed
zip archive format
system
Controls system services, such as starting,
Extract the contents of a zip archive file
stopping, and restarting them
Compresses files using the Burrows-Wheeler
Retrieves entries from databases block sorting text compression algorithm and Huffman

Displays the current environment variables or Compresses files using the Lempel-Ziv
sets a new environment variable algorithm and Huffman coding
Displays a list of jobs running in the Decompresses files that have been compressed
jobs background of a shell gunzip using gzip
Permission Management tar Creates and manipulates archive files
Changes the permissions of file and
determines who can read, write, or execute a file Package Management
Changes the owner and/or group of a file or apt-get
chown directory Updates the list of available packages
update
File and Directory Management apt-get
upgrade
Upgrades all installed packages to their latest
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 purge pkg configuration files
specified directory

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


Linux Cheat Sheet
Ubuntu Commands
Changes the current working directory to theapt-get -fAttempts to fix any broken dependencies and
cd ..
parent directory of the current directoryinstallinstall missing packages

Applies a patch file to an original file, making


patch the changes specified in the patch file Lists all installed packages

dpkg - - Configures all packages that have been


rm [file] Removes a file configure -a unpacked but not yet configured
rm -r [dir] Removes a directory and its contents dpkg -i
Installs a package from a .deb file
pkg.deb

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


rm -f [file] Forces the removal of a file
snap Installs and manage applications on systems
Forces the removal of a directory and its
rm -rf [dir] contents apt-get Removes any packages that were installed as
autoremove dependencies and are no longer needed
Compares two files byte-by-byte and reports Disk Management
the first byte and line that differs between them
Compares two sorted files line by line and
comm displays the lines that are common or unique Displays the disk usage statistics for the file
to each file system
Displays the disk usage statistics for the file
Searches for files in a database that contains df -h system in human-readable format
a cached record of all files on the system
Displays detailed information about a file,
stat including its size, permissions, owner, and
modification time Estimates the file space usage
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 opened them multiple times with random data
Changes the group ownership of files and Copies and converts data between files,
dd partitions, and devices at the block level
directories
Determines the type of a file by examining its Mounts a file system, making it accessible at a
file contents specified mount point in the directory tree

Creates a new file system on a specified device


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


Moves or renames files or directories
specified device
Network Management Text Processing
Displays and manipulates network interfaces Counts the number of lines, words, and
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 response time sort numerical order
Remotely logs into a server or other device
ssh over a network nano Allows users to create and edit text files

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


Linux Cheat Sheet
Ubuntu Commands
scp Transfers files between hosts on a network Opens up a powerful text editor that supports
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
useradd up a home directory and assigning a Merges lines from multiple files and writes
paste them to the standard output
password
Searches a text file for lines that match a
Creates a new user account interactively or egrep specified pattern using extended regular
adduser using command-line options
expressions
Displays information about the users who are Extracts specific columns or fields from a text
who currently logged in cut file
Displays the current username of the user Locates the binary, source, and manual page
whoami who is logged in whereis files for a command
Dissplays the user and group IDs of a whatis Displays a brief description of a command
id specified user or the current user
Modifies a user account, such as changing the
usermod user's login name, password, home directory, which Displays the location of a command or script in
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 currently logged in at at a specified time

Switches the current user to another user


su account, usually with elevated privileges, by Redirects the output of a command to a file and
tee to the screen
prompting for the target user's password

Modifies the password expiry information for date Displays the current date and time
chage a user
Opens up a more advanced version of the vi
Deletes a user account and all associated files vim editor with additional features such as syntax
userdel and directories
highlighting and plugins
addgroup Creates a new user group Splits a text file into smaller files based on the
split number of lines or bytes

groupadd Creates a new user group A stream editor that performs editing
sed operations on a text stream or file
Modifies the properties of an existing user Translates or deletes characters in a text stream
groupmod group tr 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

ifconfig Shows network interface configuration Displays the first ten lines of a file on the
head terminal
Shows wireless network interface tail Displays the last ten lines of a file
iwconfig 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 output
scan
sudo
systemctl Displays the contents of a file one page at a
restart Restarts the networking service time, allowing scrolling back and forth
networking.s
ervice
Display the contents of a text file one screen at
ifup interface Brings up a network interface a time allowing user to scroll up and down
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
ufw enable Enables the firewall lsblk
relationship between the different devices,
ufw disable Disables the firewall such as partitions and logical volumes
ufw default
Sets the default policy to allow traffic Enables or disables a service at startup or a
allow enable specific hardware device or driver
ufw default Command-line calculator that allows for
Sets the default policy to deny traffic floating-point arithmetic and advanced mathematical fun
deny
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
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
from ip logo of the operating system
Displays a directory tree structure in a
tree
hierarchical format

Ubuntu Terminal Shortcuts


CTRL+A Places terminal
Opens the cursor
in at the start of the active line
Ubuntu
CTRL+ALT+T
CTRL+E
Places the cursor at the end of the active line.

CTRL+U Removes the entire active line


CTRL+W
CTRL+K Removes
Removesthe
theword preceding
command fromthethecursor
cursor to the right
Performs a history search for commands that match
CTRL+R
the user's input

CTRL+C Stop the active process

CTRL+
Closes Dthe current terminal

CTRL+Z Sends the signal SIGSTOP to temporarily halt the active


p rocess
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

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


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

You might also like