Cat on Mac Os X Never Exits

I'm a bit of a UNIX noob, but I'm trying to run the cat command to make a simple text file and it works great, however cat is never exited after making the file. For instance, I type cat > ~/mytextfile.txt and hit enter, the file is created but my cursor remains on a blank line.

3

3 Answers

You're telling cat to send nothing to a file. Use touch (as mentioned) instead.

You have to send an EOF (^D) character on the standard input to tell cat to stop.

3

In my MAC I need to send EOF (^D) twice.

Example:

cat > /tmp/mypassword
RandomLettersAndNumbers123

Then press FN + Control + D twice.

Your Answer

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

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest