Blog

Linux Commands Cheat Sheet

Linux Commands Cheat Sheet

Here is a Linux commands cheat sheet that includes some of the most common commands used for managing files, directories, processes, users, and networks:

File and Directory Operations:

CommandDescriptionSyntax
lsList directory contentsls [options] [directory]
cdChange directorycd [directory]
pwdPrint working directorypwd
mkdirCreate a new directorymkdir [options] directory
cpCopy files and directoriescp [options] source destination
mvMove or rename files and directoriesmv [options] source destination
rmRemove files and directoriesrm [options] file/directory
findSearch for files and directoriesfind [path] [expression]


Text Manipulation:

CommandDescriptionSyntax
catConcatenate and display file contentscat [options] file
grepSearch for patterns in filesgrep [options] pattern file
headDisplay the beginning of a filehead [options] file
tailDisplay the end of a filetail [options] file
wcCount lines, words, and characters in a filewc [options] file
sedStream editor for text manipulationsed [options] commands [file]
awkPattern scanning and processing languageawk [options] ‘program’ [file]



System Information:

CommandDescriptionSyntax
unamePrint system informationuname [options]
whoamiPrint the current usernamewhoami
uptimeDisplay system uptimeuptime
topDisplay system processes and resource usagetop
freeDisplay system memory usagefree
dfDisplay disk space usagedf [options] [file/system]
duEstimate file and directory space usagedu [options] [file/directory]


File Permissions:

CommandDescriptionSyntax
chmodChange file permissionschmod [options] mode file
chownChange file ownershipchown [options] owner[:group] file
chgrpChange group ownershipchgrp [options] group file
umaskSet default file permissionsumask [options] mode


Process Management:

CommandDescriptionSyntax
psDisplay process statusps [options]
killTerminate a processkill [options] process_ID
bgPut a process in the backgroundbg [options] [job_spec]
fgBring a process to the foregroundfg [options] [job_spec]
nohupRun a command that persists after session endsnohup command [options]


Network:

CommandDescriptionSyntax
ifconfigDisplay or configure network interfacesifconfig [interface] [options]
pingTest network connectivityping [options] host
sshSecure shell remote loginssh [options] [user@]hostname
scpSecurely copy files between hostsscp [options] source_file [user@]host:destination
netstatNetwork statistics and connectionsnetstat [options]
curlTransfer data from or to a servercurl [options] URL
wgetDownload files from the webwget [options] URL


Package Management:

CommandDescriptionSyntax
apt-getPackage handling utility (Debian-based systems)
yumPackage manager (RHEL-based systems)
pacmanPackage manager (Arch Linux)


Compression and Archiving:

CommandDescriptionSyntax
tarArchive filestar [options] [archive] [files/directories]
gzipCompress filesgzip [options] file
unzipExtract files from a ZIP archiveunzip [options] file.zip
unrarExtract files from a RAR archiveunrar [options] archive.rar


Please note that this is just a basic cheat sheet, and there are many more Linux commands and options available. For more detailed information on each command, refer to the respective command’s manual pages using the “man” command (e.g., “man ls” for the ls command).

Feel free to explore and experiment with these commands to enhance your Linux command-line skills!

Leave a Comment