excluding sub dir in command
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct
de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10
I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.
command
New contributor
add a comment |Â
up vote
0
down vote
favorite
I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct
de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10
I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.
command
New contributor
Yourls
command is not recursing subdirectories; if this is part of a class to learnls
andgrep
, perhaps they're looking forls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
â Jeff Schaller
Oct 4 at 13:30
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct
de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10
I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.
command
New contributor
I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the problem with the last part, "not including sub directories" here is what I have so far but im stuck on excluding sub directories. Also if you could look at the below command to advise if this is correct
de@Classbox:~/LI_1/etc$ ls -lh -S | sort -r |head -10
I know if i use grep -v d it will exclude directories but i need it to exclude sub directories.
command
command
New contributor
New contributor
edited Oct 4 at 19:26
Rui F Ribeiro
37k1273117
37k1273117
New contributor
asked Oct 4 at 12:15
Deirdre
194
194
New contributor
New contributor
Yourls
command is not recursing subdirectories; if this is part of a class to learnls
andgrep
, perhaps they're looking forls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
â Jeff Schaller
Oct 4 at 13:30
add a comment |Â
Yourls
command is not recursing subdirectories; if this is part of a class to learnls
andgrep
, perhaps they're looking forls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.
â Jeff Schaller
Oct 4 at 13:30
Your
ls
command is not recursing subdirectories; if this is part of a class to learn ls
and grep
, perhaps they're looking for ls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.â Jeff Schaller
Oct 4 at 13:30
Your
ls
command is not recursing subdirectories; if this is part of a class to learn ls
and grep
, perhaps they're looking for ls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.â Jeff Schaller
Oct 4 at 13:30
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Don't expect meaningful results if you sort by "human readable" file sizes. Try
ls -l| sort -k1,1.1 -k5nr | head -n 10
If there are less than 10 regular files, you need additional measures.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Don't expect meaningful results if you sort by "human readable" file sizes. Try
ls -l| sort -k1,1.1 -k5nr | head -n 10
If there are less than 10 regular files, you need additional measures.
add a comment |Â
up vote
1
down vote
accepted
Don't expect meaningful results if you sort by "human readable" file sizes. Try
ls -l| sort -k1,1.1 -k5nr | head -n 10
If there are less than 10 regular files, you need additional measures.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Don't expect meaningful results if you sort by "human readable" file sizes. Try
ls -l| sort -k1,1.1 -k5nr | head -n 10
If there are less than 10 regular files, you need additional measures.
Don't expect meaningful results if you sort by "human readable" file sizes. Try
ls -l| sort -k1,1.1 -k5nr | head -n 10
If there are less than 10 regular files, you need additional measures.
answered Oct 4 at 12:21
RudiC
1,84219
1,84219
add a comment |Â
add a comment |Â
Deirdre is a new contributor. Be nice, and check out our Code of Conduct.
Deirdre is a new contributor. Be nice, and check out our Code of Conduct.
Deirdre is a new contributor. Be nice, and check out our Code of Conduct.
Deirdre is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473219%2fexcluding-sub-dir-in-command%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Your
ls
command is not recursing subdirectories; if this is part of a class to learnls
andgrep
, perhaps they're looking forls ... | grep -v ^d
? You'll likely get different answers here, so it'd be best to clearly explain where you're coming from and what you're expecting.â Jeff Schaller
Oct 4 at 13:30