Here are some common examples of using sudo:
-
Update package list:
sudo apt update -
Install a package:
sudo apt install package-name -
Remove a package:
sudo apt remove package-name -
Edit a system configuration file using a text editor (e.g., nano):
sudo nano /etc/hosts -
Restart a service:
sudo systemctl restart service-name -
Change ownership of a file:
sudo chown user:group filename -
Create a directory in a restricted location:
sudo mkdir /restricted-directory
These commands require administrative privileges and will execute with elevated permissions when prefixed with sudo.
