To display the first 5 bytes of a file in a Unix-like operating system, you can use the head command with the -c option. Here’s how to do it:
Command:
head -c5 /tmp/hello
Breakdown:
head: This command outputs the beginning of a file.-c5: This option specifies that the first 5 bytes should be displayed./tmp/hello: This is the path to the file you want to read.
Example Output:
If the file hello contains:
Hello, World!
Running the command will output:
Hello
This command is useful for quickly checking the first few bytes of a file. If you have any further questions, feel free to ask!
