Questions tagged [od]

37 questions
79
votes
2 answers

Output from ls has newlines but displays on a single line. Why?

I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line. Can anyone explain this to me? I had always…
theconnorpower
  • 1,009
  • 1
  • 7
  • 8
15
votes
3 answers

Convert binary mode to text mode and the reverse option

I converted a simple binary file into a text file with: od –t x1 Check.tar | cut –c8- > Check.txt Which gives a content similar to: 64 65 76 2f 6e 75 6c 6c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] What is…
maihabunash
  • 6,973
  • 19
  • 64
  • 80
14
votes
2 answers

How to interpret an octal or hex dump of a binary file?

The binary file has strings and some numbers, If I do od -c filename or strings filename, I can see the strings properly. But, what about numbers? They are in some weird format. The text after doing od -c filename is like this: 0000000 036 \0 032…
user14039
14
votes
2 answers

Can hd and od replace each other?

hd and od are both dump viewers of binary content. Can hd be used wherever od is and vice versa?
Tim
  • 98,580
  • 191
  • 570
  • 977
13
votes
1 answer

Removing line numbers from `od`'s output

Is there any flag to od to make it not output line numbers in the result?
Ram Rachum
  • 1,795
  • 2
  • 15
  • 18
12
votes
7 answers

get numeric ASCII value for a character

I'm trying to write a shell script which asks for an ASCII character in the range A-Z or a-z and returns its equivalent numerical value. For example, the output might look like the following: scarlet$ Please type a character between A and Z or…
Host Post
  • 207
  • 3
  • 4
  • 7
8
votes
2 answers

What is the difference between the od, hd, hexdump and xxd commands?

What is the difference between the od, hd, hexdump and xxd commands ? They are all commands for dumping files and they can all dump it in various formats such as hexadecimal, octal or binary. Why creating different programs ?
Nicryc
  • 285
  • 4
  • 11
7
votes
2 answers

Octals 302 240 together seem to correspond to non-breaking space

By looking at a particular line of a text file (say, the 1123th, see below), it seems that there is a non-breaking space, but I am not sure: $ cat myfile.csv | sed -n 1123p | cut -f2 Lisztes feher $ cat myfile.csv | sed -n 1123p | cut -f2 | od -An…
tflutre
  • 205
  • 1
  • 2
  • 4
6
votes
3 answers

How to change the default line length for od and hexdump

Is there any way to change the default line length for the od and hexdump commands? Can't see anything apropriate in the man pages.
newenglander
  • 593
  • 2
  • 5
  • 7
5
votes
3 answers

Explanation for the meaning of content of the /var/run/utmp file

I would like to understand the content of the following file system /var/run/utmp. When I use the command od to open it I see the following: [john@iceman ~]$ od -c /var/run/utmp 0000000 002 \0 \0 \0 \0 \0 \0 \0 ~ \0 \0 \0 \0 \0 \0 …
user308606
5
votes
1 answer

Interpreting octal dump without options

$ echo "hello" | od 0000000 062550 066154 005157 0000006 I know that the first column represents the byte offset. But I don't see how the other numbers are formed. According to man the above should be "octal bytes". However the option -b is…
user2820379
  • 330
  • 2
  • 10
4
votes
2 answers

How is the octal 2-byte output calculated from od

I'm struggling to work out what the octal 2-byte output from the od command is. I understand the octal output (-b flag) but the octal 2-byte is a mystery to me (-o) Can someone shed some light on how the -o result is calculated from ASCII? Here is…
theconnorpower
  • 1,009
  • 1
  • 7
  • 8
4
votes
1 answer

od emulation for directories

I was wondering why od(1) used to work in UNIX but doesn't work in GNU/Linux. There is a nice answer on serverfault. The next question is, are you aware of any tools that can emulate od behavior to support dumping directory data in GNU/Linux?
sakisk
  • 2,863
  • 21
  • 18
4
votes
3 answers

Portable one-byte per line hex dump

Suppose we want a minimalist one-byte per line ASCII hex dump. Under Linux using GNU od, this works: echo foo | od -An -tx1 -w1 -v Output: 66 6f 6f 0a But that won't work with BSD derivatives, because the BSD od util has different…
agc
  • 7,045
  • 3
  • 23
  • 53
3
votes
2 answers

What are those numbers on the left of od output?

I checked the od man page, but it does not explain this. What do the numbers on the left column of the od output mean?
revelt
  • 135
  • 6
1
2 3