terminal-logo-small

I write before guide, howto create file on Linux shell / command line without text editor (with cat command) and this is guick tip howto display / show file contents (tabs, line-breaks, non-printing characters (ASCII control characters: octal 000 – 037)) and display all on Linux shell / command line. This is very useful when you want to know the entire contents of the file.

Example file

I use /tmp/testing.txt example file on this guide. File is created simply with following command:

printf 'testing\012\011\011testing\014\010\012more testing\012\011\000\013\000even more testing\012\011\011\011\012' > /tmp/testing.txt

Show / Display File Contents on Linux Shell / Command Line

Show file content (without tabs, line breaks, non-printing characters)

cat /tmp/testing.txt

Output:

testing
		testing

more testing
	
        even more testing
			

Show file content with tabs (without line breaks and non-printing characters)

cat -T /tmp/testing.txt

Tabs are printed as ^I

Output:

testing
^I^Itesting

more testing
^I
  even more testing
^I^I^I

Show file content with line breaks (without tabs and non-printing characters)

cat -E /tmp/testing.txt

Line breaks are printed as $

Output:

testing$
		testing
                      $
more testing$
	
        even more testing$
			$

Show file content with non-printing characters (without tabs and line breaks)

cat -v /tmp/testing.txt

Non-printing characters are printed as ^ or M- plus 100 to 137 ascii character

Output:

testing
		testing^L^H
more testing
	^@^K^@even more testing
			

Show file content with tabs, line breaks and non-printing characters

cat -A /tmp/testing.txt

Tabs are printed as ^I, Line breaks are printed as $ and Non-printing characters are printed as ^ or M- plus 100 to 137 ascii character

Output:

testing$
^I^Itesting^L^H$
more testing$
^I^@^K^@even more testing$
^I^I^I$