Jul 31, 2024
ls Commandls -l: Long listing format, shows more details (e.g., file permissions, owner, size)ls -a: Shows hidden filesls -t: Sorts by modification timels -h: Human-readable file sizesls -lathcd Commandcd: Change directorycd -: Return to the previous directorycd ..: Move up one directory levelcd ~: Go to the home directorypwd Commandpwd: Print working directorytouch Commandtouch filename: Create empty text filesmkdir Commandmkdir directory_name: Create a new directorymkdir -p path/to/directory: Create nested directoriesmkdir -m 777 directory_name: Create a directory with specific permissionscp Commandcp source destination: Copy filescp -r source destination: Copy directories recursivelyrm Commandrm filename: Remove filesrm -r directory: Remove directories recursivelyrm *pattern*: Remove files matching a patternmv Commandmv source destination: Move or rename filesclear Commandclear: Clear the terminal screencat Commandcat filename: View file contentscat file1 file2 > newfile: Concatenate filescat file >> existingfile: Append to a filetail Commandtail filename: View the last 10 lines of a filetail -n N filename: View the last N linestail -f filename: Continuously monitor a filehead Commandhead filename: View the first 10 lines of a filehead -n N filename: View the first N linesless and more Commandsless filename: View file one page at a time, supports searchmore filename: Simpler than less, also views file one page at a timevi filename: Open file in vi editor (more complex, powerful)nano filename: Open file in nano editor (user-friendly)ps Commandps: Show processes for current userps aux: Detailed process listingtop Commandtop: Real-time process monitoringtop -u username: Show processes for a specific usertop -p PID: Monitor a specific processkill Commandkill PID: Terminate a processkill -9 PID: Forcefully terminate a processcommand &: Run command in backgroundjobs: List background jobsfg: Bring background job to foregroundifconfig Command (Deprecated)ifconfig: Show network interfacesip Commandip a: Show IP addressesip route show: Show routing tableip addr add IP/Mask dev interface: Add an IP addressnetstat and ss Commandsnetstat: Show network connectionsss: Socket statistics, newer than netstatss -t: Show TCP connectionsss -u: Show UDP connectionsssh user@host: Connect to a remote systemscp source user@host:destination: Secure copy files between hostsuname Commanduname -a: Show system informationdf Commanddf: Show disk space usagedf -h: Human-readable formatfind Commandfind /path -name filename: Find files by namefind /path -size +1M: Find files larger than 1MBfind /path -mtime -30: Find files modified in the last 30 daysgrep Commandgrep pattern file: Search for a pattern in a filegrep pattern /path/*: Search for a pattern in multiple files*tar Commandtar czf archive.tar.gz files: Create a compressed archivetar xzf archive.tar.gz: Extract a compressed archivetar rf archive.tar file: Add files to an archivegzip Commandgzip file: Compress a filegunzip file.gz: Decompress a filegzip -l file.gz: List contents of a gzip fileuseradd username: Add a new useruserdel username: Delete a useruseradd -m username: Add a user with a home directoryuseradd -G group username: Add a user to a specific groupgroupadd groupname: Add a new groupgroupdel groupname: Delete a group