The tag has no wiki summary.

learn more… | top users | synonyms

111
votes
4answers
17k views

/usr/bin vs /usr/local/bin on Linux

Why are there so many places to put a binary in Linux? There are atleast these five: /bin/ /sbin/ /usr/bin/ /usr/local/bin/ /usr/local/sbin/ And on my office box, I do not have write permissions ...
13
votes
3answers
14k views

How to find binary executables within a directory

How do I list all binary executable files recursively within a directory? I use find command like this: find /mydir/mysubdir -executable -type f All executable files are listed (excluding ...
12
votes
5answers
14k views

Shell: How to read the bytes of a binary file and print as hexadecimal?

In shell, how can I read the bytes of a binary file I have, and print the output as hexadecimal numbers?
10
votes
1answer
7k views

how to convert a shell script into binary executable?

I want to convert my shell scripts into binary executable so that nobody else could edit or read it.Is there any way to convert it into binary executable?
8
votes
3answers
6k views

convert a hex string to binary and send with netcat

I have a binary file that I can send with netcat: $ nc -l localhost 8181 < my.dat The file contains this: $ xxd my.dat 0000000: 0006 3030 3030 4e43 ..0000NC What I really ...
8
votes
2answers
7k 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
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 ...
8
votes
1answer
939 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 ...
8
votes
5answers
7k views

Binary to hexadecimal and decimal in a shell script

I have a context where I need to convert binary to hexadecimal and decimal and viceversa in a shell script. Can someone suggest me a tool for this?
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? ...
7
votes
1answer
440 views

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?
7
votes
1answer
4k views

Passing binary data to curl without using a @file

Is it possible to use curl and post binary data without passing in a file name? For example, you can post a form using binary via --data-binary: curl -X POST --data-binary @myfile.bin http://foo.com ...
7
votes
2answers
645 views

How could I use Bash to find 2 bytes in a binary file, increase their values, and replace?

I'm trying to find two bytes inside binary file, then increase value of those two bytes and replace them inside file. Those two bytes are on positions 0x82-0x83. For now on I have successfully ...
7
votes
1answer
151 views

A shell-like environment for binary processing

This question came to me a couple of times before, now in response to the question Loop through binary data chunks from stdin in Bash Answers given in ...
6
votes
2answers
260 views

In an empty environment, how are executables found?

For experimentation purposes I created a binary that prints the $PATH, and calls which as follows: #include <stdlib.h> #include <stdio.h> int main() { char *path = getenv("PATH"); ...
6
votes
2answers
292 views

Is it possible to keep a FreeBSD system up to date (base system + packages) using only binaries?

I have been using Debian and NetBSD systems for a long time, and I have got used to do binaries upgrades for the base system and for packages (using pkgin with NetBSD) Now the NetBSD kernel does not ...
5
votes
2answers
647 views

What is produced after using cat on an image?

Let's say one creates a file like so: touch myFile You enter some text in it with vim or whatever, and then use cat myFile to spit the contents out into the terminal. Now, what happens when I use ...
5
votes
1answer
1k views

Fix terminal after displaying a binary file

I'd tried command cat with an executable file: cat /bin/ls Now I can't read any word in this terminal (Linux console). How can I fix it?
5
votes
2answers
89 views

Get “Text Content” of Files

I was wondering if there is a tool to scrape text content of a file. Basically I would like to put in a pdf, word document, compressed file or anything else and get the text it contains out. There ...
5
votes
1answer
323 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 ...
5
votes
1answer
88 views

Merge nonzero blocks of huge (sparse) file A into huge file B

I have two partial disk images from a failing hard drive. File B contains the bulk of the disk's contents, with gaps where sector reads failed. File A is the result of telling ddrescue to retry all ...
5
votes
1answer
2k views

Are there alternatives for `dd`?

What other tools should I use to read and write files with truncation, seeking and skipping. dd's command line options seem inconvenient and foreign and I don't like choosing between slow, but precise ...
4
votes
3answers
934 views

Mystery of binary files

This is about files straight from the compiler, say g++, and the -o (outfile) flag. If they are binary, shouldn't they just be a bunch of 0's and 1's? When you cat them, you get unintelligible ...
4
votes
4answers
2k views

Ubuntu vs. CentOS and Binary Compatibility

I am trying to install software that is built on CentOS 4.7. Do you know if it will also run in Ubuntu? I read CentOS is 100% binary compatible. Is the same true for the most recent version of Ubuntu? ...
4
votes
2answers
908 views

Is there a way to find files containing only non-printing characters?

I've got a program that's behaving badly and has created a number of files with only a few non-printing characters. If I were to cat the files, I see nothing (since they are non-printing chars). ...
4
votes
2answers
89 views

Convert file with integers written in ascii to binary file of integers

I have a file that contains a long list of integers written in ascii separated with newlines, like such: -175 2 -19345 345592 -45 2355 etc... I want to convert this file into a "binary" file ...
4
votes
2answers
590 views

Cannot execute binary - No such file or directory

I tried to install the current oracle jre on a VM running NixOS. Now the following happens: [michas@cc:~]$ tar xvzf jre-7u40-linux-x64.tar.gz |grep bin/java jre1.7.0_40/bin/javaws ...
4
votes
2answers
7k views

executing binary file: file not found

I know there are similar questions out there, but I haven't found a solution nor this exact case. The binary was built on Arch Linux using its GCC 4.7. The package works fine on the build system. The ...
4
votes
1answer
158 views

Linux from Binaries

I thought Linux from Scratch was a pretty cool tutorial, but I felt having to wait for everything to compile was a bit nerve-wreaking. Is there a tutorial similar to LFS except pre-compiled binaries ...
4
votes
1answer
2k views

How to follow (a la “tail -f”) a binary file from the beginning?

Is it possible to follow a binary file from the beginning, a la tail -f? This is useful in some cases, for example if I'm scping a file to a remote server, and at the same time I want to feed it to ...
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 ...
3
votes
3answers
613 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] ...
3
votes
2answers
4k views

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 ...
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? ...
3
votes
2answers
144 views

Make ls distinguish scripts from binaries in output

Is it possible to make ls distinguish executable scripts from actual compiled binaries? The permissions are most often the same (+x), and with ls -F you get an asterisk suffix (*) for both, so it's ...
3
votes
2answers
1k views

how to find offset of one binary file inside another?

I have two binary files. One of few hundreds kilos and other of few gigabytes. I want to know whether the whole, smaller, file is contained within the larger one and if so then what is the offset from ...
3
votes
1answer
405 views

Does research unix have any binary editor?

I cannot find any binary editor in v7 unix by reading volumn 1 of the manual. Is there any?
3
votes
1answer
36 views

Is there a way to “stabilize” past built unstable Gentoo binary packages without rebuilding?

Here's the scenario: build some ~amd64 package versions on your binhost later those same package versions go stable in portage, so no version bumps involved even if packages are listed stable in ...
3
votes
0answers
639 views

In emacs, is there a way to Hex edit/view a buffer without losing the undo info?

When I use hexl-mode in emacs, it discards the buffer's undo info. Is there another way to hex-edit the buffer and yet retain the undo info? If there is no alternative hex-editor, is there a ...
2
votes
2answers
231 views

dowload find binary , accidentally deleted /usr/bin/find binary file

I accidentally deleted all some binaries by rm -r f*, when my current directory was /usr/bin/ . So i couldn't install any files including findutils, since 'find' binary is the prerequisite for ...
2
votes
2answers
48 views

How to add new elements to PATH for daemons (or other best practices)?

I want to add some scripts for custom administrative work to a Linux server (Ubuntu 12.04). Ultimately those scripts are callback scripts from at least one daemon (PostgreSQL in my case but that ...
2
votes
2answers
103 views

What is PATH on a Mac OS?

What is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is ...
2
votes
3answers
991 views

Pasting binary data into a Unicode terminal

I need to be able to paste binary data into a terminal. For some reason, every byte outside the ASCII range (0x80-0xff) is pasted as the same three byte sequence 0xef 0xbf 0xbd. For example: $ echo ...
2
votes
2answers
98 views

tr complains of “Illegal byte sequence”

I'm brand new to UNIX and I am using Kirk McElhearn's "The Mac OS X Command Line" to teach myself some commands. I am attempting to use tr and grep so that I can search for text strings in a regular ...
2
votes
1answer
53 views

md5sum command binary and text mode

The GNU md5sum command has two modes: binary mode and text mode. I guess the difference is only on how newline characters are handled? Am I right? On GNU/Linux, the two modes always produce same ...
2
votes
1answer
227 views

Modifying a set of binary files

I have several binary files with the character 0x04 in them, and I'd like to add an escape \ character before each. Is there a script I can use to do this without needing to manually edit each one?
2
votes
1answer
2k views

How to enter non-ascii characters using hex or octal codes in vi

I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text. I know this can easily be ...
2
votes
1answer
822 views

skype not found on Oneiric 64, but it is right there [duplicate]

Possible Duplicate: Can't execute some binaries in chroot environment (zsh: Not found) I have something weird here. Cannot find a file although it is right there. $ skype command not ...
2
votes
2answers
113 views

How to add an audio file to a shell script

How can I add an audio file (OGG vorbis) into a shell script making the script as small as possible and at the same time being able to execute it on as most systems as possible? I want the audio file ...
1
vote
1answer
894 views

remove carriage return character from large binary file

I have a large binary file ( nearly binary file ! ) which has many \r\n in it [ gets Generated in windows env and doesnt have controle over generating application ]. I want to remove \r from this ...