Jul 31, 2024
ls
: Lists directory contents
ls -l
: Long listing format
ls -a
: Includes hidden filesls -t
: Sort by modification timels -h
: Human-readable sizesls -lath
cd
: Change directory
cd -
: Move to the previous directorycd ..
: Move up one directory levelcd ~
: Go to home directorypwd
: Print working directorytouch
: Create empty files
touch file1 file2 file3
mkdir
: Create directories
mkdir dir1
mkdir -p parent/child
mkdir -m 777 dir
cp
: Copy files and directories
cp file1 file2
cp -r dir1 dir2
rm
: Remove files and directories
rm file1
rm -rf dir
mv
: Move or rename files and directories
mv oldname newname
clear
: Clear the terminal screendu
: Disk usage
du -h
du -sh
chmod
: Change file permissions
chmod u+x file
chmod 777 file
chown
: Change file owner
chown user:group file
cat
: Concatenate and display files
cat file1 file2 > file3
cat file >> file
tail
: View end of files
tail file
tail -f file
head
: View beginning of files
head file
less
: View files one page at a time
less file
grep
: Search text using patterns
grep 'pattern' file
nano
: Simple text editorvi
: More complex, feature-rich text editorps
: Process status
ps aux
top
: Real-time process monitoring
top -u user
kill
: Terminate processes
kill pid
kill -9 pid
jobs
: List background jobsfg
: Bring background job to foregroundifconfig
: Network interface configurationip
: Newer network interface configuration
ip a
ip route
netstat
: Network statistics
netstat -l
ss
: Socket statistics
ss -t
ssh
: Secure shell
ssh user@host
scp
: Secure copy
scp file user@host:/path
rsync
: Remote sync
rsync -avz source destination
uname
: System information
uname -a
df
: Disk free space
df -h
find
: Search for files
find /path -name filename
find /path -size +1M
find /path -mtime -30
tar
: Archive files
tar czf archive.tar.gz files
tar xzf archive.tar.gz
gzip
: Compress files
gzip file
gunzip file.gz
useradd
: Add a new user
useradd username
useradd -m username
userdel
: Delete a user
userdel username
userdel -r username
groupadd
: Add a new group
groupadd groupname
groupdel
: Delete a group
groupdel groupname