Save data to txt file in Terminal

I want to write serial data from the Arduino to a text file and I am trying by entering the following command in a Terminal window: cat /dev/cu.usbmodem1421 >> test1.txt

Unfortunately it does not work. But when I ignore the file description and just input the following command: cat /dev/cu.usbmodem1421

The data can be displayed on terminal but it cannot be saved. Is there anything wrong with my command? By the way I referenced the following link to type the command: http://montessorimuddle.org/2014/07/26/datalogging-with-the-arduino/

I use 'RealTerm' to save txt data from the Arduino.

.

I see but my laptop is MAC, thank you~

In http://forum.arduino.cc/index.php?topic=420366.msg2895136#msg2895136 I already suggested CoolTerm. You might at least confirm that you have tried it, or can't be bothered to. I understand macs are somewhat limited in their options to do proper work, but they can't be totally useless for such a simple job. Perhaps Google might help.

You have to ioctl the baud rate and so forth if reading from a USB serial device.

Try using

screen /dev/cu.usbmodem1421 115200

(or whatever baud rate you want), then quit screen (cntl-A K??). This typically leaves the device setup correctly, then you can cat.

You probably had random settings which is why it sometimes worked?

I have solved the problem. I forget to direct the correct directory. Thank you all~

Nick_Pyner: In http://forum.arduino.cc/index.php?topic=420366.msg2895136#msg2895136 I already suggested CoolTerm. You might at least confirm that you have tried it, or can't be bothered to. I understand macs are somewhat limited in their options to do proper work, but they can't be totally useless for such a simple job. Perhaps Google might help.

I have tried the CoolTerm and it works except a little fussy. So I want to have a more tidy method. Thank you very much.

MarkT: You have to ioctl the baud rate and so forth if reading from a USB serial device.

Try using

screen /dev/cu.usbmodem1421 115200

(or whatever baud rate you want), then quit screen (cntl-A K??). This typically leaves the device setup correctly, then you can cat.

You probably had random settings which is why it sometimes worked?

Thank you I will try to set up the speed as 9600. I think it may be more stable than 115200