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 6232761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:10:26+00:00 2026-05-24T10:10:26+00:00

I am trying to find files and add their md5sum into a table. find

  • 0

I am trying to find files and add their md5sum into a table.

find /store/01 -name "*.fits" -exec chmod -x+r {} \; -exec ls -l {} \; | tee ALL_FILES.LOG

How do I add in the ls -l output the md5sum of the file?

I would like to have it output the ls -l and an extra column of md5sum result

E.g.:

-rw-r--r-- 1 data user 221790 Jul 28 15:01 381dc9fc26082828ddbb46a5b8b55c03 myfile.fits 
  • 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-24T10:10:28+00:00Added an answer on May 24, 2026 at 10:10 am

    This one liner will do what do you want (edit the find search to fit your needs by adding the /store/01 -name "*.fits" -exec chmod -x+r {} \; instead of the . -type f in my example):

    $ find . -type f -exec sh -c 'printf "%s %s \n" "$(ls -l $1)" "$(md5sum $1)"' '' '{}' '{}' \;
    

    Example:

    /etc/samba$ find . -type f -exec sh -c 'printf "%s %s \n" "$(ls -l $1)" "$(md5sum  $1)"' '' '{}' '{}' \; 
    -rw-r--r-- 1 root root 8 2010-03-09 02:03 ./gdbcommands 898c523d1c11feeac45538a65d00c838  ./gdbcommands 
    -rw-r--r-- 1 root root 12464 2011-05-20 11:28 ./smb.conf 81ec21c32bb100e0855b96b0944d7b51  ./smb.conf 
    -rw-r--r-- 1 root root 0 2011-06-27 10:57 ./dhcp.conf d41d8cd98f00b204e9800998ecf8427e  ./dhcp.conf 
    

    To get the output as you wanted, you can remove the field $8 as follows

    /etc/samba$ find . -type f -exec sh -c 'printf "%s %s \n" "$(ls -l $1)" "$(md5sum  $1)"' '' '{}' '{}' \; | awk '{$8=""; print $0}'
    -rw-r--r-- 1 root root 8 2010-03-09 02:03  898c523d1c11feeac45538a65d00c838 ./gdbcommands
    -rw-r--r-- 1 root root 12464 2011-05-20 11:28  81ec21c32bb100e0855b96b0944d7b51 ./smb.conf
    -rw-r--r-- 1 root root 0 2011-06-27 10:57  d41d8cd98f00b204e9800998ecf8427e ./dhcp.conf
    

    HTH

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

Sidebar

Related Questions

I'm trying to find files with the name of formClass.php that contain a string
I'm trying to find a way to search in a files and add a
I am trying to find all ruby files in the project. However I want
I am trying to write a bash script. I want to find files by
I'm trying to find certain strings in a lot of files (cc. 2000 files).
I am trying to find a way to stop accidental overwriting of files when
I'm trying to find a good organization practice of my javascript (jquery) files when
I'm trying to find a library to be able to simply extract files from
Hi I am trying to find all js & css files in one find
I'm trying to figure out a way to find out which files were affected

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.