Skip to content

Latest commit

 

History

History
381 lines (267 loc) · 4.53 KB

File metadata and controls

381 lines (267 loc) · 4.53 KB

Ubuntu Command Guide

This guide covers the 40 most used commands on Ubuntu, categorized into different sections for easier navigation.

Table of Contents

  1. System Information
  2. File Management
  3. Directory Navigation
  4. File Viewing and Editing
  5. Package Management
  6. User Management
  7. Network Management
  8. Process Management
  9. Disk Management
  10. Permission Management
  11. Compression and Archiving

System Information

1. uname

Displays system information.

uname -a

2. hostname

Shows or sets the system's hostname.

hostname

3. uptime

Shows how long the system has been running.

uptime

4. top

Displays system tasks and resource usage.

top

5. htop

An improved version of top.

htop

6. free

Displays memory usage.

free -h

File Management

7. ls

Lists directory contents.

ls -l

8. cp

Copies files and directories.

cp source.txt destination.txt

9. mv

Moves or renames files and directories.

mv oldname.txt newname.txt

10. rm

Removes files or directories.

rm filename.txt
rm -r directory/

11. touch

Creates an empty file or updates the timestamp.

touch newfile.txt

Directory Navigation

12. cd

Changes the current directory.

cd /path/to/directory

13. pwd

Prints the current working directory.

pwd

14. mkdir

Creates a new directory.

mkdir new_directory

15. rmdir

Removes an empty directory.

rmdir empty_directory

File Viewing and Editing

16. cat

Concatenates and displays file content.

cat file.txt

17. less

Views file content one page at a time.

less file.txt

18. more

Views file content, similar to less.

more file.txt

19. nano

A simple text editor.

nano file.txt

20. vim

A powerful text editor.

vim file.txt

Package Management

21. apt-get

Installs, updates, and removes packages.

sudo apt-get update
sudo apt-get install package_name

22. apt-cache

Searches for packages.

apt-cache search package_name

23. dpkg

Manages individual Debian packages.

sudo dpkg -i package.deb
sudo dpkg -r package_name

User Management

24. adduser

Adds a new user.

sudo adduser username

25. usermod

Modifies user information.

sudo usermod -aG groupname username

26. passwd

Changes user password.

passwd username

27. deluser

Deletes a user.

sudo deluser username

Network Management

28. ifconfig

Displays or configures network interfaces.

ifconfig

29. ping

Tests network connectivity.

ping google.com

30. netstat

Displays network connections, routing tables, and more.

netstat -tuln

31. wget

Downloads files from the internet.

wget http://example.com/file.zip

32. curl

Transfers data from or to a server.

curl http://example.com

Process Management

33. ps

Displays currently running processes.

ps aux

34. kill

Terminates a process.

kill process_id

35. pkill

Terminates processes by name.

pkill process_name

36. jobs

Lists background jobs.

jobs

37. bg

Resumes a job in the background.

bg job_id

38. fg

Brings a background job to the foreground.

fg job_id

Disk Management

39. df

Displays disk space usage.

df -h

40. du

Displays file and directory disk usage.

du -sh /path/to/directory

Permission Management

41. chmod

Changes file permissions.

chmod 755 filename.txt

42. chown

Changes file owner and group.

chown user:group filename.txt

Compression and Archiving

43. tar

Archives files.

tar -cvf archive.tar file1 file2
tar -xvf archive.tar

44. gzip

Compresses files.

gzip filename.txt
gunzip filename.txt.gz

45. zip

Compresses files into a ZIP archive.

zip archive.zip file1 file2
unzip archive.zip