0

I am trying to export to a file the size of only the executable files in my directory (which doesn't ends with .sh).

This is the command I made, which, it seems, export non-executable as well as executable files:

file -x -type  | size * > /home/user/Desktop/userbinfiles.xls

What I want to achieve, if it's possible, is that kind of file exported:

A file with:

  1. size of the file
  2. type of the file
  3. file name

I understand my command doesn't do that.

And Ideas?

Yaron
  • 13,173
Alan
  • 111
  • 3

1 Answers1

1

You can use the following command to execute size on all execute-ables files:

find . -executable -type f | xargs size
  • The find command will find all execute-ables files under the current directory
  • xargs will send the result list of files to be processed by the size command

You can use the following command to execute size on all execute-ables files which doesn't ends with .sh:

find . -executable -type f  | grep -v '\.sh$' |  xargs size
  • The command grep -v '\.sh$' will remove all files ends with .sh from the list
Yaron
  • 13,173