du calculating whole directory size when we pipe the null input, how to stop it
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | xargs du -ch
5.0G ./something
5.0G .
5.0G total
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | wc -l
0
When it got null input its calculating the whole directory size how to stop it
linux disk-usage xargs
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | xargs du -ch
5.0G ./something
5.0G .
5.0G total
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | wc -l
0
When it got null input its calculating the whole directory size how to stop it
linux disk-usage xargs
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | xargs du -ch
5.0G ./something
5.0G .
5.0G total
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | wc -l
0
When it got null input its calculating the whole directory size how to stop it
linux disk-usage xargs
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | xargs du -ch
5.0G ./something
5.0G .
5.0G total
[emdfqmm@nfwne ncndnkln]$ ll -h | grep "Oct" | grep "2018" | wc -l
0
When it got null input its calculating the whole directory size how to stop it
linux disk-usage xargs
linux disk-usage xargs
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited Nov 21 at 21:49


Jeff Schaller
36.6k1052121
36.6k1052121
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 21 at 14:52
user322121
1
1
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
user322121 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01
add a comment |
1
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01
1
1
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
xargs
has an option to not run if no input is given:
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run
the command. Normally, the command is run once even if there is
no input. This option is a GNU extension.
So use xargs -r du -ch
instead.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
Use find
with -exec
:
month="Oct-2018";
find . -mindepth 1 -maxdepth 1 -newermt "01-$month -1 sec" -and -not -newermt "01-$month +1 month -1 sec" -exec du -ch ;
Though, somehow I believe, you want du -sh
instead of du -ch
.
See
- Why *not* parse `ls` (and what do to instead)?
- UNIX / BASH: Listing files modified in specific month
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
xargs
has an option to not run if no input is given:
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run
the command. Normally, the command is run once even if there is
no input. This option is a GNU extension.
So use xargs -r du -ch
instead.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
xargs
has an option to not run if no input is given:
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run
the command. Normally, the command is run once even if there is
no input. This option is a GNU extension.
So use xargs -r du -ch
instead.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
up vote
0
down vote
xargs
has an option to not run if no input is given:
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run
the command. Normally, the command is run once even if there is
no input. This option is a GNU extension.
So use xargs -r du -ch
instead.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
xargs
has an option to not run if no input is given:
-r, --no-run-if-empty
If the standard input does not contain any nonblanks, do not run
the command. Normally, the command is run once even if there is
no input. This option is a GNU extension.
So use xargs -r du -ch
instead.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Nov 21 at 15:04
Bash bros
1
1
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Bash bros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
up vote
0
down vote
Use find
with -exec
:
month="Oct-2018";
find . -mindepth 1 -maxdepth 1 -newermt "01-$month -1 sec" -and -not -newermt "01-$month +1 month -1 sec" -exec du -ch ;
Though, somehow I believe, you want du -sh
instead of du -ch
.
See
- Why *not* parse `ls` (and what do to instead)?
- UNIX / BASH: Listing files modified in specific month
add a comment |
up vote
0
down vote
Use find
with -exec
:
month="Oct-2018";
find . -mindepth 1 -maxdepth 1 -newermt "01-$month -1 sec" -and -not -newermt "01-$month +1 month -1 sec" -exec du -ch ;
Though, somehow I believe, you want du -sh
instead of du -ch
.
See
- Why *not* parse `ls` (and what do to instead)?
- UNIX / BASH: Listing files modified in specific month
add a comment |
up vote
0
down vote
up vote
0
down vote
Use find
with -exec
:
month="Oct-2018";
find . -mindepth 1 -maxdepth 1 -newermt "01-$month -1 sec" -and -not -newermt "01-$month +1 month -1 sec" -exec du -ch ;
Though, somehow I believe, you want du -sh
instead of du -ch
.
See
- Why *not* parse `ls` (and what do to instead)?
- UNIX / BASH: Listing files modified in specific month
Use find
with -exec
:
month="Oct-2018";
find . -mindepth 1 -maxdepth 1 -newermt "01-$month -1 sec" -and -not -newermt "01-$month +1 month -1 sec" -exec du -ch ;
Though, somehow I believe, you want du -sh
instead of du -ch
.
See
- Why *not* parse `ls` (and what do to instead)?
- UNIX / BASH: Listing files modified in specific month
answered Nov 21 at 15:07
RoVo
2,224215
2,224215
add a comment |
add a comment |
user322121 is a new contributor. Be nice, and check out our Code of Conduct.
user322121 is a new contributor. Be nice, and check out our Code of Conduct.
user322121 is a new contributor. Be nice, and check out our Code of Conduct.
user322121 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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483228%2fdu-calculating-whole-directory-size-when-we-pipe-the-null-input-how-to-stop-it%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
1
I don't think any part of your command is doing what you want it to do. This seems like an XY Problem. Can you please redo your question to ask what your goal is and I'm sure someone can help you find the correct solution.
– Jesse_b
Nov 21 at 15:01