xxd usage change magic byte to JPEG

0 votes

I create a simple test file like this:

$ cat > test
blah

Now I run vi, and then :%!xxd to edit first bytes with FFD8 FF

00000000: ffd8 ffe0 0a                             blah.

and the I run :%!xxd -r.

file gives me NOT jpeg:

$ file test
test: Unicode text, UTF-8 text

And if I manage to get hexdump:

$ xxd test
00000000: c3bf c398 c3bf c3a0 0a                   .........

What am I doing wrong with xxd? Thank you

Dec 14, 2022 in Linux Administration by erzan
• 630 points
• 2,002 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

When opening the file with vi, please make sure to say:

LC_ALL=C vi test

then edit and save the file with the shown procedure.

answered Dec 15, 2022 by Elton
• 400 points

edited Mar 5, 2025

Related Questions In Linux Administration

0 votes
1 answer

How to change permissions of folder and files in folder?

The chmod command is used to set/change the permissions ...READ MORE

answered Feb 1, 2019 in Linux Administration by Omkar
• 69,180 points
• 3,271 views
0 votes
1 answer

How to change the default shell in Linux?

1. Change the password file directly for ...READ MORE

answered May 24, 2019 in Linux Administration by Upasana
• 8,620 points
• 2,211 views
0 votes
2 answers

How to change IP address of an Ubuntu VM?

The easiest method is through network manager: 1- ...READ MORE

answered Aug 25, 2020 in Linux Administration by Pistle
• 300 points
• 16,952 views
0 votes
1 answer

How to change port no 80 of httpd webserver?

Hi@akhtar, You can change port no of httpd ...READ MORE

answered Apr 21, 2020 in Linux Administration by MD
• 95,460 points
• 3,631 views
0 votes
1 answer

How to change the owner of any folder in Linux system?

Hi@akhtar, Linux system has one command named chown. This ...READ MORE

answered Aug 14, 2020 in Linux Administration by MD
• 95,460 points
• 2,591 views
0 votes
1 answer

How to change the group of a folder in Linux system?

Hi@akhtar, You can use chgrp command in your ...READ MORE

answered Aug 14, 2020 in Linux Administration by MD
• 95,460 points
• 2,732 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
• 3,091 views
0 votes
2 answers

Install postgreSQL on Ubuntu

Follow the below commands to install PostgreSQL (PSQL) ...READ MORE

answered Nov 12, 2020 in Database by Prachi
• 140 points
• 3,351 views
0 votes
1 answer

Access progrs prompt without switching accounts

Use the following to get the postgres prompt ...READ MORE

answered Mar 22, 2019 in Database by Mahi
• 2,476 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP