Why Learn Ubuntu Commands?
While Ubuntu offers a graphical interface, the terminal provides greater control, speed, and automation. Learning basic commands empowers you to troubleshoot, customize, and optimize your system beyond the limitations of graphical tools.
Getting Started with the Terminal
To open the terminal in Ubuntu, press Ctrl + Alt + T or search for "Terminal" in the applications menu.
Basic Navigation Commands
1. Viewing the Current Directory
pwd
Displays the present working directory.
2. Listing Files and Directories
ls
Lists files and folders in the current directory. Use ls -l for detailed information.
3. Changing Directories
cd /path/to/directory
Navigates to the specified directory. Use cd ~ to go to your home directory.
File and Directory Management
4. Creating a Directory
mkdir new_folder
Creates a new directory named new_folder.
5. Creating an Empty File
touch filename.txt
Creates a new, empty file named filename.txt.
6. Copying Files and Directories
cp source.txt destination.txt
Copies source.txt to destination.txt. Use cp -r folder1 folder2 to copy directories recursively.
7. Moving and Renaming Files
mv oldname.txt newname.txt
Moves or renames a file or directory.
8. Deleting Files and Directories
rm file.txt
Deletes a file. Use rm -r folder to remove a directory and its contents.
Viewing and Editing Files
9. Displaying File Contents
cat filename.txt
Shows the contents of a file.
10. Editing Files with Nano
nano filename.txt
Opens the file in the Nano text editor. Press Ctrl + X to exit, Y to save changes.
System Information and Management
11. Checking Disk Usage
df -h
Displays disk space usage in a human-readable format.
12. Checking Memory Usage
free -h
Shows available and used memory.
13. Viewing Running Processes
top
Displays active processes and system resource usage.
Installing and Managing Software
14. Updating Package Lists
sudo apt update
Refreshes the list of available packages and their versions.
15. Upgrading Installed Packages
sudo apt upgrade
Upgrades all installed packages to their latest versions.
16. Installing New Software
sudo apt install package-name
Installs the specified package.
17. Removing Software
sudo apt remove package-name
Uninstalls the specified package.
Getting Help
18. Manual Pages
man command
Displays the manual for a command. Press q to quit.
Conclusion: Empower Your Ubuntu Experience
Mastering these basic Ubuntu commands will help you navigate and manage your system with confidence. The command line is a powerful tool that opens up endless possibilities for customization and efficiency. Start practicing these commands today and unlock the full potential of Ubuntu!