How do I close a file that I created using cat > command?

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?

3

2 Answers

Press Control-D.

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.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like