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

Basic Linux Commands Cheat Sheet

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

Basic Linux Commands Cheat Sheet

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

Linux Cheat Sheet

Basic Commands

File and Directory Management File Manipulation


cp Copies files and directories touch Creates an empty file/modify timestamp
pwd Prints the current working directory cat Concatenates and prints file contents
Displays the contents of a file along with line
cd Changes current directory cat -n
numbers
Concatenates and prints file contents in reverse
cd.. Changes to the parent directory tac
order
cd - Changes to the previous directory less Shows contents in a scrollable manner
cd ~ Changes to the home directory head Displays the first ten lines of a file
ls Lists contents of the current directory tail Displays the last ten lines of a file
Lists the files and directories in the
ls -l grep Searches for a specified pattern in one or more files
current working directory in long format

Lists all files and directories including the


ls -a nano Edits and creates files
hidden ones

ls -r Lists files/directories in reverse diff Compares two text files


mkdir Creates a new directory sort Sorts lines of a text file
rmdir Removes an empty directory sort -r Sorts file reversely
mv Moves or renames a file /directory sort -u Removes duplicates and sorts unique values
rm Removes a file/directory
Prompts system confirmation before
rm -i
deleting
Control System
rm -r Deletes a file/directory recursively poweroff Shuts down the system
rm -d Deletes empty folders reboot Restarts the system
shutdown Shuts down or reboot the system
Permissions
Modifies a file or directory’s read, write,
chmod
and execute permissions
System and Process Management
Changes the ownership of a file,
Allows a user to run a command with the privileges
chown directory, or symbolic link to a specified sudo
of another user
username
Changes the group ownership of a file or
chgrp ps Lists the running processes on a system
directory
kill Terminates running processes on a system
Package Installation killall Terminates all processes with a specified name
apt install Installs software packages from the Displays the amount of disk space used and
df
[package] Ubuntu package repository available on a file system

Performs package management tasks


apt get such as installing, upgrading, and du Estimates file space usage
removing packages

Prepared By: Lamisa Musharrat Copyright ©2023 www.linuxsimply.com| All rights reserved.
Visit Profile: https://linuxsimply.com/lamisa-musharrat/ Basic Linux Commands Cheat Sheet Web View
Linux Cheat Sheet
Basic Commands

File Compression Miscellaneous


Creates, views, and extracts files from an Displays a line of text or a variable value on the
tar echo
archive file command line
Creates, views, and extracts files from a
zip clear Clears the terminal window
compressed archive file
Extracts files from a compressed archive Counts the number of lines, words, and characters
unzip wc
file in the ZIP format in a file
Compresses files or directories to reduce Displays the system’s process real-time process
gzip htop
their size activity
Compresses files or directories to reduce Checks the connectivity between two network
bzip2 ping
their size devices
vim Texts editor for editing text files
Search exit Exits the current shell session
Searches for a specified pattern or
grep ‘pattern’ Securely deletes the files by overwriting multiple
regular expression in one or more files shred
files times
and display the matching lines
Searches for a specified pattern or
grep -r regular expression recursively in a Displays information about the currently logged-in
w
pattern dir directory and its subdirectories, and users and their activities
display the matching lines
Locates files and directories on the
locate ps Displays the running processes
system
Locates files and directories on the
find whatis Displays a brief description of a command
system
find -empty Searches for empty files wget Downloads files from the internet

User Management System Information


Displays a list of previously executed commands in
useradd Create a new user account history
the terminal
userdel Delete a user account cal or ncal Displays the calendar of the current month

passwd Change a user's password who Displays information about currently logged-in user
Displays the user name of the current user logged
groupadd Add a new group to the system whoami
in
groupdel Delete an existing group from the uname Displays information about the current system and
Display the user and group IDs
Id hostname Displays or set the hostname of the current system
associated with the current user
Queries or modifies the hostname and related
su Switch to another user account hostnamectl
settings of the current system
Help Documentation date Displays and sets system date and time
Displays the manual page of a command Clears the history list of previously executed
man history -c
or utility commands
Shows information about both total and available
df
space on a file system

Prepared By: Lamisa Musharrat Copyright ©2023 www.linuxsimply.com| All rights reserved.
Visit Profile: https://linuxsimply.com/lamisa-musharrat/ Basic Linux Commands Cheat Sheet Web View

You might also like