du -sh * , hide directories with 0 usage The 2019 Stack Overflow Developer Survey Results Are...
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
How to deal with fear of taking dependencies
How to change the limits of integration
Limit the amount of RAM Mathematica may access?
Inflated grade on resume at previous job, might former employer tell new employer?
Are USB sockets on wall outlets live all the time, even when the switch is off?
Is bread bad for ducks?
How can I create a character who can assume the widest possible range of creature sizes?
Does it makes sense to buy a new cycle to learn riding?
Output the Arecibo Message
How can I fix this gap between bookcases I made?
On the insanity of kings as an argument against monarchy
Inline version of a function returns different value than non-inline version
Is domain driven design an anti-SQL pattern?
Lethal sonic weapons
Is three citations per paragraph excessive for undergraduate research paper?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
How to make payment on the internet without leaving a money trail?
Why isn't airport relocation done gradually?
What does "rabbited" mean/imply in this sentence?
How are circuits which use complex ICs normally simulated?
What is the best strategy for white in this position?
I see my dog run
du -sh * , hide directories with 0 usage
The 2019 Stack Overflow Developer Survey Results Are InDiscrepancy between reported used memory and sum of application memory usageProblem when trying to cross-compile an ethernet driver on an old Linux kernelSetup public IP address on LXC containerHow to read the output of the show-memory-usage SysRq?delete all empty directories starting withsort File B based on column 3 of File A without changing contents of File AMySQL High Ram Usage?I am looking for a built-in (simple) command to show network usage and bandwidthCompare two arrays with their respective directories in shell script?Sort with field separator
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Here's what my current output looks like.
475M directorya
0 directoryb
0 directoryc
520M directoryd
42G somefolder
Here is what I am trying to do.
- How do I hide the directories with 0 usage? Essentially only show directories with >0.
- How do I sort this in ascending / descending ordedr?
linux
add a comment |
Here's what my current output looks like.
475M directorya
0 directoryb
0 directoryc
520M directoryd
42G somefolder
Here is what I am trying to do.
- How do I hide the directories with 0 usage? Essentially only show directories with >0.
- How do I sort this in ascending / descending ordedr?
linux
add a comment |
Here's what my current output looks like.
475M directorya
0 directoryb
0 directoryc
520M directoryd
42G somefolder
Here is what I am trying to do.
- How do I hide the directories with 0 usage? Essentially only show directories with >0.
- How do I sort this in ascending / descending ordedr?
linux
Here's what my current output looks like.
475M directorya
0 directoryb
0 directoryc
520M directoryd
42G somefolder
Here is what I am trying to do.
- How do I hide the directories with 0 usage? Essentially only show directories with >0.
- How do I sort this in ascending / descending ordedr?
linux
linux
asked yesterday
NishantNishant
213
213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
du -sh /directory/* | awk '$1 != "0" {print $0}' | sort -h
The output of du -sh /directory/*
will show the the size of the directories contained therein in the first column and the directories themselves in the second column.
The above command runs du -sh
on the directory and then tells awk
to print only the lines where the first column (the size) is not equal to 0 and to then sort the output in human readable order.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511332%2fdu-sh-hide-directories-with-0-usage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
du -sh /directory/* | awk '$1 != "0" {print $0}' | sort -h
The output of du -sh /directory/*
will show the the size of the directories contained therein in the first column and the directories themselves in the second column.
The above command runs du -sh
on the directory and then tells awk
to print only the lines where the first column (the size) is not equal to 0 and to then sort the output in human readable order.
add a comment |
du -sh /directory/* | awk '$1 != "0" {print $0}' | sort -h
The output of du -sh /directory/*
will show the the size of the directories contained therein in the first column and the directories themselves in the second column.
The above command runs du -sh
on the directory and then tells awk
to print only the lines where the first column (the size) is not equal to 0 and to then sort the output in human readable order.
add a comment |
du -sh /directory/* | awk '$1 != "0" {print $0}' | sort -h
The output of du -sh /directory/*
will show the the size of the directories contained therein in the first column and the directories themselves in the second column.
The above command runs du -sh
on the directory and then tells awk
to print only the lines where the first column (the size) is not equal to 0 and to then sort the output in human readable order.
du -sh /directory/* | awk '$1 != "0" {print $0}' | sort -h
The output of du -sh /directory/*
will show the the size of the directories contained therein in the first column and the directories themselves in the second column.
The above command runs du -sh
on the directory and then tells awk
to print only the lines where the first column (the size) is not equal to 0 and to then sort the output in human readable order.
answered yesterday
Nasir RileyNasir Riley
2,9972410
2,9972410
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511332%2fdu-sh-hide-directories-with-0-usage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown