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.
Here’s a list of all the basic Linux commands from the image you provided, grouped by category: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

