Jul 31, 2024
ls
lists directory contents.-l
: Long listing format (file type, permissions, owner, size, modification date).-a
: Includes hidden files.-t
: Sorts by modification time.-h
: Human-readable sizes.ls -lath
.cd
changes directories.cd ..
: Move up one directory level.cd -
: Return to the previous directory.cd ~
: Go to the home directory.clear
clears the terminal screen.pwd
prints the current working directory.touch filename
creates a blank text file.mkdir directory_name
creates a directory.-p
: Creates parent directories as needed.-m
: Sets permissions at creation.cp source destination
copies files.-r
: Copies directories recursively.-f
: Forces the copy, overwriting existing files.mv source destination
moves or renames files/directories.rm filename
removes files.-r
: Removes directories recursively.-f
: Forces removal without prompt.chmod mode filename
changes file permissions.r
(read), w
(write), x
(execute). Numeric: chmod 777 filename
.chown owner:group filename
changes file ownership.cat filename
displays file contents.cat file1 file2 > newfile
.cat file3 >> newfile
.tail filename
displays the last 10 lines of a file.-n
for number of lines. -f
for continuous updates.head filename
displays the first 10 lines of a file.-n
for number of lines.less filename
or more filename
to view large files one page at a time.less
, use /pattern
to search.vi filename
opens VI editor.i
for insert, Esc
to exit insert, :wq
to save and quit.nano filename
opens Nano editor.ps
lists processes for the current user.aux
for detailed process list.top
shows real-time process information.u
for user-specific processes, p
for specific PID.kill PID
to terminate processes.-9
for forceful termination, -2
for interrupt.jobs
lists background jobs. fg %1
brings job to the foreground.ip a
shows IP addresses. ip route show
shows routing table.ip route add subnet via gateway dev device
.ip addr add address dev device
. Remove: ip addr del
.netstat -l
for listening ports.ss -t
for TCP sockets.ssh user@hostname
to connect via SSH.scp source destination
for secure copy.rsync options source destination
for file synchronization.uname -a
for detailed system information.df -h
shows disk space in human-readable format.find directory -name pattern
to search for files.-size
to find by size, -mtime
to find by modification time.grep pattern files
to search within files.tar czf archive.tar.gz files
to create an archive.tar xvf archive.tar.gz
to extract.tar rf archive.tar file
to add to archive.gzip file
to compress.gunzip file.gz
to decompress.useradd username
to add user.-m
to create home directory, -g
to add to group, -e
to set expiration.userdel username
to delete user.-r
to remove home directory.groupadd groupname
to add group.groupdel groupname
to delete group.