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

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