1
vote
1answer
32 views

How could i flip content of a binary file with bash commands

I was wondering if it's possible to do bitwise conversion on a binary file, with bash commands, (in my case bitwise negation).
5
votes
1answer
304 views

Loop through binary data chunks from stdin in Bash

I'm looking for something like while IFS= read -r -n $length str; do ... done but for binary data. Is it possible to do this using dd or other tools? Is there some technique to make these tools able ...
1
vote
2answers
1k views

Can xxd be used to output the binary representation of hex number , not a string?

I would like to generate a raw binary packet from hex in the command line for the purpose of testing a protocol. I'm hoping its simpler to do it this way than writing an aplication. Here is what ...
8
votes
1answer
907 views

How to store an image file in bash variable?

After I use the following command, pngString="$(cat example.png)" echo -n "$pngString" > tmp.png I can't open the tmp.png as a PNG file. Maybe some information is lost when I use $pngString ...
3
votes
4answers
162 views

Bash: For loop with binary range keeping control value binary

Let's say I have two bash variables that contain binary values: a=0011 # decimal 3 b=1000 # decimal 8 Is there a way I can loop through all the possible values between $a and $b keeping it binary? ...
8
votes
3answers
2k views

ASCII binary tools?

Which is a good tool to convert ASCII to binary, and binary to ASCII? I was hoping for something like: $ echo --binary "This is a binary message" 01010100 01101000 01101001 01110011 00100000 ...
4
votes
2answers
107 views

Is adding ./bin a bad idea

I can't think of any reason why adding ./bin to my PATH environment would be a very bad idea. I usually create bin folders in my projects that I am working in and I hate doing bin/command, it would ...
1
vote
3answers
145 views

Is there a way to determine when a binary was compiled or installed?

Is there a way to determine when a binary was compiled or installed? For example, I have a binary mdrun_d, and I would like to know when this particular binary was compiled or installed. The system ...
3
votes
3answers
609 views

Is it a script or is it a binary?

At the end, it looks like it's just a regular sh script: [USER@MACHINE ~/Desktop/D] head -2 truecrypt-7.1-setup-x86 #!/bin/sh CHECKSUM=163123652 but @the scripts end: [USER@MACHINE ~/Desktop/D] ...
8
votes
2answers
6k views

How can I handle raw binary data in a bash pipe?

I have a bash function that takes a file as a parameter, verifies the file exists, then writes anything coming off stdin to the file. The naive solution works fine for text, but I am having problems ...
8
votes
3answers
15k views

How to use bash script to read binary file content?

I want to read a character and then a fixed length of string (the string is not null terminated in the file, and its length is given by the preceding character). How can I do this in a bash script? ...