![]() |
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 ContentsThe 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 DirectoryThe 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 DirectoryThe 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 DirectoryThe 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 – RemoveThe 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 – CopyThe 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 – MoveThe 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 FileThe 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 DisplayThe cat command is used to display the contents of a file. Syntax: cat [file] Example: cat newfile.txt ![]() displaying text inside text file This command displays the contents of newfile.txt. 10. nano – Text EditorThe 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 – SearchThe 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 DoThe 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 ManagerThe 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 ManagerThe 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 – DownloadThe 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 ModeThe 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 OwnerThe 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 ArchiveThe 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 InformationThe 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 TimeThe 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 SystemThe 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 StatusThe 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 ActivityThe 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 UsageThe 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 FreeThe 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. ConclusionThese 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. |
Reffered: https://www.geeksforgeeks.org
Linux Unix |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |