Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I learning how to use git on a Mac and I'm trying to add a file in one of my branches by using the "cat > " command. The problem I'm having is that I want to end editing the file in the terminal but I do not know how to close it. I'm guessing that I need to change "modes" for lack of a better term. How do I proceed?

share|improve this question

migrated from Oct 11 '10 at 23:13

This question came from our site for professional and enthusiast programmers.

cat is not a text editor! Are you trying to be a masochist? – Lie Ryan Oct 11 '10 at 22:57

Press Control-D.

share|improve this answer

Type Ctrl+D at the start of a new line. ^D is the "end of file" character when typed from a keyboard.

Note that the ^D character itself is not entered into the file. The file ends just before the point where you type ^D.

share|improve this answer
The Enter shouldn't be pressed on Unix-based systems (though MacOS might be an exception?); this isn't DOS where you have to press Enter after ^Z. You may need to press ^D a second time if you aren't already at the start of the line, though. – Chris Jester-Young Oct 11 '10 at 22:53
Indeed. Why did I think you needed to press Enter? Fixed, thanks. – Greg Hewgill Oct 11 '10 at 22:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .