Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

More specifically the

/etc/apt/

folder. I need to delete some files and replace

/etc/apt/sources.list

with a newer version.

share|improve this question
add comment

5 Answers 5

up vote 9 down vote accepted

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.

cd /etc/apt; sudo -i
share|improve this answer
    
Thanks! That worked fine! I used the GUI version and deleted the two (very old) backup files. –  Klikini Apr 21 '12 at 19:13
    
sudo -i is less typing and cleaner environmental variables ubuntuforums.org/showpost.php?p=6188826&postcount=4 –  bodhi.zazen Apr 22 '12 at 4:54
    
I disagree with SirCharlo that first method is better than using command line. Command line is way more powerfull. –  OrangeTux Apr 22 '12 at 12:50
add comment

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.

share|improve this answer
add comment

in terminal you can use:

sudo -e /etc/apt/sources.list

for example:
sudo -e /etc/apt/sources.list

Note if you prefer to use graphical software you should use gksudo in Gnome:

gksudo gedit /etc/apt/sources.list

or kdesudo in KDE:

kdesudo kate /etc/apt/sources.list

Enter your user password (not root) and you will edit file as root

share|improve this answer
1  
or just sudo -e sudo -e /etc/apt/sources.list –  bodhi.zazen Apr 22 '12 at 4:55
    
@bodhi.zazen thank you, smart option ... you are free to edit my answer for creating difference sudo -e <YourTextEditor> /etc/apt/sources.list –  swift Apr 22 '12 at 9:42
add comment

Just use

sudo nautilus

or any other file explorer of your choice.

share|improve this answer
    
..it's better to launch graphical application, with root privilege, using gksu that sudo... –  rusty Jan 27 at 9:57
add comment

To install Open-as-Administrator in Ubuntu open Terminal (Press Ctrl+Alt+T) and copy the following commands in the terminal:

sudo add-apt-repository ppa:noobslab/apps

sudo apt-get update

sudo apt-get install open-as-administrator

After installation type this command to restart Nautilus:

nautilus -q

Reboot

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.