1. Home
  2. Computing & Technology
  3. Linux

From Authors, About.com Guest

dump). Display contents as octal numbers. This can be useful when the output contains non-printable characters. For example, a filename may contain non-printable characters and be a real pain. This can also be handy to view binary files.

Examples:

dir | od -c | more

(I would probably rather do: ls -b to see any non-printable characters in filenames).

cat my_file | od -c |more

od my_file |more

Comparison of different outputs:

Show 16 first characters from a binary (/bin/sh) as ASCII characters or backslash escapes (octal):

od -N 16 -c /bin/sh

output:

0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0

Show the same binary as named ASCII characters:

od -N 16 -a /bin/sh

output:

0000000 del E L F soh soh soh nul nul nul nul nul nul nul nul nul

Show the same binary as short hexcadecimals:

od -N 16 -t x1 /bin/sh

output:

0000000 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

Show the same binary as octal numbers:

od -N 16 /bin/sh

output:

0000000 042577 043114 000401 000001 000000 000000 000000 000000


wc

(=word count) Print the number of lines, words, and bytes in the file.

Examples:

dir | wc

cat my_file | wc

wc myfile


cksum filename

Compute the CRC (="cyclic redundancy check") for file filename to verify its integrity.


md5sum filename

Compute a md5 checksum (128-bit) for file filename to verify its integrity.


mkpasswd -l 10

Make a hard-to-guess, random password of the length of 10 characters.


sort -f filename

Arrange the lines in filename according to the ascii order. The option -f tells sort to ignore the upper and lower character case. The ascii character set is (see man ascii):

Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Char

---------------------------------------------------------------------------

0 00 NUL '\0' 32 20 SPACE 64 40 @ 96 60 '

1 01 SOH 33 21 ! 65 41 A 97 61 a

2 02 STX 34 22 " 66 42 B 98 62 b

3 03 ETX 35 23 # 67 43 C 99 63 c

4 04 EOT 36 24 $ 68 44 D 100 64 d

5 05 ENQ 37 25 % 69 45 E 101 65 e

6 06 ACK 38 26 & 70 46 F 102 66 f

7 07 BEL '\a' 39 27 ' 71 47 G 103 67 g

8 08 BS '\b' 40 28 ( 72 48 H 104 68 h

9 09 HT '\t' 41 29 ) 73 49 I 105 69 i

10 0A LF '\n' 42 2A * 74 4A J 106 6A j

11 0B VT '\v' 43 2B + 75 4B K 107 6B k

12 0C FF '\f' 44 2C , 76 4C L 108 6C l

13 0D CR '\r' 45 2D - 77 4D M 109 6D m

14 0E SO 46 2E . 78 4E N 110 6E n

15 0F SI 47 2F / 79 4F O 111 6F o

16 10 DLE 48 30 0 80 50 P 112 70 p

17 11 DC1 49 31 1 81 51 Q 113 71 q

18 12 DC2 50 32 2 82 52 R 114 72 r

19 13 DC3 51 33 3 83 53 S 115 73 s

20 14 DC4 52 34 4 84 54 T 116 74 t

21 15 NAK 53 35 5 85 55 U 117 75 u

22 16 SYN 54 36 6 86 56 V 118 76 v

23 17 ETB 55 37 7 87 57 W 119 77 w

24 18 CAN 56 38 8 88 58 X 120 78 x

25 19 EM 57 39 9 89 59 Y 121 79 y

26 1A SUB 58 3A : 90 5A Z 122 7A z

27 1B ESC

Explore Linux
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Linux

©2009 About.com, a part of The New York Times Company.

All rights reserved.