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

Cyberkraft Linux Commands Cheat Sheet

Uploaded by

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

Cyberkraft Linux Commands Cheat Sheet

Uploaded by

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

Basic Linux Commands Cheat Sheet

https://cyberkrafttraining.com

Command Use Description


File Commands
ls List Lists the current directory and files
ls -R List sub directories Lists files in sub directories also
ls -a List hidden files Lists the current directory including hidden files
ls -al List details Includes details: file size, permissions, owner
Cd location Change directory Changes directory to a specified location
cd .. Move up one level Navigates to the parent directory
cd ~ or cd Home Navigates to the home directory
cd / Root directory Navigates to the root directory
touch filename Create file Creates a file with the designated filename
cat filename Display file contents Displays the content of the designated file
cat file1 file2 >
Combine files Combines two files (files 1 and 2) into one file (file 3)
file3
mv file "new file
Move file Moves a file to the designated file path
path"
mv filename
Move and rename file Moves a file and renames it
new_file_name
sudo Superuser do Execute any command with superuser privileges
rm filename Delete file Deletes the designated file

© 2023 Cyberkraft https://cyberkrafttraining.com


man Help Shows the help text for a command
history Command history Displays previously used commands
clear Clear terminal Clears all inputs from the terminal
mkdir
Make directory Creates a new directory
directoryname
Rmdir
Delete directory Deletes a directory
directoryname
mv Rename directory Renames a directory
pr -x Divide file Divides the file into x columns
lpr filename Print file Prints a file
lp -# filename Number of copies Prints multiple copies of a file
lp –P printername Specify printer Prints to a specific printer
Installs the specified file using the advanced
apt-get filename Install
packaging tool (APT)

Search Commands
locate file Search Searches the index for a specified file
grep pattern files Pattern search Searches for a specified pattern in designated files
grep -r Recursive search Searches the current directory and all subdirectories
grep -i Case insensitive search Finds files regardless of the case used to search
find /directory/
Find files in a directory Locates specified files in a specific directory
-name name

© 2023 Cyberkraft https://cyberkrafttraining.com


File Permission Commands
Lists current permissions r=read w=write x=execute
ls -l List permissions
-=no permissions
Changes ownership of the file or directory to the
Chown user Change owner
inputted user
Chown
Changes the user as well as the group for a file or
user:group Change owner and group
directory
filename

Networking Commands
SSH Perform remote login Secure Shell (SSH) is an encrypted means of
username@ip- using SSH remotely accessing a device
address or
hostname
put file File upload Uploads a file to a remote computer using SSH
get file File download Download a file from a remote computer using SSH
quit Logout Logs out of the SSH session
ping hostname or Ping a device Uses Internet Control Messaging Protocol (ICMP)
ping ipaddress pings to assess network connectivity
ip a List IP information Lists current internet protocol information such as
ipv4 and ipv6 address, ethernet adapter used, and
MAC addresses. Color coded for fun!
ifconfig List IP information Traditional way to list IP address information

© 2023 Cyberkraft https://cyberkrafttraining.com


Process Commands
bg Background Sends a current process to the background
fg Foreground Brings a background process to the foreground
top List processes List details on all active processes
ps Process status Lists the status of the current process including the
process identification (PID), which is a typically a
five digit number.
kill PID Kills a process Kills a process by targeting the PID
nice process Priority start Starts a process with priority
renice –n process Set priority Changes the priority level of an already running
process. Useful is running multiple applications.
df List free disk space Lists the amount of free disk space on your machine
free List RAM usage Shows the amount of RAM in-use and available

Visual Display Editor (VI) Editing Commands


i Insert Insert characters at the cursor’s location
a Insert after cursor Write characters after the cursor’s location
A Insert at end Inserts characters at the end of the line
ESC Exit inset mode Terminates insert mode
u Undo Undos the last change. Very useful!
U Undo all Undo all changes to the entire line
o Open new line Opens a new line and enters insert mode
dd Delete line Deletes an entire line

© 2023 Cyberkraft https://cyberkrafttraining.com


3dd Delete 3 lines Deletes the 3 previous lines
D Delete after cursor Delete contents of the line after the cursor
C Delete and insert Similar to D but also enters insert mode
dw Delete word Delete a word at the cursor’s location
4dw Delete 4 words Deletes four words. Why 4? Why not!
cw Change word Changes a word
x Delete character Deletes a character at the cursor
r Replace character Replaces a single character at the cursor
R Overwrite Overwrite characters from cursor onward
s Substitute character Substitutes one character under the cursor then
enters insert mode
S Substitute line Substitutes an entire line and begins to insert at the
beginning of the next line
~ Change case Changes the case of a single character

© 2023 Cyberkraft https://cyberkrafttraining.com

You might also like