LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-09-2016, 09:19 PM   #16
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241

If you really want to know how files are identified, refer to the "magic(5)" man page...

I believe on most systems the file referenced for the definitions is at /usr/share/misc/magic.
There are some 14,000 different kinds of files identified.
 
Old 02-11-2016, 09:35 AM   #17
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 2,108

Rep: Reputation: Disabled
you can do somthing as simple as open them up as a text file and if all you see is ununderstandable text then chances are it is a binary.
 
Old 02-11-2016, 10:49 AM   #18
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by BW-userx View Post
you can do somthing as simple as open them up as a text file and if all you see is ununderstandable text then chances are it is a binary.
Ouch... no.

You are assuming the text is based in the Latin-1 character set...

Chinese uses multi-byte characters for everything - guess what? it is still a text file, even though it is not understandable by westerners.

Last edited by jpollard; 02-11-2016 at 11:00 AM.
 
Old 02-11-2016, 11:58 AM   #19
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 2,108

Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
Ouch... no.

You are assuming the text is based in the Latin-1 character set...

Chinese uses multi-byte characters for everything - guess what? it is still a text file, even though it is not understandable by westerners.
damn Chinese think of everything -- Keepin us damn westerners confused .. good job!
 
Old 02-11-2016, 01:24 PM   #20
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,614

Rep: Reputation: 440Reputation: 440Reputation: 440Reputation: 440Reputation: 440
Quote:
The purpose of it is to understand a bloody question I was asked on a test,
I thought we were solving an applied real-user problem.
Quote:
which was to delete all files that are not binaries going through 3 folders and making sure everything else is still in place.
a recursive "while...do..else" script can do that, by first acting on easily identifiable non-binary files having filename extension: tgz, gz, zip, odt, etc. Then test the remaining files by "strings", "file" or "grep" and act on them appropriately.

Quote:
Also to search inside the files and check if they have text inside containing "password" or "CONFIDENTIAL" and delete the ones that have CONFIDENTIAL text in them.
This is naive. $PASSWDs are normally encrypted and decryption is the antidote... something that could be unwieldy for a neophyte to handle in automation by script; you will need an expert for this. Though, if the strings "password" or "confidential" are the targets they are easily handled by "grep", or else, you can "hex" it --use a hex-editor there are plenty in the FOSS repositories.

Hope that helps. Good luck.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do .sig files contain information to check the integrity of files? stf92 Slackware 4 12-11-2015 10:07 AM
check enumerated files available mzh Linux - General 4 07-21-2012 09:32 AM
[SOLVED] Konqueror updates to local files / executing local binaries dogpatch Linux - General 1 01-12-2011 04:58 PM
How to check what are the modules compiled into the binaries in a package? Akhran Debian 6 03-12-2006 05:28 PM
Boot disk; check. CD in drive; check. Doesn't work; check. Hal DamnSmallLinux 7 02-04-2004 03:10 AM


All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration