Jul 31, 2024
ls Command-l: Long listing format (details like permissions, owner, size, modification date).-a: Includes hidden files (files starting with .).-t: Sort by modification time (newest first).-h: Human-readable file sizes.ls -lath.-R [directory]: Lists directory contents recursively.ls -R etccd Commandtab for auto-complete directory names.cd -: Switch to the previous directory.cd ..: Move up one directory level.cd ~: Move to the home directory.pwd Commandtouch Commandtouch file1 file2 file3mkdir Command-p: Create parent directories as needed.-m [permissions]: Set permissions (e.g., 777) when creating.mkdir -p dir1/dir2/dir3mkdir -m 777 testdircp Command-r: Copy directories recursively.-f: Force overwrite.cp file1 file2cp -rf dir1 dir2rm Command-r: Remove directories recursively.-f: Force removal.rm file1rm -rf directorymv Commandmv oldname newnamemv file1 /path/to/destinationdu Command-h: Human-readable format.-s: Summarize total.du -sh /var/logchmod Commandu, g, o: User, group, other.+, -: Add or remove permissions.r, w, x: Read, write, execute.chmod u+x filenamechmod 777 filenamechown Commandchown user:group filenamechown root:users file1chown username: filenamecat Command> to redirect output.>> to append to files.cat file1 file2 > newfileless and more Commandsless filename, more filenamenano Commandnano filenamevi Commandvi filenameps Commandaux: Detailed process list.ps auxtop Command-u [username]: Filter by user.-p [PID]: Filter by process ID.top -u rootkill Command-9 [PID]: Force kill.kill -9 1234jobs, fg, bg Commandsjobs: List background jobs.fg [job]: Move job to foreground.bg [job]: Move job to background.ifconfig and ip Commandsifconfigip addr showip route shownetstat and ss Commands-l: Listening ports.-t: TCP connections.-u: UDP connections.netstat -ltuss -ltssh Commandssh username@hostnamessh -p [port] username@hostnamescp Commandscp localfile user@remotehost:/path/to/destinationrsync Commandrsync -avz /source/ user@remote:/destination/uname Command-a: All information.uname -adf Command-h: Human-readable format.-t: File system type.df -hTfind Command-name: Search by name.-size: Search by file size.-mtime: Search by modification time.find /home -name '*.jpg'find /var/log -size +1Mfind /var/log -mtime -30*grep Command-i: Case insensitive.-r: Recursive.grep 'search_string' filegrep -r 'search_string' /path/to/directorytar Command-c: Create.-x: Extract.-z: Compress with gzip.-f: Specify filename.tar -czf archive.tar.gz /path/to/directorytar -xzf archive.tar.gzgzip Command-d: Decompress.gzip filenamegzip -d filename.gzuseradd and userdel Commands-m: Create home directory.-G [group]: Add to group.-e [date]: Set account expiration date.useradd -m -G root usernameuserdel -r usernamegroupadd and groupdel Commandsgroupadd groupnamegroupdel groupname