LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 08:19 PM   #16
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513

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, 08:35 AM   #17
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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, 09:49 AM   #18
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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 10:00 AM.
 
Old 02-11-2016, 10:58 AM   #19
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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, 12:24 PM   #20
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
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



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 09:07 AM
check enumerated files available mzh Linux - General 4 07-21-2012 08:32 AM
[SOLVED] Konqueror updates to local files / executing local binaries dogpatch Linux - General 1 01-12-2011 03:58 PM
How to check what are the modules compiled into the binaries in a package? Akhran Debian 6 03-12-2006 04:28 PM
Boot disk; check. CD in drive; check. Doesn't work; check. Hal DamnSmallLinux 7 02-04-2004 02:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:52 AM.

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
Open Source Consulting | Domain Registration