Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7580115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:50:08+00:00 2026-05-30T17:50:08+00:00

First off, I am not a Unix expert by any stretch, so please forgive

  • 0

First off, I am not a Unix expert by any stretch, so please forgive a little naiveity in my question.

I have a requirement to list the unencrypted files in a given directory that potentially contains both encryped and unencrypted files.

I cannot reliably identify these files by file extension alone and was hoping someone in the SO community might be able to help me out.

I can run:

file * | egrep -w 'text|XML'

but that will only identify the files that are either text or XML. I could possibly use this if I can’t do much better as currently the only other files in the directry are text or XML files but I really wanted to identify all unencrypted files whatever type they may be.

Is this possible in a single line command?

EDIT: the encrypted files are encrypted via openSSL

The command I use to unencrypt the files is:

openssl -d -aes128 -in <encrypted_filename> -out <unencrypted_filename>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:50:09+00:00Added an answer on May 30, 2026 at 5:50 pm

    Your problem is not a trivial one. The solaris file command uses “magic” – /etc/magic. This is a set of rules to attempt to attempt to determine what flavor a file is. It is not perfect.

    If you read the /etc/magic file, note that the last column is verbiage that is in the output of the file command when it recognizes something, some structure in a file.

    Basically the file command looks at the first few bytes of a file, just like the exec() family of system calls does. So, #/bin/sh in the very first line of a file, in the first characters of the line, identifies to exec() the “command interpreter” that exec() needs to invoke to “run” the file. file gets the same idea and says “command text” “awk text” etc.

    Your issues are that you have to work out what types of files you are going to see as output from file. You need to spend time delving into the non-encrypted files to see what “answers” you can expect from file. Otherwise you can run file over the whole directory tree and sort out all of what you think are correct answers.

    find /path/to/files -type f -exec file {} \; | nawk -F':' '!arr[$2]++'  > outputfile
    

    This gives you a list of distinct answers about what file thinks you have. Put the ones you like in a file, call it good.txt

    find /path/to/files -type f -exec file {} \; > bigfile
    nawk -F':' 'FILENAME=="good.txt" {arr$1]++}
              FILENAME=="bigfile" {if($2 in arr) {print $1}} ' good.txt bigfile > nonencryptedfiles.txt
    

    THIS IS NOT 100% guaranteed. file can be fooled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off I'm not a Java expert by any stretch, nor am I a
First off, please forgive the stupidness of this question but Im not from a
First off: I am not an expert, so please excuse any mistakes I make
First off, I'm not an expert with MySQL queries, and I can't seem to
First off, I am not an AS 400 guy - at all. So please
First off, I'm not entirely sure that my question title is very descriptive, so
First off, I am not dynamically creating any controls. This is the order I
First off; I am not necessarily looking for Delphi code, spit it out any
First off, this question is not what does the constructor property do? - There's
First off - I'm not super familiar with Flash Builder or ActionScript. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.