Essential Ubuntu Commands for Beginners – A Complete Guide

Introduction
Ubuntu, one of the most popular Linux distributions, offers a powerful command-line interface (CLI) for efficient system management. If you’re new to Ubuntu, learning essential commands can significantly enhance your experience. This guide covers fundamental Ubuntu commands to help you get started quickly and improve your productivity.

1. System Update and Package Management in Ubuntu

Keeping your Ubuntu system updated ensures security and optimal performance.

sudo apt update      # Refresh package list
sudo apt upgrade -y  # Upgrade all installed packages
sudo apt autoremove  # Remove unnecessary packages

To install a package on Ubuntu:

sudo apt install <package_name>

To remove a package:

sudo apt remove <package_name>

2. File and Directory Management Commands in Ubuntu

List files and directories:

ls -l        # Detailed view
ls -a        # Show hidden files

Create and remove directories in Ubuntu:

mkdir mydir       # Create a new directory
rmdir mydir       # Remove an empty directory
rm -r mydir       # Remove a directory and its contents

Create and delete files in Ubuntu:

touch myfile.txt  # Create an empty file
rm myfile.txt     # Delete a file

3. File Operations in Ubuntu

Copy and move files:

cp file1.txt /path/to/destination  # Copy file
mv file1.txt /path/to/destination  # Move file (also used for renaming)

View file content:

cat file.txt      # Display entire file
less file.txt     # View file content page by page
head -n 10 file.txt  # Show first 10 lines

4. User and Permission Management in Ubuntu

Check current user:

whoami

Switch user in Ubuntu:

su - username

Change file permissions in Ubuntu:

chmod 755 file.txt  # Modify file permissions
chown user:user file.txt  # Change file owner

5. Process and System Monitoring Commands in Ubuntu

Check system resource usage:

top   # Real-time system monitoring
htop  # Better interactive process viewer (install required: sudo apt install htop)

Check disk usage in Ubuntu:

df -h  # Show disk usage
free -m  # Show memory usage

Kill a process in Ubuntu:

kill <PID>   # Kill process by ID
killall <process_name>  # Kill process by name

6. Networking Commands in Ubuntu

Check network connectivity:

ping google.com  # Test internet connectivity

Display IP address in Ubuntu:

ip a  # Show all network interfaces and IP addresses

Check open ports in Ubuntu:

netstat -tulnp  # Show active listening ports (install required: sudo apt install net-tools)

7. System Shutdown and Reboot Commands in Ubuntu

Shutdown the Ubuntu system:

sudo shutdown -h now

Reboot the Ubuntu system:

sudo reboot
Leave a Reply 0

Your email address will not be published. Required fields are marked *