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

A very wide used command line program that prints out the contents of a file on a terminal. Chances are pretty high cat is installed on your system already.

Example: If you're navigating to the folder of a git repository in your terminal and quickly want to see what the readme says without having to open a file manager or going to the website on github/gitlab/codeberg you can run:

  cat README.md
  
Which shows the text stored in that file directly in your terminal window.

bat does essentially the same, only fancier, with syntax highlighting, some formatting and colors.



It doesn't do that actually. It concatenates files. From the description on the man page:

    Concatenate FILE(s) to standard output.

    With no FILE, or when FILE is -, read standard input
https://man7.org/linux/man-pages/man1/cat.1.html


Yeah sure, that is what happens when you feed your cat multiple files.

Cat in 99% of the usage cases is used on one file


No. What is stated by the manual is what cat does. What you said was simply incorrect.

It does have the effect of what you describe if one file is supplied and might be the most common use case. That doesn't make your description correct, at best it makes it incomplete.




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

Search: