Jul 31, 2024
ls
Commandls -l
: Long listing format
ls -a
: Includes hidden files (those starting with a dot)ls -t
: Sorts files by modification timels -h
: Human-readable sizesls -R
: Recursively lists directory contentscd
Commandcd -
: Go back to the previous directorycd ..
: Move up one directory levelcd ~
: Go to the home directorypwd
Commandclear
Commandtouch filename
: Creates an empty filemkdir directoryname
: Creates a new directorymkdir -p directory/subdirectory
: Creates nested directoriesmkdir -m permissions directory
: Creates a directory with specific permissionscp source destination
: Copy filescp -r source destination
: Recursively copy directoriesrm filename
: Removes a filerm -r directory
: Recursively removes a directory and its contentsrm -rf directory
: Forcefully removes directory and contents (be cautious)mv source destination
: Move or rename filescat filename
: Displays file contentscat file1 file2 > newfile
: Concatenates filescat file >> existingfile
: Appends a file to an existing filetail filename
: Shows the last 10 lines of a filetail -n number filename
: Shows the last 'number' of linestail -f filename
: Continuously monitors a file for changeshead filename
: Shows the first 10 lines of a filehead -n number filename
: Shows the first 'number' of linesless filename
: Opens file in a scrollable viewmore filename
: Similar to less
, but simplervi filename
: Opens file in vi editornano filename
: Opens file in nano editor (easier for beginners)ps
: Lists processes for the current userps aux
: Detailed process information for all userstop
: Interactive process viewerhtop
: An enhanced version of top
(if installed)kill PID
: Kill a process by its process IDkill -9 PID
: Force kill a processjobs
: Lists background jobsfg %jobnumber
: Brings a background job to the foregroundbg %jobnumber
: Sends a job to the backgroundifconfig
: Displays network interfaces (deprecated)ip a
: Shows IP addressesip route
: Shows routing tableping hostname
: Checks connectivitytraceroute hostname
: Traces route to a hostssh user@host
: Connects to a remote host via SSHscp source user@host:destination
: Securely copies files between hostsnetstat -l
: Shows listening portsss -t
: Shows TCP connectionsss -u
: Shows UDP connectionsdf -h
: Shows disk usage in human-readable formatdu -sh directory
: Shows disk usage of a directoryuname -a
: Displays system informationfind /path -name filename
: Searches for files by namefind /path -size +1M
: Finds files larger than 1MBfind /path -mtime -30
: Finds files modified within the last 30 daysgrep pattern filename
: Searches for a pattern in a filegrep -r pattern directory
: Recursively searches for a pattern in a directorytar czf archive.tar.gz /path
: Creates a compressed tar archivetar xzf archive.tar.gz
: Extracts a compressed tar archivegzip filename
: Compresses a filegunzip filename.gz
: Decompresses a fileuseradd username
: Adds a new useruserdel username
: Deletes a userusermod -aG groupname username
: Adds a user to a groupgroupadd groupname
: Adds a new groupgroupdel groupname
: Deletes a group