View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-02-2004, 09:05 PM   #1
LQ Newbie
Registered: Sep 2004
Posts: 15

Rep: Reputation: 0
Editing text file in Shell - Konsole (SuSE 9.1)

I am trying to edit a text file through the shell console and i open it by typing "vi {filename} push i to inster text then i dont know how to save it. When i close the shell and open it again, the file is still what it used to be. Help please.

Old 10-02-2004, 09:12 PM   #2
Senior Member
Registered: May 2004
Location: Belgium
Distribution: Debian, Slackware, Fedora
Posts: 1,271

Rep: Reputation: 191Reputation: 191
Start as root.
#vi filneame
press "Insert" for edit mode
edit what you like
press "Esc" lo leave "Edit mode"
type :wq! and press "Enter" to save and quit...

Last edited by jens; 10-02-2004 at 09:18 PM.
Old 10-02-2004, 09:27 PM   #3
LQ Newbie
Registered: Sep 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Score, thanks!
Old 10-03-2004, 07:40 AM   #4
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Just so you know, vi is an incredibly powervul text editor. You may want to check this out:
vi Tutorial
Old 10-03-2004, 11:59 AM   #5
Senior Member
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,842

Rep: Reputation: 48
Check out "pico filename.txt"
Common options are listed plainly at the bottom of the screen (CTRL plus the named key).
Midnight Commander ("mc") is also a nice way to navigate and edit files. Options using the function keys are listed.
To edit system files you would still need to switch user ("su") to root.
Old 10-03-2004, 12:48 PM   #6
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.7, Centos 5.10
Posts: 16,916

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
To exit and save in vi/vim:
:x <enter>
1 members found this post helpful.


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
NEED AWNSER QUICK how do I save editing a text file in Konsole? DDRfreak2 Mandriva 1 08-18-2005 07:09 PM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 08:15 PM
Editing text file for import to a spread/database Franklin Programming 7 03-31-2004 07:31 AM
Some techniques for text file editing ganninu Programming 17 10-09-2003 06:34 PM
Editing a text file in shell Lotmr Linux - Software 5 06-24-2003 01:12 PM

All times are GMT -5. The time now is 05:30 PM.

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