Tell me for any kind of development solution

Edit Template

Must Know 20 Essential Ubuntu Commands for Beginners

Ubuntu’s command-line interface (CLI) is a powerful tool for managing your system, but it can feel intimidating for newcomers. Learning a few foundational Essential Ubuntu Commands for beginners will help you navigate files, install software, and troubleshoot issues confidently. In this guide, we’ll break down 20 essential commands with clear examples to turn you into a terminal pro.

Why Learn Ubuntu Commands?

The terminal lets you perform tasks faster than graphical interfaces, automate workflows, and access advanced system settings. Whether you’re managing servers or customizing your desktop, these Ubuntu terminal commands are the building blocks of Linux mastery.


Getting Started with the Essential Ubuntu Commands

Open the Terminal

Press Ctrl + Alt + T or search for “Terminal” in your applications menu.


Basic Navigation Commands

1. pwd (Print Working Directory)

What it does: Shows your current directory (folder).

Example:

pwd 
# Output: /home/yourusername 

Use Case: Confirm where you are before modifying files.

2. ls (List Directory Contents)

What it does: Lists files and folders in your current directory.

Example:

ls -a  # Shows hidden files (e.g., .config) 
ls -lh # Displays file sizes in readable formats 

Tip: Combine flags like ls -lah for a detailed view.

3. cd (Change Directory)

What it does: Moves you between folders.

Example:

cd Documents          # Enter the Documents folder 
cd ..                # Move up one directory 
cd                # Return to your home folder

File and Directory Management

4. mkdir (Make Directory)

What it does: Creates a new folder.

Example:

mkdir Projects  # Creates a folder named "Projects" 

5. rm (Remove Files)

What it does: Deletes files or directories.

Example:

m oldfile.txt       # Deletes a file 
rm -r OldProjects    # Deletes a folder and its contents 

Warning: Use -r (recursive) carefully—deleted files can’t be recovered!

6. cp (Copy Files)

What it does: Copies files or directories.

Example:

cp file.txt /backup/  # Copies file.txt to the "backup" folder 
cp -r Photos/ /backup/ # Copies the entire Photos directory 

7. mv (Move/Rename Files)

What it does: Moves files or renames them.

Example:

mv file.txt renamed_file.txt  # Renames the file 
mv file.txt ~/Documents/      # Moves it to Documents 

Viewing and Editing Files

8. cat (Concatenate Files)

What it does: Displays file contents or combines files.

Example:

cat notes.txt  # Shows the contents of notes.txt 

9. nano or vim (Text Editors)

What it does: Edits text files directly in the terminal.

Example:

nodoors.txt  # Opens the file in Nano 
# Press Ctrl+X to exit after editing 

10. grep (Global Regular Expression Print)

What it does: Searches for text patterns in files.

Example:

grep "error" system.log  # Finds lines containing "error" 

System Information and Monitoring

11. df (Disk Free)

What it does: Shows disk space usage.

Example:

df -h  # Displays space in GB/MB 

12. du (Disk Usage)

What it does: Checks file/folder size.

Example:

du -sh Documents/  # Shows total size of Documents 

13. top or htop

What it does: Monitors system processes and resource usage.

Example:

top  # Live view of CPU, memory, and tasks 

User Permissions

14. sudo (Superuser Do)

What it does: Runs commands with administrative privileges.

Example:

sudo apt update  # Updates package lists (requires password) 

15. chmod (Change Mode)

What it does: Modifies file permissions.

Example:

chmod +x script.sh  # Makes script.sh executable 

16. chown (Change Owner)

What it does: Changes file ownership.

Example:

sudo chown user:group file.txt 

Package Management

17. apt-get or apt

What it does: Installs, updates, or removes software.

Example:

sudo apt install firefox  # Installs Firefox 
sudo apt remove vlc       # Removes VLC 

Process Management

18. ps (Process Status)

What it does: Lists running processes.

Example:

ps aux  # Shows all active processes 

19. kill

What it does: Terminates unresponsive programs.

Example:

kill 1234  # Replace 1234 with the process ID (PID) 

Getting Help

20. man (Manual Pages)

What it does: Displays detailed command guides.

Example:

man ls  # Shows the manual for the 'ls' command 

Conclusion: Practice Makes Perfect

Mastering these Essential Ubuntu Commands for beginners unlocks the full potential of your Linux system. Start with basic navigation, then explore advanced tasks like scripting or system monitoring.

Pro Tip: Bookmark this article for quick reference.


FAQs: 20 Essential Ubuntu Commands for Beginners

Here are some frequently asked questions (FAQs) about Ubuntu commands that beginners often find confusing, along with clear answers based on the article above:

1. What is the difference between rm and rmdir?

rm is used to delete files or directories (folders). For example, rm file.txt deletes a file, and rm -r folder/ deletes a folder and its contents.

rmdir is used only to delete empty directories. For example, rmdir empty_folder/ removes an empty folder. If the folder contains files, use rm -r instead.

2. How do I undo a command if I make a mistake?

Unfortunately, most terminal commands (like rm, mv, or cp) don’t have an “undo” feature. This is why it’s important to double-check commands before executing them. For example, always verify file paths before deleting or moving files.

3. What does sudo mean, and when should I use it?

sudo stands for “Superuser Do.” It allows you to run commands with administrative (root) privileges.

Use sudo for tasks that require elevated permissions, such as installing software (sudo apt install) or modifying system files.

Example: sudo apt update updates your package lists.

4. How do I view hidden files in a directory?

Use the ls command with the -a flag to display hidden files (files that start with a dot, like .config).

Example:

ls -a 

This will show all files, including hidden ones, in the current directory.

5. What’s the difference between cat and nano?

cat is used to display the contents of a file directly in the terminal. For example, cat file.txt shows the text inside file.txt.

nano is a text editor that allows you to open and modify files. For example, nano file.txt opens file.txt for editing.

Use cat for quick viewing and nano for making changes.

6. How do I stop a running process in the terminal?

Use the kill command to terminate a process. First, find the Process ID (PID) using ps aux, then run kill PID.

Example:

ps aux | grep firefox  # Find Firefox's PID 
kill 1234             # Replace 1234 with the actual PID 

If the process doesn’t stop, use kill -9 PID to force it.

Share Article:

© 2025 Created by ArtisansTech