0

For some reason cat no longer shows line breaks when I use it, while all other tools (grep, more etc) do.

I am using iterm2 on OSX 10.11.4.

What could be causing this behaviour?

Example

I have a file test.txtcreated in vim:

this is a test
this is a test
this is a test

When I do cat test.txt the output is (note space in place of newline):

this is a test this is a test this is a test
0
2

These things can occur based on a whole bunch of small issues, either in the shell used, the terminal application used, the file format or something else altogether.

To triage, the following steps may be useful

  • run cat -vet test.txt to see whether there are additional characters in the file
  • run (echo a; echo b)|cat to see if it depending on the input data
  • switch terminal applications to see if this is the cause
  • run bash --noprofile to see whether something is lurking in the shell configuration

In my case someone had modified 'cat' behaviour in .bashrc

1
  • There is some cause other than these. I have the same problem and they don't tell me anything. – John Smith Dec 15 '20 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .