Jul 31, 2024
ls
ls
:
ls -l
: Long listing formatls -a
: Shows hidden filesls -t
: Sorts by modification timels -h
: Human-readable file sizesls -lath
ls -R
cd
: Change directorycd ..
: Go up one levelcd -
: Go back to the previous directorycd ~
: Go to home directoryclear
: Clears the terminal screentouch filename
: Creates an empty text filemkdir dirname
: Creates a directorymkdir -p dir1/dir2/dir3
mkdir -m 777 dirname
cp source destination
: Copies a filecp -r sourcedir destdir
rm filename
: Removes a filerm -r dirname
rm pattern*
rm -rf
, especially at root levelmv source destination
: Moves or renames a filedu
: Disk usage of files and directoriesdu -h
du -sh
chmod
: Change permissionschmod [user/group/others][+/-][rwx] filename
chmod 777 filename
chown
: Change file ownerchown user:group filename
cat filename
: Display file contentscat file1 file2 > file3
cat file1 >> file2
tail filename
: Show end of file
tail -n 15 filename
: Shows last 15 linestail -f filename
: Real-time file updatehead filename
: Show beginning of fileless filename
: View file one page at a timemore filename
: Similar to less
vi filename
: Opens file in VI editornano filename
: Opens file in Nano editorps
: Displays current user's processesps aux
: Detailed process listtop
: Real-time process viewerkill PID
: Terminates a processkill -9 PID
command &
: Runs command in the backgroundjobs
: Lists background jobsfg
: Brings background job to foregroundifconfig
: Display IP configuration (deprecated)ip a
: Display IP configuration (current)ip route
: Show routing tableip route add
: Add a network routeip addr add
: Assign an IP address to an interfaceip addr del
: Remove an IP address from an interfacenetstat -l
: Show listening socketsss
: Similar to netstat
, but more detailedss -t
: Show TCP socketsss -u
: Show UDP socketsss -p
: Show processes using socketsssh user@hostname
: Connect to remote machine via SSHscp
: Secure copy between machinesrsync
: Remote file synchronizationuname -a
: Detailed system informationdf
: Disk space usage
df -h
df -Th
find /path -name filename
: Search for filesfind /path -size +1M
: Search for files larger than 1MBfind /path -mtime -30
: Search for files modified in last 30 daysgrep pattern filename
: Search within filestar -czf archive.tar.gz files
: Create gzip archivetar -xzf archive.tar.gz
gzip filename
: Compress a filegunzip filename.gz
: Decompress a fileuseradd username
: Add a new useruserdel username
: Delete a usergroupadd groupname
: Add a new groupgroupdel groupname
: Delete a groupThese notes cover the essential Linux commands discussed in the video, along with their flags and use cases. They are organized by categories for easy reference and study.