0% found this document useful (0 votes)
1 views3 pages

Ubuntu Shell CheatSheet

This document is a cheat sheet for Ubuntu and shell script commands, covering basic file operations, search and locate files, package management, user permissions, process management, networking, and shell script essentials. It provides concise command examples for each category, enabling users to perform various tasks efficiently. The cheat sheet serves as a quick reference for both beginners and experienced users of the Ubuntu operating system.

Uploaded by

dennis paul
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Ubuntu Shell CheatSheet

This document is a cheat sheet for Ubuntu and shell script commands, covering basic file operations, search and locate files, package management, user permissions, process management, networking, and shell script essentials. It provides concise command examples for each category, enabling users to perform various tasks efficiently. The cheat sheet serves as a quick reference for both beginners and experienced users of the Ubuntu operating system.

Uploaded by

dennis paul
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ubuntu & Shell Script Commands Cheat Sheet

1. Basic File & Directory Operations

pwd # Print working directory


ls # List directory contents
ls -l / -a # Long list / show hidden
cd /path/to/dir # Change directory
mkdir new_dir # Create new directory
touch [Link] # Create new file
cp src dest # Copy file/folder
mv old new # Rename/move
rm [Link] # Delete file
rm -r dir # Delete directory recursively
cat [Link] # Print file contents
nano [Link] # Open file in nano editor

2. Search & Locate Files

find / -name [Link] # Find file


find . -type f -size +10M # Files larger than 10MB
grep "text" [Link] # Search in file
grep -r "text" /path # Recursive grep
locate filename # Quickly locate files
which python3 # Path of executable
whereis ls # Binary and man page location

3. Package Management (APT)

sudo apt update # Update package list


sudo apt upgrade # Upgrade packages
sudo apt install pkgname # Install package
sudo apt remove pkgname # Remove package
sudo apt autoremove # Remove unused packages
dpkg -i [Link] # Install .deb file
dpkg -l # List installed packages

4. User & Permissions

whoami # Current user


sudo su # Become root
adduser newuser # Add user
Ubuntu & Shell Script Commands Cheat Sheet

passwd newuser # Set password


chmod 755 [Link] # Set execute permissions
chown user:group file # Change ownership

5. Process Management

ps aux # List all processes


top # Realtime process view
kill PID # Kill by PID
killall process_name # Kill by name
bg / fg # Background / foreground
jobs # Show jobs

6. Networking

ifconfig / ip a # Show IP config


ping [Link] # Ping host
netstat -tulnp # Listening ports
curl [Link] # Fetch web content
wget [Link] # Download file
scp file user@host:/dest # Secure copy

7. Shell Script Essentials

#!/bin/bash
name="Alice"
echo "Hello $name"

read -p "Enter name: " user


echo "Welcome $user"

if [ $age -ge 18 ]; then


echo "Adult"
else
echo "Minor"
fi

for i in {1..5}; do
echo "Item $i"
done
Ubuntu & Shell Script Commands Cheat Sheet

greet() {
echo "Hi $1"
}
greet "Bob"

x=5; y=3
echo $((x + y)) # 8

You might also like