$ ls -ld TOPs
-rw-r--r--. 1 jdoe jdoe 9571 Oct 18 12:58 TOPs
$ ls -ldh TOPs
-rw-r--r--. 1 jdoe jdoe 9.4K Oct 18 12:58 TOPs
Viewing file content material
The cat, head, tail, extra and much less instructions assist you to view the content material of textual content information. The cat command shows your entire file whereas head and tail show the primary and final traces (defaulting to 10). The instructions under show solely three traces.
$ head -3 TZs
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
$ tail -3 TZs
W-SU
WET
Zulu
The extra command will present you a screenful of traces at a time or fewer when you add an choice (e.g., extra -10). Each the extra and much less instructions assist you to again up whereas viewing file content material, however much less backs up a line at a time whereas extra backs up a display at a time.
Utilizing the nl command
If you wish to view the traces in a textual content file in a numbered format, you should utilize the nl command. Right here’s an instance of utilizing nl together with head to see solely the primary three traces of the output.
$ nl TZs | head -3
1 Africa/Abidjan
2 Africa/Accra
3 Africa/Addis_Ababa
Viewing different kinds of information
To view the content material of information apart from textual content information whereas engaged on the command line, you should utilize the od -bc command, but it surely’s going to point out you the content material within the octal and character (the place accessible) codecs proven under. The “E L F” within the output under is brief for “executable and linkable format”. This format is used for storing binaries, libraries, core dumps and such.
$ od -bc /usr/bin/extra | head -4
0000000 177 105 114 106 002 001 001 000 000 000 000 000 000 000 000 000
177 E L F 002 001 001
0000020 003 000 076 000 001 000 000 000 040 070 000 000 000 000 000 000
003 > 001 8
The JFIF sequence within the instance under identifies the file as being in jpeg format.
$ od -bc hummingbird.jpg | head -6
0000000 377 330 377 340 000 020 112 106 111 106 000 001 001 001 000 110
377 330 377 340 020 J F I F 001 001 001 H
0000020 000 110 000 000 377 341 032 130 105 170 151 146 000 000 111 111