0% found this document useful (0 votes)
5 views2 pages

Linux Cheatsheet

this is the quick linux cheatseet to go around

Uploaded by

collab.zigz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Linux Cheatsheet

this is the quick linux cheatseet to go around

Uploaded by

collab.zigz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux Command Line Cheat Sheet

File System Navigation & Management


Command Example Output/Explanation
pwd pwd /home/user
ls ls file1.txt file2.txt dir1
ls -l ls -l -rw-r--r-- 1 user user 0 Sep 14 file1.txt
cd [dir] cd Documents Moves into Documents directory
mkdir [dir] mkdir test Creates 'test' directory
rmdir [dir] rmdir test Removes 'test' if empty
touch [file] touch new.txt Creates 'new.txt'
cp [src] [dest] cp file1.txt backup.txt Copies file1.txt to backup.txt
mv [src] [dest] mv file1.txt docs/ Moves file1.txt into docs/
rm [file] rm old.txt Deletes old.txt
rm -r [dir] rm -r temp Deletes directory 'temp' and contents

File Content Viewing & Manipulation


Command Example Output/Explanation
cat [file] cat file.txt Displays file contents
less [file] less bigfile.txt Opens file for page-by-page viewing
head [file] head file.txt Shows first 10 lines
tail [file] tail file.txt Shows last 10 lines
grep [pattern] [file] grep hello file.txt Finds lines with 'hello'
sort [file] sort names.txt Outputs sorted lines
wc [file] wc file.txt 5 20 120 file.txt

Permissions & Ownership


Command Example Output/Explanation
chmod u+x [file] chmod u+x script.sh Gives user execute permission
chmod 755 [file] chmod 755 script.sh User rwx, Group r-x, Others r-x
chown [user]:[group] [file] chown root:root file.txt Changes owner to root

System Info & Utilities


Command Example Output/Explanation
echo [text] echo Hello Hello
man [command] man ls Opens manual for 'ls'
history history Shows command history
clear clear Clears terminal screen
df -h df -h Filesystem Size Used Avail Use% Mounted on
ps aux ps aux Shows running processes
kill [PID] kill 1234 Terminates process with ID 1234

Input/Output Redirection & Pipes


Command Example Output/Explanation
> echo Hello > file.txt Writes 'Hello' into file.txt
>> echo World >> file.txt Appends 'World' into file.txt
< wc -l < file.txt Counts lines of file.txt
| ls | grep txt Filters list for .txt files

Hotkeys & Shortcuts


Command Example Output/Explanation
Ctrl+A Press Ctrl+A Move to beginning of line
Ctrl+E Press Ctrl+E Move to end of line
Ctrl+R Press Ctrl+R Search history
!! !! Repeats last command
!$ echo !$ Uses last argument of previous command

You might also like