Linux - 25 basic Linux commands for beginners
1. pwd
Prints the current working directory
pwd
Example output: /home/student
2. ls
Lists files and directories
ls
Add -l
for detailed view or -a
to show hidden files:
ls -la
3. cd
Changes the current directory
cd foldername
cd ..
cd ..
goes one step back.
4. mkdir
Makes a new directory (folder)
mkdir myfolder
5. rmdir
Removes an empty directory
rmdir myfolder
6. rm
Removes files or folders
rm file.txt
rm -r foldername
-r
means "recursive" (for folders).
7. touch
Creates a new empty file
touch newfile.txt
8. cp
Copies files or folders
cp file.txt backup.txt
cp -r folder1/ folder2/
9. mv
Moves or renames files and folders
mv oldname.txt newname.txt
mv file.txt folder/
10. cat
Displays contents of a file
cat file.txt
11. echo
Prints text or writes to a file
echo "Hello, world"
echo "text" > file.txt
12. nano
Opens a basic text editor in terminal
nano file.txt
13. clear
Clears the terminal screen
clear
14. history
Shows all previously used commands
history
15. man
Displays manual/help for a command
man ls
Use q
to quit the manual.
16. chmod
Changes file permissions
chmod +x script.sh
17. chown
Changes file ownership
sudo chown username file.txt
18. sudo
Runs a command as an administrator
sudo apt update
19. apt
Installs or manages software (for Debian/Ubuntu systems)
sudo apt install program-name
sudo apt update
sudo apt upgrade
20. ps
Shows running processes
ps
ps aux
21. kill
Stops a running process
kill processID
22. top
Shows real-time system processes (like Task Manager)
top
Press q
to quit.
23. df
Shows disk space usage
df -h
24. du
Shows folder/file sizes
du -sh foldername
25. uname
Shows system information
uname -a