Questions tagged [byte]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

Convert variable from little endian to big endian

Working in Bash I have a hex variable that I must convert from little endian to big endian I am new to the entire concept of this and only learned about this about 20 minutes ago, so please bare with ...
Nir's user avatar
  • 1
0 votes
1 answer

print byte from number in awk

I can print a byte from a string literal like: awk 'BEGIN {print "\001"}' | cat -v But I need to print a byte of the result of a bitwise OR. So how can I print a byte from a number? Gawk is ...
sedwho's user avatar
  • 5
3 votes
1 answer

What is "length" of a string in Bourne shell compatibles' `${#string}`?

Arising from this discussion: When I have (zsh 5.8, bash 5.1.0) var="ASCII" echo "${var} has the length ${#var}, and is $(printf "%s" "$var"| wc -c) bytes long" ...
Marcus Müller's user avatar
0 votes
2 answers

Count bytes of filename

How can I know how many bytes does it weight the name of a filename? Just the file, not the full path. I've tried this: echo 'filename.extension' | wc -c is this right?
Smeterlink's user avatar
0 votes
1 answer

Execute Program until specific amount of bytes has been returned on stdout, then terminate

Imagine I have the following program/script ./generate-infinite-byte-stream: #!/bin/bash echo -n 'hello' sleep infinity The infinite sleep command represents a network connection that may or may not ...
masterxilo's user avatar
11 votes
2 answers

How do I find the first non-zero byte on a block device, with an optional offset?

I'm trying to find the first non-zero byte (starting from an optional offset) on a block device using dd and print its offset, but I am stuck. I didn't mention dd in the title as I figured there might ...
ExploringQuest's user avatar
0 votes
2 answers

Is there a way to strip the high bit of each byte in a file?

I've been trying to figure out if this can be done in sed or tr, but I can't find it. I have a bunch of files from an old Apple II which have the high bit set on each byte. On a Mac, this results in a ...
bjb's user avatar
  • 113
5 votes
3 answers

What is the difference between a byte and a character (at least *nixwise)?

I understand that any character is comprised of one or more byte/s. If I am not mistaken, at least in *nix operating systems, a character will generally (or totally?) be comprised of only one byte. ...
variableexpander's user avatar
1 vote
4 answers

How to count the number of bytes in a very large file, grouping the same bytes? [duplicate]

I am searching for a way to get a statistics on a very large (multiple times larger than the available RAM) the outputs what byte values in the files are present and how often: A0 01 00 FF 77 01 77 ...
Robert's user avatar
  • 163
5 votes
5 answers

How to count the number of bytes in a file, grouping the same bytes? [duplicate]

Example: I have the file "mybinaryfile", and the contents in hex are: A0 01 00 FF 77 01 77 01 A0 I need to know how many A0 bytes there are in this file, how many 01, and so on. The result could be: ...
Lawrence's user avatar
  • 329
0 votes
1 answer

Entropy: whats the difference between bits and bytes?

If I use openssl to generate some random data (for a keyfile, for example): openssl rand -hex 2048 >/tmp/file Is this 4097 bits (or bytes?) of entropy? -rw-rw-r-- 1 username username 4097 Oct 30 ...
user318576's user avatar
20 votes
3 answers

How do I trim bytes from the beginning and end of a file?

I have a file, that has trash (binary header and footer) at the beginning and end of the file. I would like to know how to nuke these bytes. For an example, let's assume 25 bytes from the beginning. ...
Evan Carroll's user avatar
  • 29.6k
26 votes
3 answers

Byte count of "ls -l <random file>" versus that of "wc -c <random file>"

Is there any possible situation when ls -l file.txt is showing not the same number of bytes as wc -c file.txt In one script I found comparison of those two values. What could be the reason of ...'s user avatar
  • 563
19 votes
4 answers

Is there a oneliner that converts a binary file from little endian to big endian?

and vice versa. I am running a RedHat if relevant.
Fermat's Little Student's user avatar
1 vote
2 answers

What options does wget --report-speed take?

When I do this command: wget --report-speed=type they only type it accepts is bits. It won't have numbers, kilobits / kilobytes or bytes. The help page (wget --help) says: --report-speed=TYPE ...
Tim's user avatar
  • 123
3 votes
2 answers

How to bury an invisible mark into lines of text?

How can I bury an invisible mark into random lines of text? Such a mark has to be there, though it will be invisible to someone reading that text printed out on the console. I want to identify those ...
n.r.'s user avatar
  • 2,183
-2 votes
1 answer

How large is the Linux kernel compared to Unix? [closed]

Not in just LOC (lines of code), but in storage size, as in bytes, megabytes, gigabytes, etc. Also, any sources where I can download the original-based Unix OS? Thanks!
thomas brain's user avatar
0 votes
1 answer

Why is od calculating decimal values wrong?

This question is related to the answer from enzotib to the question: How could I use Bash to find 2 bytes in a binary file, increase their values, and replace? This converts the two bytes into its ...
erik's user avatar
  • 17.1k