The cat utility reads files to the standard output. The file arguments are processed in command-line order. If the file arguments is a single dash (`-‘) or absent, cat reads from the standard input.
$ cat ~/Projects/sampleproject/.config.yml markdown: kramdown highlighter: rouge permalink: /:year/:title/ exclude: ["package.json","README.md"] gems: - jekyll-redirect-from - jekyll-paginate - jekyll-gist
This can be very useful when hunting odd programming bugs by using some additional options.
cat -e will display non-printing characters and
cat -v will display
all control characters. Suppose that you have some odd unicode
non-breaking spaces in a text? This can be great to help expose them.
In this case, we see the end of each line shown with the dollar character.
$ cat -e _config.yml aboutPage: true$ $ markdown: kramdown$ highlighter: rouge$ permalink: /:year/:title/$ exclude: ["package.json","README.md"]$ $ paginate: 20$
For this example, we’re going to create a file with a bell character in it. There are times when this character is useful, printing it to STDOUT will cause your terminal to make a bell sound. It can be very handy to print at the end of a long running command. However, if you were to be capturing that output to a file, you might end up with a non-printing character in your file.
$ echo -en "\007A bell character lives here." > control-characters.txt $ cat control-characters.txt A bell character lives here. $ cat -v control-characters.txt ^GA bell character lives here.
Note that when you cat the file the first time, you’ll hear the bell.
The second time with the
-v option set, you’ll see the bell displayed
^G. This indicates that the control-G