Version: Sep 17, 2025

🔑 User & Permissions

# Switch usersu - username
# Add new usersudo adduser newuser
# Add user to sudoerssudo usermod -aG sudo newuser
# Change permissionschmod 755 file.sh
# Change ownershipchown user:group file.txt

📂 File & Directory Management

# List files (long format, hidden files)ls -la
# Change directorycd /path/to/dir
# Make a new directorymkdir new_folder
# Remove directory (empty)rmdir old_folder
# Copy filecp file1.txt /path/to/dir/
# Move or rename filemv oldname.txt newname.txt
# Remove filerm file.txt
# Find files by namefind /path -name "*.log"

📦 Package Management (Ubuntu/Debian)

# Update package listssudo apt update
# Upgrade installed packagessudo apt upgrade
# Install a packagesudo apt install package-name
# Remove a packagesudo apt remove package-name
# Search for a packageapt search package-name

⚙️ System Information

# Show current userwhoami
# Show system infouname -a
# Show disk usagedf -h
# Show memory usagefree -h
# Show running processesps aux
# Show real-time processestop

🌐 Networking

# Show IP addressip addr show
# Ping a hostping -c 4 google.com
# Show listening portssudo netstat -tuln
# Test open port (e.g., port 22)nc -zv localhost 22
# Download file with wgetwget http://example.com/file.zip

🔐 SSH

# Connect to remote hostssh user@host
# Connect with identity filessh -i ~/.ssh/id_rsa user@host
# Copy file to remotescp file.txt user@host:/path/
# Copy file from remotescp user@host:/path/file.txt ./

📝 File Viewing & Editing

# View file contentscat file.txt
# View with paginationless file.txt
# Edit with nanonano file.txt
# Edit with vimvim file.txt
# Show first 10 lineshead file.txt
# Show last 10 linestail file.txt
# Follow file updatestail -f logfile.log

🖥️ Process Management

# List running jobsjobs
# Kill process by PIDkill -9 1234
# Kill process by namepkill -f process_name
# Run in backgroundcommand &
# Bring job to foregroundfg %1

🔄 Permissions & Ownership

# Change file permissions (read/write/execute for user/group/other)chmod 755 file.sh
# Add execute permissionchmod +x script.sh
# Change file ownerchown user:group file.txt