LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2007, 12:15 PM   #1
frisky24
LQ Newbie
 
Registered: Jul 2007
Posts: 3

Rep: Reputation: 0
Unhappy edit files in terminal


hey all ive just reinstalled ubuntu 7.04 and am trying to remember how i edited files with the terminal

before i enterd sudo something and it let me browse the files in terminal window and also edit the files .. does anyone know how to do this ?

what was the code ?
 
Old 07-11-2007, 12:32 PM   #2
BrianGriffin
LQ Newbie
 
Registered: Aug 2005
Distribution: OpenSuSE 10.2
Posts: 7

Rep: Reputation: 0
There are lots of text editors: vi (or vim), emacs, nano, pico to name but a few...

vi/vim is a bit tricky to begin with but very powerful once you're familiar with it. But nano & pico are a bit more intuitive.

Code:
sudo nano your_file
or just

Code:
nano your_file
if you don't need superuser privileges to read/write the file in question.

Substitute "nano" for any of the other editors mentioned above to try them out.

Enjoy!
 
Old 07-11-2007, 12:36 PM   #3
frisky24
LQ Newbie
 
Registered: Jul 2007
Posts: 3

Original Poster
Rep: Reputation: 0
no thats not it .. it actually let you browse folders and you could see the file icons .. it looked like you where in root and could view all files

does anyone know the code i mean :?
 
Old 07-11-2007, 12:38 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Midnight Commander? Run "mc" in the terminal.
 
Old 07-11-2007, 01:08 PM   #5
Tomermory
Member
 
Registered: Mar 2007
Location: Amiens, France
Distribution: Debian Etch,
Posts: 181

Rep: Reputation: 30
Could you have been logged on a root (sorry, sudo in Ubuntu!) session? Normally, you can't edit files in the way you describe, but it's possible to create a root user session in the following way (from memory so it might not be 100% correct): system-->Administration-->User and Groups. Then you have to tick a box somewhere which says something like enable local administrator. Once this is done, log out and in the user field write sudo and put your password in the password field. When you start a new session you will be root in X. But be careful!!!This is generally not advised, and to be honest, you really need to get the hang of negotiating your way round without being in X - Linux isn't Windows, after all!

Cheers

James
 
Old 07-11-2007, 01:14 PM   #6
Hern_28
Member
 
Registered: Mar 2007
Location: North Carolina
Distribution: Slackware 12.0, Gentoo, LFS, Debian, Kubuntu.
Posts: 906

Rep: Reputation: 38
Root session.

You don't have to create it if memory serves, just enable it.
 
Old 07-11-2007, 01:31 PM   #7
Tomermory
Member
 
Registered: Mar 2007
Location: Amiens, France
Distribution: Debian Etch,
Posts: 181

Rep: Reputation: 30
I forgot to add that you must log out of root as soon as you have done your editing. It may seem obvious, but one false move....
 
Old 07-11-2007, 02:41 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
You can call any GUI editor or file manager from the terminal. To have root privileges, us su or sudo when calling.

eg to get the Nautilus file manager:
sudo nautilus

To edit a file with gedit:
sudo gedit filename
 
Old 07-11-2007, 04:12 PM   #9
Tomermory
Member
 
Registered: Mar 2007
Location: Amiens, France
Distribution: Debian Etch,
Posts: 181

Rep: Reputation: 30
Quote:
You can call any GUI editor or file manager from the terminal.
I can't get that to work in Debian. When I try, this is what I get:


Code:
debian:/home/james# nautilus
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


(nautilus:4437): Gtk-WARNING **: cannot open display:
debian:/home/james# konqueror
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
 
Old 07-11-2007, 04:17 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You do have X windows running? You can use kdesu or the gnome equivalent to start a gui editor. You can also do this if you are connecting remotely using "ssh -X". On some disto's things are set up so this isn't neccesary, on other's root doesn't get permission to use a regular users display. There may also be an "sux" program that is like "su" but permits launching GUI type programs.

Be careful what you do as root inside your regular session. If you end up with some files in your regular user's ~/.kde or ~/.gnome or a session folder in /tmp having root permissions, that could cause a problem later on. Because they can't be overwritten or deleted as the normal user.

Last edited by jschiwal; 07-11-2007 at 04:50 PM.
 
Old 07-12-2007, 07:59 AM   #11
UK MAdMaN
Member
 
Registered: Jul 2004
Location: Manchester, England
Distribution: Gentoo
Posts: 211

Rep: Reputation: 30
Quote:
Originally Posted by jschiwal
Be careful what you do as root inside your regular session. If you end up with some files in your regular user's ~/.kde or ~/.gnome or a session folder in /tmp having root permissions, that could cause a problem later on. Because they can't be overwritten or deleted as the normal user.
You can use "su -" to change to the root user and run its .bash_profile. Should remove any chance of it saving files to an ordinary user's home directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit/change IP information in the terminal? kitek Linux - Newbie 8 04-02-2007 08:24 AM
Fedora Core 4, Right Click Desktop, Open Terminal edit prt7u Fedora 1 03-09-2006 02:13 PM
edit quotes from konsole terminal trinoo Slackware 6 02-02-2005 10:26 AM
Edit files help flira Linux - Newbie 2 05-27-2004 10:31 PM


All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration