Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
672 views

Essential Linux Commands

This document provides a cheat sheet of common Linux commands for navigating directories, managing files and disks, copying, moving, deleting and compressing files, viewing file contents, managing users and passwords, checking network connectivity, and keyboard shortcuts. It lists commands for directory navigation, file management, disk usage, file commands, networking, systems, users, and keyboard shortcuts along with brief descriptions of what each command does.

Uploaded by

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

Essential Linux Commands

This document provides a cheat sheet of common Linux commands for navigating directories, managing files and disks, copying, moving, deleting and compressing files, viewing file contents, managing users and passwords, checking network connectivity, and keyboard shortcuts. It lists commands for directory navigation, file management, disk usage, file commands, networking, systems, users, and keyboard shortcuts along with brief descriptions of what each command does.

Uploaded by

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

Three. Two.

Online

Linux
Commands
Cheat Sheet

</>
Linux Commands Cheat Sheet 1

Directory
cd cd.. cd- pwd rmdir
navigate through files move one move to your show the directory delete a directory
and directories directory up previous directory currently working in and its contents

mkdir [directory] scp [file_name.txt] [server/tmp]


create a new directory securely copy a specific file to a server directory

rsync -a [/your/directory] [/backup/]


synchronize the contents of a specific directory with a backup directory

Disk Usage
df du fdisk -l du -ah
get a report on the system’s check the disk space show disk partitions, show disk usage for
disk space usage usage of a file or directory sizes, and types all files and directory

du -sh findmnt
show disk usage of show target mount point
the current directory for all filesystems

File Commands
ls ls -R ls -a ls -al
list files in list all files in list all hidden files list all files and directories with detailed
a directory the sub-directories information like permissions, size, owner, etc

cat cat > filename diff tar


list the contents of a creates a new file compare the contents archive multiple files into
file on standard output of two files line by line a common Linux file format

cat filename 1 filename2>filename3 tar xf [compressed_file. tar]


joins two files (1 and 2) and stores the output extract archived file
in a new file (3)

cat filename | tr a-z A-Z >output.txt tar czf [compressed_file.tar.gz


convert a file to upper or lower case create a gzip-compressed tar file

tar cf [compressed_file. tar] [file_name] gzip [file_name]


create an archived file from a file compress a file with the .gz extension

chmod chown rm [file_name]


change the read, write, and execute change or transfer file ownership remove a file
permissions of files and directories
Linux Commands Cheat Sheet 2

File Commands
rm -r [directory_name] rm -rf [directory_name] wc
remove a directory recursively remove a directory recursively without print the number of words,
requiring confirmation lines, and bytes in a file

cp cp [file_name1] [file_name2] wget


copy files from the current copy the contents of the first file to download files from
directory to a different directory the second file the internet

cp -r [directory_name1] [directory_name2] mv
recursively copy the contents of the first directory into the second directory to move or rename files

mv [file_name1] [file_name2] ln -s /path/to/[file_name] [link_name]


rename file_name1 to file_name2 create a symbolic link to a file

touch [file_name] more [file_name] head [file_name]


create a new file show the contents of a file show the first 10 lines of a file

tail [file_name] gpg -c [file_name] gpg [file_name.gpg]


show the last 10 lines of a file encrypt a file decrypt a file

sudo locate find jobs


perform tasks that need to search for a file to locate files within display current jobs
administrative or root permissions or directory a directory

kill history uname man


terminate an review the commands print information about show manual instructions
unresponsive program you entered before your Linux system of Linux commands

zip unzip top ps


compress files into extract zipped files monitor system show a snapshot
a zip archive from a zip archive resource usage of active processes

echo hostname ping


move data into a file know the name of check connectivity
your host/network to a server

Network
ip addr show ifconfig netstat -pnltu netstat -nutlp
show IP addresses and show IP addresses of show active ports show more information
network interfaces all network interfaces about a domain

whois [domain] dig [domain] host [domain]


show more information show DNS information do an IP lookup for
about a domain about a domain a domain
Linux Commands Cheat Sheet 3

System User
uname -r last reboot id passwd
show system show system show details add a password to
information reboot history of the user a user’s account

timedatectl date useradd last


query and change show current create a new user show last logins
the system clock time and date

userdel [user_name]
hostname -i uptime remove a user
show the IP address show how long the system
of the system has been running, including
load average

Keyboard Shortcuts
Ctrl + E Ctrl + A Ctrl + C Ctrl + W
move to the end move to the beginning stop and terminate cut one word before the cursor
of the line of the line the current command and add it to the clipboard

TAB Ctrl + Q Ctrl + Z Ctrl + S


autofill typing unfreeze the terminal pause the command freeze the terminal

Ctrl + U Ctrl + K Ctrl + Y


cut part of the line before the cursor cut part of the line after the cursor paste from clipboard
and add it to the clipboard and add it to the clipboard

Ctrl + R Ctrl + G Ctrl + O


recall the last command that exit command history without run the previously
matches the provided characters running a command recalled command

!! exit
repeat the last command log out of the current session

Start your own website with unlimited hosting.


Use HostingerTutorials Discount Code and
Get Up to 83% OFF for any web hosting plan.

Use It Today

You might also like