Score:0

How can I remove all strings from tar file in Linux?

ru flag

I created a tar.gz file using tar -cf file_1.tar command. But, when I use strings file_1.tar, I see:

file
0000644
0001750
0001750
00000000000
014545
ustar  
arian
arian

How can I remove them?

raj avatar
cn flag
raj
An attempt to "remove" them makes no sense. They are integral parts of files packed into the tar file. If you "remove" them, you'll damage the file.
raj avatar
cn flag
raj
You can't just remove random parts of the file. The data is there for a reason. It's obvious and self-understanding, nothing more to explain here. It's like you tear out several pages from a book and expect the book to be still complete and intact.
Score:1
mx flag

strings represents any plain text within the binary file, you should encrypt your tar file to hide its contents.

You can either use GPG with tar directly, like in this answer.

Encrypt:

tar czvpf - file1.txt file2.pdf file3.jpg \
 | gpg --symmetric --cipher-algo aes256 -o myarchive.tar.gz

Decrypt:

gpg -d myarchive.tar.gz.gpg | tar xzvf -

Or you might want to consider storing your tar file using p7zip, which could be useful for compatibility with other operating systems using p7zip or 7-Zip. The reason you recompress the tar file is to preserve the unix permissions that ZIP files don't have compatibility for.

Install it first

sudo apt install p7zip-full

Encrypt:

7z a -p -mx=0 -mhe -t7z test.7z test.tar

When you run the encrypt command a prompt will ask you for the password you want to use.

Decrypt:

7z x test.7z

For more info on what these switches mean, see this guide.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.