Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Don't forget to pipe head into 'cat -v'... that text file could contain _anything_!


I really recommend folks use "less" over cat, especially keyboard oriented folks. Different terminal emulators don't always have the scroll behavior I want, not do they always allow me to search the file I'm looking at. "less" does all those things, in nearly every environment no matter the terminal emulator, and has other wonderful options to boot (chop long lines so they don't wrap can be nice for logs, line numbers can be VITAL, etc).

I still uselessly use cat though, it's such a nice way to build a pipeline.


I hate that when I use `less`, then quit, the output goes away.


You can run "less -X" for that, but it may have other problems depending on how you use less (e.g. scrolling up, etc.)


My useless cat is that I always use `cat file | less` when I could just `less file`.

I've been typing cat for over 25 years. Old habits die hard.


Thank you for pointing this out! This is much safer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: