Linux Basics: 50 Important Commands for Beginners
Learn Linux: 50 Key Commands Every Beginner Should Know

Hi everyone! I’m learning Linux as part of my DevOps journey, and I want to share what I’ve picked up. Linux is used in tons of servers and DevOps tools, so knowing how to use the terminal is super important. This blog is for beginners like me who want to learn the most common Linux commands. These are the commands I use a lot while working on Ubuntu, but they work on most Linux systems. Let’s get started!
Why Use the Terminal?
The terminal can feel scary at first, but it’s just a way to give your computer instructions. It’s fast and powerful, especially for DevOps tasks like managing servers or automating stuff. Below, I’ve listed 50 commonly used commands with examples to help you navigate, manage files, check system info, and more.
50 Essential Linux Commands
1. pwd - Show Current Location
What it does: Tells you the full path of the folder you’re in.
Example:
pwd
Output: /home/user/docs
This shows you’re in the docs folder.
2. ls - List Files and Folders
What it does: Shows all files and folders in the current directory.
Example:
ls
Output: file.txt folder1 folder2
Use ls -l for details or ls -a to see hidden files.
3. cd - Change Directory
What it does: Moves you to another folder.
Example:
cd docs
Moves to the docs folder. Use cd .. to go up one level or cd to go home.
4. mkdir - Create a Folder
What it does: Makes a new folder.
Example:
mkdir my_folder
Creates a folder named my_folder.
5. touch - Create a File
What it does: Creates an empty file.
Example:
touch note.txt
Creates an empty file named note.txt.
6. cat - View File Contents
What it does: Shows the contents of a file.
Example:
cat note.txt
Output: Hello, this is a note!
7. cp - Copy Files/Folders
What it does: Copies files or folders.
Example:
cp note.txt note_copy.txt
Copies note.txt to note_copy.txt. Use cp -r for folders.
8. mv - Move or Rename Files/Folders
What it does: Moves or renames files/folders.
Example:
mv note.txt docs/note.txt
Moves note.txt to the docs folder.
To rename:
mv note.txt new_note.txt
9. rm - Delete Files/Folders
What it does: Deletes files or folders.
Example:
rm note.txt
Deletes note.txt. Use rm -r for folders.
10. man - Show Command Help
What it does: Displays the manual for a command.
Example:
man ls
Shows the help page for ls.
11. echo - Print Text
What it does: Prints text to the terminal.
Example:
echo "Hello"
Output: Hello
12. nano - Edit Files
What it does: Opens a simple text editor.
Example:
nano note.txt
Opens note.txt for editing.
13. vim - Advanced Text Editor
What it does: Opens a powerful text editor.
Example:
vim note.txt
Opens note.txt. Press i to edit, :wq to save and quit.
14. clear - Clear Terminal
What it does: Clears the terminal screen.
Example:
clear
Clears all previous output.
15. whoami - Show Current User
What it does: Shows your username.
Example:
whoami
Output: user
16. uname - System Info
What it does: Shows system information.
Example:
uname -a
Output: Linux ubuntu 5.15.0-73-generic...
17. df - Check Disk Space
What it does: Shows disk usage.
Example:
df -h
Output: Shows disk space in human-readable format.
18. du - Check Folder Size
What it does: Shows the size of files/folders.
Example:
du -h docs
Shows the size of the docs folder.
19. free - Check Memory
What it does: Shows memory usage.
Example:
free -h
Shows RAM usage in a readable format.
20. top - Monitor Processes
What it does: Shows running processes and system usage.
Example:
top
Displays a live view of processes. Press q to quit.
21. ps - List Processes
What it does: Shows current processes.
Example:
ps aux
Lists all running processes.
22. kill - Stop a Process
What it does: Stops a process by its ID (PID).
Example:
kill 1234
Stops the process with PID 1234.
23. chmod - Change Permissions
What it does: Changes file/folder permissions.
Example:
chmod 755 script.sh
Gives execute permission to script.sh.
24. chown - Change Owner
What it does: Changes file/folder ownership.
Example:
chown user note.txt
Changes the owner of note.txt to user.
25. find - Search for Files
What it does: Finds files by name or type.
Example:
find /home -name note.txt
Finds note.txt in the /home directory.
26. grep - Search in Files
What it does: Searches for text inside files.
Example:
grep "error" log.txt
Finds lines with “error” in log.txt.
27. wc - Count Words/Lines
What it does: Counts lines, words, or characters.
Example:
wc -l note.txt
Shows the number of lines in note.txt.
28. sort - Sort Lines
What it does: Sorts lines in a file.
Example:
sort names.txt
Sorts the lines in names.txt.
29. uniq - Remove Duplicates
What it does: Removes duplicate lines from a sorted file.
Example:
uniq names.txt
Removes duplicates from names.txt.
30. cut - Extract Columns
What it does: Extracts specific columns from a file.
Example:
cut -d',' -f1 data.csv
Extracts the first column from a CSV file.
31. tee - Write to File and Terminal
What it does: Writes output to a file and the terminal.
Example:
echo "test" | tee output.txt
Writes “test” to output.txt and shows it.
32. ln - Create Links
What it does: Creates hard or symbolic links.
Example:
ln -s note.txt link.txt
Creates a symbolic link to note.txt.
33. tar - Archive Files
What it does: Creates or extracts tar archives.
Example:
tar -cvf archive.tar docs
Creates archive.tar from the docs folder.
34. gzip - Compress Files
What it does: Compresses files.
Example:
gzip file.txt
Compresses file.txt to file.txt.gz.
35. gunzip - Decompress Files
What it does: Decompresses .gz files.
Example:
gunzip file.txt.gz
Decompresses file.txt.gz.
36. wget - Download Files
What it does: Downloads files from the web.
Example:
wget http://example.com/file.txt
Downloads file.txt.
37. curl - Transfer Data
What it does: Fetches data from URLs.
Example:
curl http://example.com
Displays the content of example.com.
38. ping - Check Connectivity
What it does: Tests network connectivity.
Example:
ping google.com
Pings google.com.
39. netstat - Network Stats
What it does: Shows network connections.
Example:
netstat -tuln
Lists open ports.
40. ifconfig - Network Config
What it does: Shows network interface info.
Example:
ifconfig
Displays network details.
41. date - Show Date/Time
What it does: Displays the current date and time.
Example:
date
Output: Mon Apr 28 12:00:00 2025
42. cal - Show Calendar
What it does: Displays a calendar.
Example:
cal
Shows the current month’s calendar.
43. uptime - System Uptime
What it does: Shows how long the system has been running.
Example:
uptime
Output: 12:00:00 up 1 day, 2:30
44. history - Show Command History
What it does: Lists previously used commands.
Example:
history
Shows your command history.
45. alias - Create Shortcuts
What it does: Creates shortcuts for commands.
Example:
alias ll='ls -l'
Now ll runs ls -l.
46. env - Show Environment Variables
What it does: Lists environment variables.
Example:
env
Shows all variables like PATH.
47. export - Set Environment Variable
What it does: Sets an environment variable.
Example:
export MY_VAR="value"
Sets MY_VAR to value.
48. sudo - Run as Admin
What it does: Runs a command with admin privileges.
Example:
sudo apt update
Updates package lists with admin rights.
49. apt - Package Manager (Ubuntu)
What it does: Manages software packages.
Example:
sudo apt install vim
Installs vim.
50. shutdown - Power Off
What it does: Shuts down the system.
Example:
sudo shutdown now
Shuts down immediately.
Wrapping Up
These 50 commands are super helpful for getting started with Linux. I’m using them a lot on my Ubuntu system, and they’re making the terminal feel less scary. Next, I’m excited to try scripting to automate things more on that soon!
If you’re new, give these commands a go and share your progress on LinkedIn. Drop a comment if you have other commands you love!
