Getting Started with Ubuntu: Basic Ubuntu Commands for Beginners

The Ubuntu terminal may seem intimidating at first, but mastering a few basic commands unlocks speed, flexibility, and control. This beginner-friendly guide walks you through the essentials to get started with Linux command line.

Getting Started with Ubuntu: Basic Ubuntu Commands for Beginners
Photo by Oleksandr Chumak / Unsplash

Introduction

Ubuntu, like many Linux distributions, relies heavily on the command line for a wide range of tasks. Although the graphical interface of Ubuntu is user-friendly and powerful, mastering the terminal is essential for unlocking its full potential. For beginners, using the terminal can be intimidating at first, but once you become familiar with some basic commands, you’ll realize how efficient and flexible it is. This guide covers some of the most fundamental Ubuntu/Linux commands to help you get started.

2. Why Learning Basic Commands is Important

The terminal in Ubuntu allows you to interact directly with the operating system using text commands. Whether you're troubleshooting issues, automating tasks, or managing files, using the terminal can often be faster than navigating through the GUI. Understanding basic commands will:

  • Make you more proficient in Ubuntu/Linux.
  • Help you troubleshoot problems more effectively.
  • Allow you to perform complex tasks that are impossible or difficult with a graphical interface.

3. Getting to Know the Terminal

The terminal is the place where you type and execute commands. In Ubuntu, you can open the terminal by:

  • Clicking the Activities button in the upper-left corner of the screen and searching for "Terminal".
  • Using the keyboard shortcut Ctrl + Alt + T.

When you open the terminal, you'll see a command prompt that looks something like this:

username@hostname:~$

Here:

  • username is your Ubuntu username.
  • hostname is the name of your computer.
  • ~ represents the home directory.
  • $ indicates that you're logged in as a regular user (not the superuser).
Ubuntu Desktop 24.04 - Terminal

4. Basic Ubuntu Commands Every Beginner Should Know

4.1 Navigating the File System

To navigate and manage files and directories, you'll need to know the following commands:

cd .. Moves you one directory up (parent directory).

cd ..

cd (Change Directory): Used to navigate to different directories. For example, to navigate to the "Documents" directory:

cd Documents

ls (List): Lists the files and directories in the current directory.

ls
Desktop  Documents  Downloads  Pictures

pwd (Print Working Directory): This command shows you the current directory you are in.

pwd
/home/username

4.2 Managing Files and Directories

rmdir: Deletes empty directories.

rmdir my_folder

rm (Remove): Deletes files or directories.

rm myfile.txt

mv (Move): Moves files or directories. This can also be used to rename files.

mv myfile.txt /home/username/Documents

cp (Copy): Copies files or directories.

cp myfile.txt /home/username/Documents

touch: Creates a new empty file.

touch myfile.txt

mkdir (Make Directory): Creates a new directory.

mkdir new_folder

4.3 Checking System Information

free -h: Displays available and used memory.

free -h

df -h: Shows disk usage and available space.

df -h

uname -a: Displays system information such as kernel version, architecture, and more.

uname -a
Linux ubuntu 5.4.0-42-generic #46-Ubuntu SMP x86_64 GNU/Linux

4.4 Installing and Removing Software

apt remove <package>: Removes a specific package.

sudo apt remove vim

apt install <package>: Installs a specific package.

sudo apt install vim

apt upgrade: Installs available updates for all packages.

sudo apt upgrade

apt update: Updates the package lists from the repositories.

sudo apt update

4.5 Managing Permissions

chown: Changes the ownership of a file or directory.

sudo chown username:group file.txt

chmod: Changes the permissions of a file or directory. For example, to make a file executable:

chmod +x script.sh

4.6 Networking Commands

netstat: Shows network connections, routing tables, and more.

netstat -tuln

ifconfig: Displays network interface information.

ifconfig

ping <hostname>: Tests connectivity to a specific host or server.

ping google.com

4.7 Disk and Storage Management

mount and umount: Mounts and unmounts file systems.

sudo mount /dev/sdb1 /mnt
sudo umount /mnt

fdisk: A utility to manipulate disk partitions.

sudo fdisk -l

lsblk: Lists information about all available block devices (hard drives, partitions, etc.).

lsblk

Conclusion

Mastering the command line in Ubuntu is an essential skill that will help you navigate, manage, and troubleshoot your system more effectively. With the basic commands covered in this guide, you'll be able to perform a wide range of tasks and become more comfortable with the Linux terminal. As you grow more confident, you can explore more advanced commands and techniques to further optimize your workflow.

This post covers the very basics to get you started. Be sure to check out the next blog post in this series for a deeper dive into the terminal and essential Linux/Ubuntu commands.

Read next

Testing OpenGL Performance on CPU nouveau driver

While waiting for the right NVLink bridge, I decided to see how my dual RTX 2080 Ti setup performs without them—by turning the GPUs off entirely. The result? A deep dive into OpenGL on CPU using the humble Nouveau driver, where even spinning gears tell a story about patience and pixels.