"Ubuntu Terminal Made Easy: Must-Know Linux Commands for Beginners"


Welcome to the World of Linux!
Whether you're a beginner taking your first steps into the command line or someone looking to sharpen your Linux skills, you're in the right place! This blog is designed to help you learn and understand the most essential Linux commands, especially if you're using Ubuntu or any other Linux-based system.
We'll break down each command in a simple and practical way, showing you not just what to type—but why it matters and how it works. By the end of this guide, you'll be much more confident using the terminal to control your system like a pro.
So open up your terminal, and let’s get started on your journey to mastering Linux basics!
Note:- When typing in your commands in the terminal “LINUX” is case sensitive.
COMMANDS
1). Administrator (root) User: sudo su -
The command sudo su -
is used in Linux to switch to the root user (administrator) with full access and login environment, even if you’re not logged in as root.
✅ Breakdown of the command:
sudo
:
Stands for “superuser do”. It allows a permitted user to run commands as the superuser (root) or another user.su
:
Stands for “substitute user” or “switch user”. If used without specifying a username, it switches to the root account by default.-
(hyphen):
This tells the shell to simulate a full login as that user (in this case, root). That means it loads the root user's environment, such as variables, paths, and configuration files.
2). Advanced Package Tool: apt update
The command apt update
is used to refresh the list of available packages and their versions on your system. It does not install or upgrade anything — it just updates your system’s knowledge about what software versions are available in the repositories.
✅ Breakdown:
apt
:
Stands for Advanced Package Tool. It’s a command-line tool used to manage software on Debian-based systems like Ubuntu.update
:
This subcommand tells the system to contact the software repositories (online servers) and download the latest package information (names, versions, sources, etc.).
3). Creating A Directory: mkdir
The command mkdir
stands for “make directory”. It is used to create a new folder (directory) in your Linux filesystem.
Example: I Created a Directory(folder) called “Sports”.
4). Change Directory: cd
The command cd
stands for "change directory". It is used to navigate between folders (directories) in your Linux filesystem from the terminal. In simple terms, cd
can be used to enter into a folder(directory).
5). List: ls
The command ls
stands for “list”, and it is used to display the contents of a directory (like files and folders) in the terminal.
N.B: You can see that the list of our “Sports” directory(folder) is empty.
6). Create An Empty File: touch
The touch
command is used to create an empty file or update the timestamp of an existing file.
In the image below, we created a directory (folder) called “Sports”, then entered the directory using the cd
command. Next, we typed the ls
command to list the contents of the Sports directory. Since it was initially empty, we created a subdirectory (folder) called “football”, which we entered using the cd
command. After completing these steps, we created a text file called “best-footballers” using the touch
command.
7). apt install vim
The command apt install vim
is used to install the Vim text editor on a Debian-based Linux system (like Ubuntu) using the APT package manager.
✅ Breakdown of the Command:
apt
– Stands for Advanced Package Tool. It's used to manage software (install, update, remove) on Debian/Ubuntu systems.install
– Tells APT that you want to install a package.vim
– The name of the software package you want to install (Vim is a powerful command-line text editor).
8). vim
vim
stands for Vi Improved. It is a powerful command-line text editor used to create and edit text files directly from the terminal.
Note: To exit the text editor, press the Escape key, then type : (by pressing Shift + ;), and finally type wq , then press Enter.
9). cat
This command displays all the entire contents of the file in a readme mode.
10). history
The history
command in Linux is used to show a list of all the commands you've previously typed in the terminal.
It helps you:
Remember past commands
Reuse commands without retyping them
Track your terminal activity
11). adduser
The adduser
command in Linux is used to create a new user account on the system, along with its home directory and necessary configurations.
12). getent passwd username
The Command is used to retrieve account information about a specific user on the system. It displays the same type of info you would find in the /etc/passwd
file.
✅ Breakdown:
getent
: Stands for “get entries”. It fetches data from system databases like users, groups, hosts, etc.passwd
: Specifies the user account database.username
: Replace this with the actual name of the user you're querying.
13). sudo passwd username
The Command is used to set or change the password for a specific user on a Linux system.
✅ Breakdown:
sudo
: Runs the command with administrator privileges, which is required to change another user's password.passwd
: The Linux command to set or update a password.username
: The name of the user whose password you want to set.
14). sudo usermod -L username
The Command locks a user’s account by disabling their password login — effectively preventing them from logging in using their password.
✅ Breakdown:
sudo
– Run as superuser (admin), required for modifying users.usermod
– Command to modify user account settings.-L
– Short for lock, this adds a!
in front of the password hash in/etc/shadow
, disabling password authentication.username
– The account you want to lock, in this case the username is “dami”.
15). sudo usermod -U username
The Command unlocks a previously locked user account, restoring the user's ability to log in with their password.
✅ Breakdown:
sudo
– Runs the command with administrator privileges.usermod
– Used to modify a user account.-U
– Unlock the user account (removes the!
from the password field in/etc/shadow
).username
– The name of the user you want to unlock.
16). su - username
The Command is used to switch to another user account in the terminal with that user's full environment loaded, including their shell, variables, and home directory.
✅ Breakdown:
su
: Stands for "substitute user" (or sometimes "switch user").-
: The hyphen tells the system to simulate a full login (loads.bashrc
,.profile
, etc.).username
: The name of the user you want to switch to.
17). sudo groupadd groupname
The Command is used to create a new user group on a Linux system.
✅ Breakdown:
sudo
: Runs the command with administrator privileges (required for system-level changes).groupadd
: The command to create a new group.groupname
: The name of the group you want to create (e.g.,devops-team
,designers
,admins
).
18). sudo usermod -aG groupname username
The Command is used to add a user to a group without removing them from their current groups.
✅ Breakdown:
sudo
– Runs the command with administrator (root) privileges.usermod
– A command used to modify user accounts.-aG
– Two options combined:-a
(append) – Adds the user to the new group without affecting existing group memberships.-G
(group) – Specifies the group(s) to add the user to.
groupname
– The name of the group you're adding the user to.username
– The user you’re modifying.
19). sudo groupdel groupname
The Command is used to delete (remove) a group from the Linux system.
✅ Breakdown:
sudo
– Runs the command with administrator privileges.groupdel
– Deletes a group from the system.groupname
– The name of the group you want to delete.
20). getent group groupname
The Command is used to retrieve information about a specific group on a Linux system — including a list of all users that belong to that group.
✅ Breakdown:
getent
– Gets entries from administrative databases (like users, groups, hosts).group
– Specifies that you want info from the group database (usually/etc/group
).groupname
– The name of the group you want to look up.
21). sudo chown username:groupname filename
This command is used to change the owner and the group of a file or directory.
✅ Breakdown:
sudo
– Runs the command with root privileges.chown
– Stands for change ownership.username
– The new owner of the file.groupname
– The new group the file should belong to.filename
– The name of the file or directory you want to change.
22). sudo chown username filename
The Command is used to change the ownership of a file (or directory) to a different user — without changing the group.
✅ Breakdown:
sudo
– Runs the command with administrative privileges.chown
– Means “change owner.”username
– The new owner of the file.filename
– The name of the file or directory whose ownership you want to change.
23). sudo chgrp newgroupname filename
This Command is used to change the group ownership of a file or directory.
✅ Breakdown:
sudo
– Runs the command with root/admin privileges.chgrp
– Stands for "change group".newgroupname
– The new group you want the file to belong to.filename
– The file or folder whose group you're changing.
24). sudo chmod permissions filename
is used to change the permission settings of a file or directory in Linux.
✅ Breakdown:
sudo
– Gives you admin (root) privileges to change restricted files.chmod
– Stands for "change mode".permissions
– The permission settings (in numeric or symbolic format).filename
– The file or folder whose permissions you want to change.
25). Shell Scripting
(vim work.sh )
opens (or creates) a file named work.sh
using the Vim text editor.
✅ Breakdown:
vim
– Launches the Vim editor (a powerful terminal-based text editor).work.sh
– This is the file name. If it already exists, it opens the file. If not, it creates a new one.
CONCLUSION
Each of these commands is fundamental for managing files, directories, and packages in a Linux environment. They are essential tools for navigating the filesystem, editing text files, and maintaining the system's software
Subscribe to my newsletter
Read articles from Oluwagbayi Adewakun directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
