Ubuntu Cheat Sheet

Here’s a cheat sheet for commands and tasks in Ubuntu:

System Information

Display system information:

uname -a

Check Ubuntu version:

lsb_release -a

Package Management

Update package lists:

sudo apt update

Upgrade installed packages:

sudo apt upgrade

Install a package:

sudo apt install package_name

Remove a package:

sudo apt remove package_name

File and Directory Operations

Navigate to a directory:

cd /path/to/directory

List files and directories:

ls

Create a new directory:

mkdir new_directory

Copy a file or directory:

cp source destination

Move/Rename a file or directory:

mv source destination

Remove/Delete a file or directory:

rm file_or_directory

User and Permissions

Add a new user:

sudo adduser username

Add user to sudo group:

sudo usermod -aG sudo username

Change user password:

sudo passwd username

Change file/folder permissions:

chmod permissions file_or_directory

System Control

Restart the system:

sudo reboot

Shut down the system:

sudo shutdown -h now

View system logs:

journalctl

Networking

Display network information:

ip a

Check open ports:

sudo netstat -tuln

Restart network service:

sudo systemctl restart networking

Check IP address:

curl ifconfig.me

File Editing

Open a text file for editing (using nano):

nano filename

Open a text file for editing (using vim):

vim filename

View the content of a file:

cat filename

Process Management

View running processes:

ps aux

Kill a process by PID:

sudo kill -9 PID

Search for a process:

pgrep process_name

These commands cover some common tasks in Ubuntu. For more details and advanced usage, refer to the official Ubuntu documentation.