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.
1. ls - List Directory Contents
The ls command is used to list directory contents.
Syntax:
ls [options] [directory]
Example:
ls Desktop/
Listing content inside Desktop directory
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/
changing directory
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
displaying the current directory
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
creaking directory
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
removing 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] [source] [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] [source] [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
creating text file
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
displaying text inside text fileThis 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
editing text file
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
searching pattern inside the text file
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
updating package manager
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
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
displaying 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
list all running process
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
displaying dynamic information
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
display disk space
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.
Similar Reads
Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power
13 min read
Polymorphism in Java Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca
7 min read
Linux Commands Cheat Sheet Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous W
13 min read
CTE in SQL In SQL, a Common Table Expression (CTE) is an essential tool for simplifying complex queries and making them more readable. By defining temporary result sets that can be referenced multiple times, a CTE in SQL allows developers to break down complicated logic into manageable parts. CTEs help with hi
6 min read
What is Vacuum Circuit Breaker? A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac
13 min read
Linux/Unix Tutorial Linux is one of the most widely used open-source operating systems. It's fast, secure, stable, and powers everything from smartphones and servers to cloud platforms and IoT devices. Linux is especially popular among developers, system administrators, and DevOps professionals.Linux is:A Unix-like OS
10 min read