Download your favorite Linux distribution at LQ ISO.
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 02-11-2012, 06:39 PM   #1
LQ Newbie
Registered: Feb 2012
Posts: 13

Rep: Reputation: Disabled
Smile How ctrl-d works in ed editor ??

Normal steps to create a text file using ' ed ' :

$ ed
w myfile

Then, I use ctrl-d to test how ed reacts to that command :

$ ed
w myfile1

After hitting enter down to the line (*), I entered ctrl-d twice. Then typed . to stop adding text, and hello appeared on the next line. I don't understand why ???

Another case is when I entered ctrl-d 6 times after getting to the line (*), then the ed process stopped without having to enter the sequence " . -> w -> q "
$ ed
ctrl-d (press this ctrl-d 6 times)
$ (the prompt appears here)

Can anyone please help me to explain those 2 questions? Thanks a lot.
Old 02-12-2012, 01:42 AM   #2
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
Another ed user? Well, that makes at least two of us.

Most of your question is answered by this: ed has no idea why you are sending it the end-of-transmission character. If you do it enough, ed eventually prints it's error symbol, the question mark. Which, in ed-speak, is roughly translated as, "What the heck is going on?!?" Send enough EOT characters and it will eventually guit.

In your first question, the '.' has nothing to do with ctrl-d, but simply designates the current line in the buffer (usually the last line you appended). Use the '.' as a command by itself (after you've finished appending material) and it will print said line.

BTW, ed does have a manual page...


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
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 09:23 AM
how ctrl+c works to terminate a process rithik_ghoshal Linux - General 2 11-02-2008 08:01 AM
how does ctrl+c works with SIGINT in redhat linux saikasavar Linux - General 1 07-16-2007 04:09 AM
ctrl+alt+F? no longer works seanr Linux - Software 6 10-04-2005 05:31 PM
Turbo C and C++ works on Linux and if so which compiler and editor is available. benoy4007 Red Hat 2 08-14-2004 08:13 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:35 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