The practical commands that actually matter — with real examples for each one
By Prakash Gangurde | BCA Student | Technical Content Creator | AI • Python • Linux
Introduction
When I first opened a Linux terminal, I stared at a blinking cursor and had absolutely no idea what to do.
No buttons. No menus. Just a black screen waiting for me to type something.
If that sounds familiar — this article is for you.
Linux is not just for hackers and system administrators. As a CS student, you will encounter Linux in web servers, cloud platforms, cybersecurity, data science, and software development. The sooner you get comfortable with the terminal, the faster everything else becomes.
This article covers 20 commands I actually use — not a textbook list of every possible flag, but the ones that solve real problems you will face as a student. Each command comes with a real example, not just a definition.
Estimated reading time: 15–18 minutes
Tested on Ubuntu 22.04 LTS. Most commands work identically on any Debian-based Linux system and macOS terminal.
Before We Start — The Terminal Basics
Opening the terminal:
- Ubuntu/Linux: Press
Ctrl + Alt + T - macOS: Search "Terminal" in Spotlight
- Windows: Use WSL (Windows Subsystem for Linux) or install Ubuntu
Reading command syntax:
When you see something like command [option] <argument>, it means:
-
command— the actual command to type -
[option]— optional flag (in square brackets) -
<argument>— required input (in angle brackets)
One rule before everything else:
Linux is case-sensitive.
File.txt,file.txt, andFILE.TXTare three different files.
Navigation Commands
1. pwd — Print Working Directory
What it does: Shows you exactly where you are in the file system.
pwd
Output:
/home/prakash/projects
When you use it: Any time you get lost and need to know your current location. Think of it as "where am I right now?"
2. ls — List Directory Contents
What it does: Shows all files and folders in the current directory.
ls
Output:
Desktop Documents Downloads projects README.md
The version you will actually use:
ls -la
Output:
drwxr-xr-x 5 prakash prakash 4096 Jun 10 10:30 .
drwxr-xr-x 18 prakash prakash 4096 Jun 9 08:15 ..
-rw-r--r-- 1 prakash prakash 220 Jun 9 08:15 .bash_logout
drwxr-xr-x 3 prakash prakash 4096 Jun 10 09:45 projects
-rw-r--r-- 1 prakash prakash 1024 Jun 10 10:30 README.md
-
lgives you detailed info (permissions, size, date).ashows hidden files (files starting with.).
When you use it: Every single time you open a terminal.
3. cd — Change Directory
What it does: Moves you into a different folder.
cd projects # go into the projects folder
cd .. # go up one level
cd ~ # go to your home directory from anywhere
cd /var/www/html # go to an absolute path
cd - # go back to the previous directory
When you use it: Constantly. This is how you navigate your entire file system.
4. mkdir — Make Directory
What it does: Creates a new folder.
mkdir my-project # create one folder
mkdir -p projects/python/day1 # create nested folders all at once
The -p flag is extremely useful — it creates all the parent folders if they don't exist yet.
When you use it: Every time you start a new project.
5. clear — Clear the Terminal Screen
What it does: Clears all the clutter from your terminal screen.
clear
Or just press Ctrl + L — same result, faster.
When you use it: When your terminal gets too messy to read.
File Operations
6. touch — Create an Empty File
What it does: Creates a new empty file instantly.
touch index.html
touch app.py
touch notes.txt
When you use it: Creating new files without opening an editor first.
7. cp — Copy Files and Folders
What it does: Copies a file or folder from one location to another.
cp app.py app_backup.py # copy a file
cp -r projects/ projects_backup/ # copy an entire folder
The -r flag means "recursive" — required when copying folders.
When you use it: Before making big changes to a file — always keep a backup.
8. mv — Move or Rename Files
What it does: Moves a file to a new location OR renames it.
mv old_name.py new_name.py # rename a file
mv app.py /home/prakash/projects/ # move a file to a different folder
mv folder1/ folder2/ # rename a folder
When you use it: Organising files or renaming them without opening a file manager.
9. rm — Remove Files and Folders
What it does: Permanently deletes files or folders.
rm file.txt # delete a file
rm -r old_project/ # delete a folder and everything inside it
⚠️ Warning: Linux has no recycle bin.
rmis permanent. Always double-check before running it. Never runrm -rf /— it deletes everything on the system.
When you use it: Cleaning up old files and project folders.
10. cat — Display File Contents
What it does: Prints the contents of a file directly in the terminal.
cat README.md
cat requirements.txt
cat /etc/hosts
When you use it: Quickly reading a small file without opening an editor. Also useful for checking config files.
Search and Find
11. grep — Search Inside Files
What it does: Searches for a specific word or pattern inside files.
grep "import" app.py # find all lines with "import" in app.py
grep -r "password" . # search for "password" in all files recursively
grep -n "def " app.py # show line numbers where "def " appears
grep -i "error" log.txt # case-insensitive search
When you use it: Finding which file contains a specific function, variable, or text. I use grep -r almost every day when working on projects.
12. find — Find Files by Name
What it does: Searches for files and folders by name, type, or size.
find . -name "app.py" # find a file named app.py
find . -name "*.txt" # find all .txt files
find . -type d -name "node_modules" # find all folders named node_modules
find /home -name "*.py" -size +1M # find Python files larger than 1MB
When you use it: When you know a file exists but can't remember where you put it.
Permissions
13. chmod — Change File Permissions
What it does: Controls who can read, write, or execute a file.
chmod 755 script.py # owner can read/write/execute, others can read/execute
chmod +x run.sh # make a file executable
chmod 644 config.txt # owner can read/write, others can only read
Understanding 755:
- First digit (7) = owner: read + write + execute
- Second digit (5) = group: read + execute
- Third digit (5) = others: read + execute
When you use it: Any time you want to run a Python or shell script directly from the terminal, you need to make it executable with chmod +x.
14. sudo — Run as Administrator
What it does: Runs a command with administrator (root) privileges.
sudo apt update # update package list
sudo apt install python3-pip # install software
sudo chmod 777 /var/www/html # change permissions on system folders
When you use it: Installing software, changing system files, or running anything that requires admin access.
⚠️ Only use
sudowhen you actually need it. Running everything as sudo is a security risk.
Process Management
15. ps aux — View Running Processes
What it does: Shows all currently running processes on the system.
ps aux # show all processes
ps aux | grep python # find all running Python processes
ps aux | grep streamlit # check if your Streamlit app is running
The | (pipe) sends the output of ps aux directly into grep — so you only see processes matching "python".
When you use it: When a script seems stuck and you need to find its process ID to stop it.
16. kill — Stop a Running Process
What it does: Stops a running process using its process ID (PID).
kill 1234 # politely ask process 1234 to stop
kill -9 1234 # force stop process 1234 immediately
To find the PID, use ps aux | grep python first, then note the number in the second column.
When you use it: When a program freezes or a server won't stop with Ctrl+C.
Networking
17. ping — Test Network Connection
What it does: Checks if a server or website is reachable from your machine.
ping google.com # test internet connection
ping 192.168.1.1 # test connection to your router
ping -c 4 google.com # send exactly 4 packets then stop
When you use it: First step when diagnosing network problems. "Is the server down or is my internet down?"
18. curl — Transfer Data from URLs
What it does: Downloads content from a URL or sends HTTP requests.
curl https://example.com # get the HTML of a webpage
curl -O https://example.com/file.zip # download a file
curl -X POST https://api.example.com/data -d '{"key":"value"}' # send a POST request
When you use it: Testing your own APIs, downloading files, or checking if a web server is responding. Essential for backend development and cybersecurity testing.
Package Management
19. apt — Install and Manage Software (Ubuntu/Debian)
What it does: Installs, updates, and removes software packages.
sudo apt update # refresh the list of available packages
sudo apt upgrade # upgrade all installed packages
sudo apt install python3-pip # install a specific package
sudo apt install git # install git
sudo apt remove package-name # uninstall a package
Always run sudo apt update before installing anything — this ensures you get the latest version.
When you use it: Installing any tool or software on a Linux system.
20. history — View Command History
What it does: Shows a numbered list of all commands you have previously run.
history # show all previous commands
history | grep git # find all git commands you've run
history | tail -20 # show the last 20 commands
!42 # re-run command number 42 from history
!! # re-run the last command
When you use it: When you ran a command earlier and want to run it again but can't remember exactly what you typed. Also useful for finding commands you use often.
Bonus — 3 Shortcuts That Save Time Every Day
These are not commands but keyboard shortcuts that will make your terminal life significantly faster:
| Shortcut | What it does |
|---|---|
Ctrl + C |
Cancel the current running command immediately |
Ctrl + Z |
Pause the current process and send it to background |
Tab |
Auto-complete file names and commands — press once to complete, twice to see options |
↑ arrow |
Cycle through previous commands — faster than retyping |
Ctrl + L |
Clear the screen (same as clear) |
The Tab key is the single most underused feature in the terminal. Get in the habit of pressing Tab after typing the first few letters of any file name — it completes the rest automatically.
Quick Reference — All 20 Commands
| # | Command | What it does |
|---|---|---|
| 1 | pwd |
Show current location |
| 2 | ls -la |
List all files with details |
| 3 | cd |
Change directory |
| 4 | mkdir -p |
Create folders |
| 5 | clear |
Clear terminal screen |
| 6 | touch |
Create empty file |
| 7 | cp -r |
Copy files and folders |
| 8 | mv |
Move or rename |
| 9 | rm -r |
Delete files and folders |
| 10 | cat |
Read file contents |
| 11 | grep -r |
Search inside files |
| 12 | find |
Find files by name |
| 13 | chmod |
Change permissions |
| 14 | sudo |
Run as administrator |
| 15 | ps aux |
View running processes |
| 16 | kill |
Stop a process |
| 17 | ping |
Test network connection |
| 18 | curl |
Transfer data from URLs |
| 19 | apt |
Install software |
| 20 | history |
View command history |
Try It Yourself — Challenge
Open your terminal right now and try this sequence:
mkdir linux-practice
cd linux-practice
touch hello.py
echo "print('Hello from Linux!')" > hello.py
cat hello.py
python3 hello.py
ls -la
cd ..
rm -r linux-practice
This uses 7 commands from this article in one go. If everything ran without errors — you are already comfortable with the Linux terminal.
What to Learn Next
These 20 commands are your foundation. Once you are comfortable with them, explore:
| Topic | What it covers |
|---|---|
| Bash scripting | Automate tasks by writing shell scripts |
| File permissions in depth | Understanding rwx and chmod numbers fully |
| SSH | Connect to remote servers securely |
| Vim / Nano | Edit files directly in the terminal |
| Cron jobs | Schedule commands to run automatically |
| Networking tools |
netstat, nmap, traceroute for deeper network analysis |
Summary — What You Learned Today
- ✅ 5 navigation commands — move around the file system confidently
- ✅ 5 file operation commands — create, copy, move, delete files
- ✅ 2 search commands — find files and search inside them
- ✅ 2 permission commands — control who can access your files
- ✅ 2 process commands — see and stop running programs
- ✅ 2 networking commands — test connections and talk to servers
- ✅ 1 package manager — install software properly
- ✅ 1 history command — never retype a long command again
- ✅ 5 keyboard shortcuts — work faster every day
All Code on GitHub
The terminal practice script from this article is in my GitHub:
📌 GitHub Repository:
https://github.com/prakashgangurde-ux/linux-notes
Let's Connect
If this article helped you, please clap on Medium — it helps other students find it.
Drop any question in the comments — I read and reply to every one.
- LinkedIn: linkedin.com/in/prakash-gangurde
- GitHub: github.com/prakashgangurde-ux
- Medium: medium.com/@gangurdeprakash
Next article: **How I Built an AI-Powered Network Intrusion Detection System as a BCA Student**
Written by Prakash Gangurde — BCA Student | Technical Content Creator | AI • Python • Linux



Top comments (0)