To open the folder as root in the grapical file manager, run the following command:
gksu nautilus /etc/apt/
If you wish to do your operations from the command line, the following command enters the intended directory and makes you root. However, you would be better off using the first method above.
Nah ! do a simple thing first. Create a custom file manager. Its easy.
Here how you can do it:
First open gedit and paste all these:
[Desktop Entry]
Name=Nautilus
Comment=Browse the filesystem with administrator rights
Exec=gksudo nautilus
Icon=file-manager
Terminal=false
Type=Application
Categories=Application;System;
Now save the file as Nautilus.desktop on your desktop.
(desktop is the file extension).
Now Open:
/home/your user name/.local/share/applications
and cut/paste Nautilus.desktop file into there.
Now open dash and search for "Nautilus". It will open up the default file manager with root permission. Now you can navigate to any directory and delete anything you want.
To open the folder as root in the grapical file manager, run the following command:
If you wish to do your operations from the command line, the following command enters the intended directory and makes you root. However, you would be better off using the first method above.
To install Open-as-Administrator in Ubuntu open Terminal (Press Ctrl+Alt+T) and copy the following commands in the terminal:
After installation type this command to restart Nautilus:
nautilus -q
Reboot
Ubuntu 16.04
Then
Nah ! do a simple thing first. Create a custom file manager. Its easy.
Here how you can do it:
First open gedit and paste all these:
Now save the file as Nautilus.desktop on your desktop.
(desktop is the file extension).
Now Open:
and cut/paste Nautilus.desktop file into there.
Now open dash and search for "Nautilus". It will open up the default file manager with root permission. Now you can navigate to any directory and delete anything you want.
Ubuntu 16.04 and above
Then
Open Nautilus and you'll see an option Open as Administrator option in the context menu of every directory.
Just use
or any other file explorer of your choice.
See Also What is the difference between “gksudo nautilus” and “sudo nautilus”?
In a Terminal you can use:
Note: If you prefer to use Graphical Software you should use
gksudo
in Gnome:or
kdesudo
in KDE:Enter your user password (not root) and you will edit file as root