Linux 101: Mastering the Basics of the Command Line
If you're new to Linux, welcome! You’ve just stepped into a world of open-source power, flexibility, and control. But to unlock the full potential of Linux, you need to get comfortable with the command line — the terminal.
This article is your gentle introduction to the Linux command line, the key to truly mastering this operating system.
Why the Command Line?
While many Linux distributions offer a graphical user interface (GUI), the real magic happens in the terminal. With a few typed commands, you can:
- Manage files and directories
- Install and update software
- Monitor system performance
- Automate tasks with scripts
It's faster, more efficient, and often the only way to get certain things done on a server.
Getting Started
Opening the Terminal
- On Ubuntu, press
Ctrl + Alt + T
. - On other distros, look for “Terminal” in your application menu.
Basic Commands You Should Know
1. pwd
— Print Working Directory
Shows you where you are in the filesystem.
pwd
2. ls
— List Files
Lists files and folders in your current directory.
ls
Add -l
for more detail:
ls -l
3. cd
— Change Directory
Moves you into a different folder.
cd Documents
cd ..
4. mkdir
— Make Directory
Creates a new folder.
mkdir my_folder
5. touch
— Create a File
Creates a blank file.
touch file.txt
6. rm
— Remove File or Directory
Deletes files or directories. Use with caution!
rm file.txt
rm -r folder_name
Understanding the Filesystem
Linux starts everything from the root /
directory. Here are some key locations:
/home/
– User directories/etc/
– Configuration files/var/
– Logs and variable data/bin/
– Essential system binaries
Permissions: ls -l
and chmod
Every file has permissions (read, write, execute). You can check them using:
ls -l
And modify them with chmod
:
chmod +x script.sh
Package Management (Ubuntu/Debian-based)
To update software:
sudo apt update
sudo apt upgrade
To install something:
sudo apt install htop
Wrapping Up
This is just the tip of the iceberg. But with these basics, you're now equipped to start exploring Linux more confidently.
Next steps:
- Learn about piping and redirection (
|
,>
,>>
) - Write your first shell script
- Try a lightweight distro in a virtual machine
Stay tuned for the next article in this series: “Linux 102: Shell Scripting Basics.”