how do I edit a file as root ?

Asked by Terry Anderson

I have messed up the /etc/apt/sources.list file and as a consequence I cannot open synaptic or adept. How can I edit it as root so that I have all permissions to change and save the file ?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu firefox Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Xosé (ubuntu-galizaweb) said :
#1

From the command line, type sudo pico /etc/apt/sources.list
It will ask for your root password (your own password, actually)

Revision history for this message
Terry Anderson (tgpfx) said :
#2

Many thanks, I did this - deleted the offending line, but there doesn't seem to be a way to SAVE the modified file and it reverts back

Revision history for this message
Dean Sas (dsas) said :
#3

I can't tell you how to save files in pico but if you want to edit the file (and save it) in a more easy to use manner try gksudo gedit /etc/apt/sources.list

Revision history for this message
PingunZ (pingunz-deactivatedaccount) said :
#4

On gnome do :
gksudo gedit /etc/apt/sources.list
On Kde do :
gksudo kate /etc/apt/sources.list

I suggest you have a look at http://www.ubuntulinux.nl/source-o-matic

Can you help with this problem?

Provide an answer of your own, or ask Terry Anderson for more information if necessary.

To post a message you must log in.