BASIC COMMANDS OF UNIX/UBUNTU
1. ls – List files:
ls [options] [directory]
ls -l
2. pwd – Show current directory:
pwd
3. cd – Change directory
cd [directory]
cd Documents
4. mkdir – Create directory
mkdir [directory name]
mkdir project
5. rmdir – Remove empty directory
rmdir [directory name]
rmdir testfolder
6. rm – Delete file
rm [options] file_name
rm [Link]
7. cp – Copy file
cp [options] source destination
cp [Link] [Link]
8. mv – Move / Rename
mv [options] source destination
mv [Link] [Link]
9. touch – Create empty file
touch file_name
touch [Link]
10. cat – Display file content
cat [options] file_name
cat [Link]
VIEWING AND EDITING-
11. more – View file page by page
more file_name
more [Link]
12. less – Scrollable file viewer
less file_name
less [Link]
13. head – First 10 lines
head [options] file_name
head -5 [Link]
14. tail – Last 10 lines
tail [options] file_name
tail -5 [Link]
15. nano – Open file in nano editor
nano file_name
nano [Link]
16. vi – Open file in vi editor
vi file_name
vi [Link]
17. find – Find file
find path -name file_name
find /home -name [Link]
18. grep- Search text inside a file.
grep "pattern" file_name
grep "hello" [Link]
19. locate- find file quickly
locate file_name
locate [Link]
20. which – Show command path
which command_name
which python
SYSTEM AND PROCESS
21. ps – Displays currently running processes
ps [options]
ps aux
22. top- shows live running processes and system usage.
Top
23. kill – Terminates a process using Process ID
kill process_ID
kill 1234
24. df – Displays disk space usage
df [options]
df -h
25. du – Shows disk usage of files/directories
du [options] directory_name
du -sh folder
26. free – Displays memory (RAM) usage
free [options]
free -h
27. uname – Shows system information
uname [options]
uname -a
28. who – Displays logged-in users
who
29. chmod – Changes file permissions
chmod permissions file_name
chmod 777 [Link]
30. ping – Checks network connectivity
ping host_name
ping [Link]