Home Infrastructure as Code (IaC) Ubuntu 101: The Essential Linux Commands We Use Every Day

Ubuntu 101: The Essential Linux Commands We Use Every Day

301
0

If you’re new to Ubuntu or Linux, you’ve probably noticed that a lot of modern technology — from cloud computing to data engineering — depends on the command line.

This post gives you the Ubuntu essentials you’ll use every day. It’s written for beginners who want to feel confident navigating, editing, and managing files on Linux — whether you’re using it directly or through Windows with WSL2.


🧩 Before You Begin

If you’re using Windows and have not yet set up WSL2, check out our post Getting Started with WSL2: Run Linux Inside Windows first.
Once your Ubuntu environment is ready, come back here to learn the most useful commands.


🧭 1. Navigating the File System

CommandPurposeExample
pwdPrint Working Directory – shows your current locationpwd → /home/username
lsList files and foldersls -l shows details; ls -a includes hidden files
cdChange directorycd Documents or cd /etc
cd ..Move up one levelGo back to the parent folder
clearClear the terminal screenMakes the view cleaner

💡 Tip: Press Tab to autocomplete file and folder names.


🧱 2. Working with Files and Directories

CommandDescriptionExample
mkdirCreate a new directorymkdir myproject
rmdirRemove an empty directoryrmdir oldfolder
cpCopy files or folderscp file1.txt file2.txt
mvMove or renamemv file.txt newfolder/ or mv old.txt new.txt
rmDelete filesrm file.txt — ⚠️ irreversible!
touchCreate an empty filetouch notes.txt
catView the contents of a filecat readme.txt
nanoOpen a simple text editornano readme.txt (save: Ctrl + O, exit: Ctrl + X)

🧠 Pro Tip: Use rm -r foldername to delete folders recursively, but always double-check before pressing Enter.


⚙️ 3. Managing Software and Updates

Ubuntu uses APT (Advanced Package Tool) to manage software. You’ll use it for installing, updating, and removing packages.

CommandPurpose
sudo apt updateUpdates the list of available software
sudo apt upgradeInstalls updates for your system
sudo apt install packagenameInstalls a specific package
sudo apt remove packagenameUninstalls a package
sudo apt autoremoveCleans up unused dependencies

Example:

sudo apt update && sudo apt install curl -y

💡 The -y flag automatically confirms installation prompts.


🔒 4. Understanding sudo and Permissions

sudo means “superuser do.”
It temporarily gives you administrative privileges — similar to “Run as Administrator” on Windows.

When you run:

sudo apt install git

Ubuntu asks for your user password to confirm you’re authorized to make system-level changes.

⚙️ You’ll only need to enter it once per session — Ubuntu remembers it for a few minutes.


🧰 5. Viewing and Searching Files

CommandDescription
less filenameOpens a file for scrolling view (exit with q)
head -n 10 file.txtShows the first 10 lines
tail -n 10 file.txtShows the last 10 lines
grep "word" filenameSearches for a specific word or phrase in a file

Example:

grep "error" logs.txt

Finds all lines containing “error” in your log file.


🌐 6. Checking System and Network Information

CommandPurpose
hostnameDisplays your system name
ip aShows network interfaces and IP addresses
ping google.comTests internet connectivity
uname -aDisplays Linux kernel and system details
df -hShows disk space usage
free -mDisplays available memory in MB

🧠 These commands are handy for troubleshooting or checking system health.


👥 7. Managing Users and Processes

CommandFunction
whoamiDisplays your current username
topShows active processes (exit with q)
ps auxLists running processes in detail
kill <process_id>Stops a specific process
historyLists recently executed commands
sudo shutdown nowShuts down the system (use with care)

🧹 8. Useful Keyboard Shortcuts

ShortcutAction
Ctrl + CCancel the current command
Ctrl + LClear the terminal screen
↑ / ↓Browse command history
Tab TabShow possible completions
Ctrl + RSearch through previous commands

Mastering these shortcuts will make you much faster in the terminal.


🧾 Summary

Ubuntu is beginner-friendly once you learn the basic commands.
You now know how to:

  • Navigate directories
  • Create, view, and delete files
  • Install and update software
  • Manage permissions and processes
  • View system and network info

These are the core commands used daily by anyone working in a Linux environment — from developers and engineers to students and hobbyists.

Previous articleTerraform vs Ansible: What’s the Difference and When to Use Each
Next articleUnderstanding Linux Families: The Major Types Explained
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here