In Mac how do I signal end of file (EOF) on the shell

8,080
  1. cat > filename
  2. you press CTRL + D and that is EOF
Share:
8,080
anjanbacchu
Author by

anjanbacchu

Updated on September 18, 2022

Comments

  • anjanbacchu
    anjanbacchu over 1 year

    IN windows, I press F6 function key to introduce the CTRL + Z character that signals the end of file.

    c:\> copy con filename
    

    copies the command line input to the given filename. At the end, after pressing text, I will enter the F6 key which introduces the CTRL + Z(EOF) character.

    1) what is the equivalent command to copy the command line input to a given file ?

    2) what key introduces the end of file character in the above command ?

  • pqnet
    pqnet over 9 years
    note: CTRL+D works only in a new line, after pressing ENTER
  • pqnet
    pqnet over 9 years
    also, cat > filename works in windows command shell too
  • Daniel B
    Daniel B over 9 years
    It also works without LF, just press it twice. Same as Linux, really.
  • Pikachu
    Pikachu almost 4 years
    @pqnet OP has asked about MAC not PC. ctrl does not even exist on mac. And also this key combination command + d does not work on mac.
  • pqnet
    pqnet almost 4 years
    @Pikachu mac keyboard has CTRL. It is on the left of alt, which is on the left of command. Press ctrl + D, as I said, not cmd + D because that splits the terminal screen