Jul 31, 2024
ls Commandls similar to dir in Windowsls:
ls -l: Long listing (detailed file info)ls -a: Show hidden filesls -t: Sort by modification timels -h: Human-readable file sizesls -lathcdcd directory_namecd -: Go back to the previous directorycd ..: Move up one levelcd ~: Go to home directorypwdtouch filename: Create a blank filetouch file1 file2 file3mkdir directory_name: Create a single directorymkdir -p parent/child: Create nested directoriesmkdir -m 777 directory_namecp source_file target_filecp -r source_directory target_directoryrm filenamerm -r directory_namerm -rf / can delete the entire systemmv source_file target_filemv file1 file2 directorydudu -hdu -shchmod ugo+rwx filename: Change permissionschmod 777 filenamechmod u-x filenamechown user filenamechgrp group filenamechown user:group filenamecat filename: Display file contentcat file1 file2 > file3cat file1 >> file3tail filename: Show last 10 lineshead filename: Show first 10 linestail -f filenameless filename: View file one page at a timemore filename: Similar to less but with fewer featuresnano filename: Easy-to-use text editorvi filename: Powerful but complex text editorps: Show current user's processesps aux: Detailed view of all processestop: Real-time system statisticstop -u usernamekill PID: Terminate a processkill -9 PIDkill -2 PIDcommand &jobsfg %job_numberifconfig: View network interfaces (deprecated)ip a: View network interfaces (replacement)ip route: Show routing tableip route add subnet via gateway dev interfacenetstat -l: View listening portsss -t: View TCP connectionsss -u: View UDP connectionsss -p: View processes using socketsssh user@host: Secure Shell connectionscp source_file user@host:target_directory: Securely copy filesrsync: Advanced file copy and synchronizationuname -a: Display system informationdf -h: Show disk space usage (human-readable)find /path -name filename: Search for filesfind /path -size +1Mfind /path -mtime -30grep pattern file: Search within filestar cf archive.tar filestar xf archive.targzip filenamegunzip filename.gzuseradd usernameuserdel usernamegroupadd groupnamegroupdel groupname