Questions tagged [binary]

307 questions
670
votes
5 answers

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

Why are there so many places to put a binary in Linux? There are at least these five: /bin/ /sbin/ /usr/bin/ /usr/local/bin/ /usr/local/sbin/ And on my office box, I do not have write permissions to some of these. What type of binary goes into…
Lazer
  • 34,477
  • 25
  • 70
  • 75
196
votes
5 answers

grep returns "Binary file (standard input) matches" when trying to find a string pattern in file

I'm on Ubuntu and I typed cat .bash_history | grep git and it returned Binary file (standard input) matches My bash_history does exist and there are many lines in it that starts with git. What caused it to display this error and how can I fix it?
answerSeeker
  • 2,297
  • 3
  • 14
  • 16
169
votes
9 answers

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?
lotusirous
  • 3,609
  • 5
  • 17
  • 11
100
votes
11 answers

How to view a binary file?

From what I understand, a compiler makes a binary file that consists of 1's and 0's that a CPU can read. I have a binary file but how do I open it to see the 1's and 0's that are there? A text editor says it can't open it... P.S. I have an assembly…
Martin Zeltin
  • 1,151
  • 2
  • 8
  • 6
74
votes
4 answers

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 want to do is send the hex string directly. I've tried…
Chris Snow
  • 4,046
  • 4
  • 23
  • 30
73
votes
7 answers

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?
The Student
  • 3,439
  • 9
  • 30
  • 34
59
votes
2 answers

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 done with absolutely any programming language, but…
luser droog
  • 870
  • 1
  • 6
  • 14
53
votes
4 answers

How to find all binary executables recursively within a directory?

If I use find command like this: find /mydir/mysubdir -executable -type f all executable files are listed (excluding directories), and including executable script file (like script.sh, etc). What I want to do is list only binary executable files.
uray
  • 3,830
  • 11
  • 36
  • 42
48
votes
3 answers

How to convert a shell script into a binary executable?

I want to convert my shell scripts into binary executable so that nobody else could edit or read it. Is there a way to convert it into a binary executable?
munish
  • 7,825
  • 24
  • 71
  • 97
47
votes
6 answers

ASCII to Binary and Binary to ASCII conversion 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 01101001 01110011 00100000 01100001 00100000 01100010…
RSFalcon7
  • 4,367
  • 6
  • 30
  • 56
44
votes
3 answers

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 However, this requires that a file exists. I…
Kirk Woll
  • 1,117
  • 2
  • 9
  • 9
42
votes
2 answers

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 MS-Office Word Document. $ tr '\r' '\n' <…
user74886
  • 421
  • 1
  • 4
  • 4
33
votes
4 answers

Is there a way to run a Linux binary on macOS?

Is there a way to run a Linux binary in macOS? I tried to run a binary but it said it isn't executable.
Saeid
  • 441
  • 1
  • 4
  • 6
32
votes
7 answers

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?
Bangi
  • 429
  • 1
  • 5
  • 7
28
votes
4 answers

Why do i get binary output using curl

Not sure if it is ok to share the website I tried to get its source, but I think it is necessary for a better explanation. And I apologize if it's not in advance The command: curl -k -L -s https://www.mi.com The output was binary data for some…
Raywando
  • 427
  • 1
  • 4
  • 7
1
2 3
20 21