25 basic Ubuntu Commands
Ubuntu is one of the most popular distributions of Linux, known for its user-friendly interface and robust features. Whether youβre a beginner or an experienced user, understanding basic Ubuntu commands is essential for navigating and managing your system efficiently. In this article, weβll explore 25 fundamental Ubuntu commands along with detailed descriptions, syntax, examples, and explanations.
25 basic Ubuntu Commands
- 1. ls β List Directory Contents
- 2. cd β Change Directory
- 3. pwd β Print Working Directory
- 4. mkdir β Make Directory
- 5. rm β Remove
- 6. cp β Copy
- 7. mv β Move
- 8. touch β Create Empty File
- 9. cat β Concatenate and Display
- 10. nano β Text Editor
- 11. grep β Search
- 12. sudo β Superuser Do
- 13. apt-get β Package Manager
- 14. dpkg β Package Manager
- 16. chmod β Change Mode
- 17. chown β Change Owner
- 18. tar β Tape Archive
- 19. uname β Print System Information
- 20. date β Display Date and Time
- 21. shutdown β Shutdown or Restart System
- 22. ps β Process Status
- 23. top β Display System Activity
- 24. du β Disk Usage
- 25. df β Disk Free
1. ls β List Directory Contents
The ls command is used to list directory contents.
Syntax:
ls [options] [directory]
Example:
ls Desktop/
This command lists the contents of the Desktop directory.
2. cd β Change Directory
The cd command is used to change the current working directory.
Syntax:
cd [directory]
The cd command is used to change the current working directory.
Example:
cd Desktop/
This command changes the current directory to Desktop/. Here we have used pwd command to display the current directory.
3. pwd β Print Working Directory
The pwd command displays the current working directory.
Syntax:
pwd
Example:
pwd
This command prints the current working directory.
4. mkdir β Make Directory
The mkdir command is used to create a new directory.
Syntax:
mkdir [directory_name]
Example:
mkdir new_folder
This command creates a new directory named new_folder. Here we have used ls command to display the files in the current directory.
5. rm β Remove
The rm command is used to remove files or directories.
Syntax:
rm [options] [file/directory]
Example:
rm new_file
This command removes the file named new_file. Here we have used ls command to display the files in the current directory.
6. cp β Copy
The cp command is used to copy files or directories.
Syntax:
cp [options] [destination]
Example:
cp file1.txt file2.txt
This command copies file1.txt to file2.txt.
7. mv β Move
The mv command is used to move files or directories.
Syntax:
mv [options] [destination]
Example:
mv file1.txt /path/to/new/location
This command moves file1.txt to /path/to/new/location.
8. touch β Create Empty File
The touch command is used to create an empty file.
Syntax:
touch [file_name]
Example:
touch newfile.txt
This command creates an empty file named newfile.txt. Here we have used ls command to display the files in the current directory.
9. cat β Concatenate and Display
The cat command is used to display the contents of a file.
Syntax:
cat [file]
Example:
cat newfile.txt
This command displays the contents of newfile.txt.
10. nano β Text Editor
The nano command launches the Nano text editor.
Syntax:
nano [file_name]
Example:
nano newfile.txt
This command opens newfile.txt in the Nano text editor.
11. grep β Search
The grep command is used to search for patterns in files.
Syntax:
grep [options] [pattern] [file]
Example:
grep "pattern" file.txt
This command searches for the specified pattern in file.txt.
12. sudo β Superuser Do
The sudo command allows users to execute commands with superuser privileges.
Syntax:
sudo [command]
Example:
sudo apt-get update
This command updates the package lists using apt-get with superuser privileges.
13. apt-get β Package Manager
The apt-get command is used to manage software packages.
Syntax:
sudo apt-get [options] [command]
Example:
sudo apt-get install package_name
This command installs a package named package_name.
14. dpkg β Package Manager
The dpkg command is used to install, remove, and manage Debian packages.
Syntax:
sudo dpkg [options] [command]
Example:
sudo dpkg -i package.deb
This command installs a Debian package named package.deb.
15. wget β Download
The wget command is used to download files from the internet.
Syntax:
wget [URL]
Example:
wget http://example.com/file.zip
This command downloads a file named file.zip from the specified URL.
16. chmod β Change Mode
The chmod command is used to change file permissions.
Syntax:
chmod [options] [mode] [file]
Example:
chmod 755 file.sh
This command changes the permissions of file.sh to 755.
17. chown β Change Owner
The chown command is used to change file ownership.
Syntax:
chown [options] [owner:group] [file]
Example:
chown user:group file.txt
This command changes the owner and group of file.txt.
18. tar β Tape Archive
The tar command is used to create and extract tar archives.
Syntax:
tar [options] [archive_name.tar.gz] [files/directories]
Example:
tar -cvzf archive.tar.gz directory
This command creates a compressed tar archive named archive.tar.gz from the directory
19. uname β Print System Information
The uname command prints system information such as kernel version and architecture.
Syntax:
uname [options]
Example:
uname -a
This command displays all available system information.
20. date β Display Date and Time
The date command displays the current date and time.
Syntax:
date [options]
Example:
date
This command prints the current date and time.
21. shutdown β Shutdown or Restart System
The shutdown command is used to shut down or restart the system.
Syntax:
sudo shutdown [options]
Example:
sudo shutdown -h now
This command shuts down the system immediately.
22. ps β Process Status
The ps command displays information about active processes.
Syntax:
ps [options]
Example:
ps aux
This command lists all running processes.
23. top β Display System Activity
The top command displays real-time information about system activity.
Syntax:
top
Example:
top
This command displays dynamic information about system processes.
24. du β Disk Usage
The du command is used to estimate file and directory space usage.
Syntax:
du [options] [directory]
Example:
du -sh /path/to/directory
This command displays the disk usage of the specified directory.
25. df β Disk Free
The df command displays disk space usage for filesystems.
Syntax:
df [options]
Example:
df -h
This command displays disk space usage in a human-readable format.
Conclusion
These 25 basic Ubuntu commands provide a solid foundation for navigating and managing your Linux system effectively. As you continue to explore Ubuntu and Linux, youβll discover more commands and techniques to streamline your workflow and enhance your productivity. Experiment with these commands in your terminal to become more proficient in using Ubuntu.
Contact Us