Basic Linux commands

Contents
The basic Linux commands for beginners, including file management, system information, and process control.
Linux is a powerful and versatile operating system widely used in servers, development environments, and cloud systems. Whether you’re a beginner or looking to refresh your skills, mastering basic Linux commands is essential for navigating the file system, managing processes, checking system information, and handling networks or files efficiently. This cheat sheet provides a quick reference to commonly used Linux commands, organized by category for easy access.
FILES & NAVIGATING
ls
– directory listingls -l
– formatted listingls -la
– formatted listing including hidden filescd dir
– change directory to dircd ..
– change to parent directorycd ./dir
– change to dir in parent directorycd ~
– change to home directorypwd
– show current directorymkdir dir
– create a directoryrm file
– delete filerm -f dir
– force remove filerm -rf dir
– delete directory dirrm -r dir
– remove directory dirrm -rf /
– launch some nuclear bombs targeting your systemcp file1 file2
– copy file1 to file2mv file1 file2
– rename file1 to file2mv file1 dir/file2
– move file1 to dir as file2touch file
– create or update filecat file
– output contents of filecat > file
– write standard input into filecat >> file
– append standard input into filetail -f file
– output contents of file as it grows
SYSTEM INFO
date
– show current date/timeuptime
– show uptimewhoami
– who you’re logged in asw
– display who is onlinecat /proc/cpuinfo
– display CPU infocat /proc/meminfo
– memory infofree
– show memory and swap usagedu
– show directory space usagedu -sh
– displays readable sizes in GBdf
– show disk usageuname -a
– show kernel config
NETWORKING
ping host
– ping hostwhois domain
– get whois for domaindig domain
– get DNS for domaindig -x host
– reverse lookup hostwget file
– download filewget -c file
– continue stopped downloadwget -r url
– recursively download files from URLcurl url
– outputs the webpage from URLcurl -o meh1.html url
– writes the page to meh1.htmlssh user@host
– connect to host as userssh -p port user@host
– connect to host on portssh -D user@host
– connect & use bind port
COMPRESSING
tar cf file.tar files
– tar files into file.tartar xf file.tar
– untar into current directorytar tf file.tar
– show contents of archive
tar options:
c
– create archivet
– table of contentsx
– extractz
– use zip/gzipf
– specify filenamej
– bzip2 compressionw
– ask for confirmationk
– do not overwriteT
– files from filev
– verbose
PERMISSIONS
chmod octal file
– change permissions of file
Permission values:
4
– read (r)2
– write (w)1
– execute (x)
Order:
owner/group/world
Examples:
chmod 777
– rwx for everyonechmod 755
– rw for owner, rx for group/world
PROCESSES
ps
– display currently active processesps aux
– detailed outputskill pid
– kill process with process id (pid)killall proc
– kill all processes named proc
SOME OTHERS
grep pattern files
– search in files for patterngrep -r pattern dir
– search for pattern recursively in dirlocate file
– find all instances of filewhereis app
– show possible locations of appman command
– show manual page for command