Total disk usage for a particular userHow to get the summarized sizes of directories and their...
Signed and unsigned numbers
Should I take out a loan for a friend to invest on my behalf?
What materials can be used to make a humanoid skin warm?
This Alpine town?
Is it possible to find 2014 distinct positive integers whose sum is divisible by each of them?
What will happen if my luggage gets delayed?
Is a piano played in the same way as a harmonium?
Windows Server Data Center Edition - Unlimited Virtual Machines
After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?
How do electrons receive energy when a body is heated?
What would be the most expensive material to an intergalactic society?
Is it a Cyclops number? "Nobody" knows!
For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?
How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?
Why couldn't the separatists legally leave the Republic?
When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?
Giving a career talk in my old university, how prominently should I tell students my salary?
Rationale to prefer local variables over instance variables?
What is this diamond of every day?
Can't make sense of a paragraph from Lovecraft
Making a kiddush for a girl that has hard time finding shidduch
PTIJ: Why does only a Shor Tam ask at the Seder, and not a Shor Mu'ad?
Do cubics always have one real root?
Why do we say ‘pairwise disjoint’, rather than ‘disjoint’?
Total disk usage for a particular user
How to get the summarized sizes of directories and their subdirectories?Getting disk usage for each usershow file size and file ownerGraphical Monitor for HDD usagetrack disk usage over time in linuxubuntu report wrong disk usage on /USER field in ps command(android env)How do I find files and total their sizes?Log Usage of Particular Programspass du (disk usage) result to a numeric variableGetting disk usage for each userReport disk usage through SMB serverGet disk usage from redhat 7 using on built in commands
I would like to see the total disk usage for myself on a particular file system. I executed the command
du -h ~my_user_name
However, this lists every directory owned by my_user_name
. I would like to get the sum total of all of this information. What is the appropriate option to pass? I tried
du -h -c ~my_user_name
but that did not work.
linux disk-space du memory-usage
add a comment |
I would like to see the total disk usage for myself on a particular file system. I executed the command
du -h ~my_user_name
However, this lists every directory owned by my_user_name
. I would like to get the sum total of all of this information. What is the appropriate option to pass? I tried
du -h -c ~my_user_name
but that did not work.
linux disk-space du memory-usage
add a comment |
I would like to see the total disk usage for myself on a particular file system. I executed the command
du -h ~my_user_name
However, this lists every directory owned by my_user_name
. I would like to get the sum total of all of this information. What is the appropriate option to pass? I tried
du -h -c ~my_user_name
but that did not work.
linux disk-space du memory-usage
I would like to see the total disk usage for myself on a particular file system. I executed the command
du -h ~my_user_name
However, this lists every directory owned by my_user_name
. I would like to get the sum total of all of this information. What is the appropriate option to pass? I tried
du -h -c ~my_user_name
but that did not work.
linux disk-space du memory-usage
linux disk-space du memory-usage
edited Apr 28 '16 at 5:20
crisron
114111
114111
asked May 18 '13 at 20:28
AlexAlex
2741412
2741412
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Passing -s
to du
will restrict the output to only the items specified on the command line.
du -sh ~
add a comment |
Du will only show you the totals per folder, not per user.
That might work if you want the total size of, say, /home/example_user/
and if only that example_user has files in that folder. If other users have files in them then this will not yield size of all files owned by you, but the total size of all files in that folder.
To get the information per user, either:
- If you have quota's enabled, use those commands.
- Use find to walk though all the directories you want to count your files in. Use the uid to only select your files and keep an associative array in awk to count the totals.
find /path/to/search/ -user username_whos_files_to_count -type f -printf "%sn" | awk '{t+=$1}END{print t}'
Note, this uses a GNU find specific extension.
- The first command searches past all files and directories in
/path/to/search/
.
-type f
makes sure you only select files, otherwise you are also counting the size of directories. (Try making an empty folder. It will probably use 4k diskspace).
-user username_whos_files_to_count
only selects the results from one user
-printf "%sn"
will print the size.
If you just run the first part of this, you will get a list of numbers. Those are the file sizes. (Everything else is stripped, only the size is printed thanks to the %s print command.)
We can then add all those numbers to get a summary. In the example, this is done with awk.
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.
– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fsuperuser.com%2fquestions%2f597168%2ftotal-disk-usage-for-a-particular-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Passing -s
to du
will restrict the output to only the items specified on the command line.
du -sh ~
add a comment |
Passing -s
to du
will restrict the output to only the items specified on the command line.
du -sh ~
add a comment |
Passing -s
to du
will restrict the output to only the items specified on the command line.
du -sh ~
Passing -s
to du
will restrict the output to only the items specified on the command line.
du -sh ~
answered May 18 '13 at 20:38
Ignacio Vazquez-AbramsIgnacio Vazquez-Abrams
96.3k6155211
96.3k6155211
add a comment |
add a comment |
Du will only show you the totals per folder, not per user.
That might work if you want the total size of, say, /home/example_user/
and if only that example_user has files in that folder. If other users have files in them then this will not yield size of all files owned by you, but the total size of all files in that folder.
To get the information per user, either:
- If you have quota's enabled, use those commands.
- Use find to walk though all the directories you want to count your files in. Use the uid to only select your files and keep an associative array in awk to count the totals.
find /path/to/search/ -user username_whos_files_to_count -type f -printf "%sn" | awk '{t+=$1}END{print t}'
Note, this uses a GNU find specific extension.
- The first command searches past all files and directories in
/path/to/search/
.
-type f
makes sure you only select files, otherwise you are also counting the size of directories. (Try making an empty folder. It will probably use 4k diskspace).
-user username_whos_files_to_count
only selects the results from one user
-printf "%sn"
will print the size.
If you just run the first part of this, you will get a list of numbers. Those are the file sizes. (Everything else is stripped, only the size is printed thanks to the %s print command.)
We can then add all those numbers to get a summary. In the example, this is done with awk.
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.
– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
add a comment |
Du will only show you the totals per folder, not per user.
That might work if you want the total size of, say, /home/example_user/
and if only that example_user has files in that folder. If other users have files in them then this will not yield size of all files owned by you, but the total size of all files in that folder.
To get the information per user, either:
- If you have quota's enabled, use those commands.
- Use find to walk though all the directories you want to count your files in. Use the uid to only select your files and keep an associative array in awk to count the totals.
find /path/to/search/ -user username_whos_files_to_count -type f -printf "%sn" | awk '{t+=$1}END{print t}'
Note, this uses a GNU find specific extension.
- The first command searches past all files and directories in
/path/to/search/
.
-type f
makes sure you only select files, otherwise you are also counting the size of directories. (Try making an empty folder. It will probably use 4k diskspace).
-user username_whos_files_to_count
only selects the results from one user
-printf "%sn"
will print the size.
If you just run the first part of this, you will get a list of numbers. Those are the file sizes. (Everything else is stripped, only the size is printed thanks to the %s print command.)
We can then add all those numbers to get a summary. In the example, this is done with awk.
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.
– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
add a comment |
Du will only show you the totals per folder, not per user.
That might work if you want the total size of, say, /home/example_user/
and if only that example_user has files in that folder. If other users have files in them then this will not yield size of all files owned by you, but the total size of all files in that folder.
To get the information per user, either:
- If you have quota's enabled, use those commands.
- Use find to walk though all the directories you want to count your files in. Use the uid to only select your files and keep an associative array in awk to count the totals.
find /path/to/search/ -user username_whos_files_to_count -type f -printf "%sn" | awk '{t+=$1}END{print t}'
Note, this uses a GNU find specific extension.
- The first command searches past all files and directories in
/path/to/search/
.
-type f
makes sure you only select files, otherwise you are also counting the size of directories. (Try making an empty folder. It will probably use 4k diskspace).
-user username_whos_files_to_count
only selects the results from one user
-printf "%sn"
will print the size.
If you just run the first part of this, you will get a list of numbers. Those are the file sizes. (Everything else is stripped, only the size is printed thanks to the %s print command.)
We can then add all those numbers to get a summary. In the example, this is done with awk.
Du will only show you the totals per folder, not per user.
That might work if you want the total size of, say, /home/example_user/
and if only that example_user has files in that folder. If other users have files in them then this will not yield size of all files owned by you, but the total size of all files in that folder.
To get the information per user, either:
- If you have quota's enabled, use those commands.
- Use find to walk though all the directories you want to count your files in. Use the uid to only select your files and keep an associative array in awk to count the totals.
find /path/to/search/ -user username_whos_files_to_count -type f -printf "%sn" | awk '{t+=$1}END{print t}'
Note, this uses a GNU find specific extension.
- The first command searches past all files and directories in
/path/to/search/
.
-type f
makes sure you only select files, otherwise you are also counting the size of directories. (Try making an empty folder. It will probably use 4k diskspace).
-user username_whos_files_to_count
only selects the results from one user
-printf "%sn"
will print the size.
If you just run the first part of this, you will get a list of numbers. Those are the file sizes. (Everything else is stripped, only the size is printed thanks to the %s print command.)
We can then add all those numbers to get a summary. In the example, this is done with awk.
edited 8 mins ago
Richlv
21919
21919
answered May 18 '13 at 20:39
HennesHennes
59.3k793142
59.3k793142
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.
– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
add a comment |
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.
– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
+1 good point, thanks! the answer below actually was exactly what i wanted. the user/folder distinction doesn't matter that much in my case
– Alex
May 18 '13 at 20:48
Nice.
du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.– Hennes
May 18 '13 at 20:55
Nice.
du -sch
is an easy command often used. Tracking down who owned what when things were mixed is a lot harder though it can be done as a one liner. I used it once, but I had trouble reconstructing it today.– Hennes
May 18 '13 at 20:55
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
Helped me a lot, Perfect Explanation
– Babin Lonston
Mar 29 '14 at 8:07
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f597168%2ftotal-disk-usage-for-a-particular-user%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