Help with sorting executable files in shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with sorting executable files in shell
# 8  
Old 12-30-2011
Nope, your command just sorts the name of the file.

This is where it would help to know what Operating System and version you have.

We need to use the list of filenames to get the size of the file, then sort on the field containing the file size. A generic response (assuming that the size field is the 5th field in "ls -la") would be:
Code:
find "${dir_name}" -type f \( -perm -u+x -o -perm -g+x -o -perm -o+x \) -exec ls -lad {} \; | sort -n -r -k 5

# 9  
Old 12-30-2011
Quote:
Originally Posted by strawhatluffy
ok!thanks for this by the way!now with this i can have a list with the executable file in directory dir_name...
i can sort them now with this command?
find "${dir_name}" -type f \( -perm -u+x -o -perm -g+x -o -perm -o+x \) | sort -nr
Yes. This will sort.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cygwin executable shell scripts

Hello, Cygwin will execute a shell script without turning on executable status on the file. I want to force cygwin to be more like linux and not execute scripts directly on the command line unless changing mode to have executable status. Is this possible? Thanks Larry (2 Replies)
Discussion started by: larrye0123
2 Replies

2. UNIX Desktop Questions & Answers

creating an executable file from shell scripts

Hi Friends, I have a shell script which does some operations etc, would it be possible to create an executable file out from this shell script? meaning the executable file is not editable, thus the source code will not be visible to other users for copyright reasons. Please help, thanks! (1 Reply)
Discussion started by: kokoro
1 Replies

3. Shell Programming and Scripting

[SHELL] Executable? Run it!

I would like to make a script that I can see if the file is executable. If it is executable then it needs to run. Otherwise, if it is not executable the file needs to be edited, and run agian. I hope you understand what i mean. :) Thanks for the netherlands (4 Replies)
Discussion started by: dennisbest85
4 Replies

4. Homework & Coursework Questions

File Looping - Looking for executable files - Need help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! Hello all, I have posted here before and really was blown away by the amount of assistance I received. I was able to finish my homework without a problem! But, yet again, our... (6 Replies)
Discussion started by: Bob07
6 Replies

5. Shell Programming and Scripting

convert shell script into a binary executable

Hello every one, i want to convert my shell script into a binary executable a .exe file , is it possible to do that if so are there any tools . Would the script take off when the arguments are parsed. Thanks Venu (13 Replies)
Discussion started by: venu
13 Replies

6. Shell Programming and Scripting

Exit shell after setting executable to run?

Hi, I have an executable file that has a rather long and tedious process to complete. How would I launch the executable using the shell, and then exit the shell while leaving the executable to run in the background? (1 Reply)
Discussion started by: pcwiz
1 Replies

7. UNIX for Dummies Questions & Answers

executable files

hello. My question, basically is: what is the definition of unix/linux exec files, or what makes a file executable? More specifically, must a unix source file that was compiled using gcc have exec permissions in order to be considered executable? Is it right to say that a unix/linux exec file... (1 Reply)
Discussion started by: nadavkri
1 Replies

8. Shell Programming and Scripting

Need to call an Executable (.exe) using shell

Hi all , I need to call an executable (.exe) using shell script. Actual need is i need to call that shell script and do an export of some tables is there any way . the executable is datamover Please let me know if there are any option !! (2 Replies)
Discussion started by: raghav1982
2 Replies

9. UNIX for Dummies Questions & Answers

Executable files

This question always confuses me :- Suppose I write a program and compile it on a machine with operating system A and processor B will the exe file run on a machine with operating system A2 but processor B operating system A but processor B2 operating system A2 and processor B2........ ... (9 Replies)
Discussion started by: nervous
9 Replies
Login or Register to Ask a Question