How to find the first X gb of data?
Clash Royale CLAN TAG#URR8PPP
I've been trying to find a way to free up some space on a drive by moving folders to another. I have a folder full of stuff I can move, doesn't need to be all of it, to free up some space.
In Windows I'd just select a bunch of folders, get the properties, it'd tell me how much space it was taking up, I'd select more or less and then move them. I can't do that from a bash terminal, and I have no idea how to go about it. Google searching keeps leading me down the path of moving all files over a certain size, which isn't what I'm trying to do.
disk-usage file-copy
add a comment |
I've been trying to find a way to free up some space on a drive by moving folders to another. I have a folder full of stuff I can move, doesn't need to be all of it, to free up some space.
In Windows I'd just select a bunch of folders, get the properties, it'd tell me how much space it was taking up, I'd select more or less and then move them. I can't do that from a bash terminal, and I have no idea how to go about it. Google searching keeps leading me down the path of moving all files over a certain size, which isn't what I'm trying to do.
disk-usage file-copy
Can you runmc
?
– Kamil Maciorowski
Jan 29 at 9:44
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51
add a comment |
I've been trying to find a way to free up some space on a drive by moving folders to another. I have a folder full of stuff I can move, doesn't need to be all of it, to free up some space.
In Windows I'd just select a bunch of folders, get the properties, it'd tell me how much space it was taking up, I'd select more or less and then move them. I can't do that from a bash terminal, and I have no idea how to go about it. Google searching keeps leading me down the path of moving all files over a certain size, which isn't what I'm trying to do.
disk-usage file-copy
I've been trying to find a way to free up some space on a drive by moving folders to another. I have a folder full of stuff I can move, doesn't need to be all of it, to free up some space.
In Windows I'd just select a bunch of folders, get the properties, it'd tell me how much space it was taking up, I'd select more or less and then move them. I can't do that from a bash terminal, and I have no idea how to go about it. Google searching keeps leading me down the path of moving all files over a certain size, which isn't what I'm trying to do.
disk-usage file-copy
disk-usage file-copy
edited Jan 29 at 10:20
Jeff Schaller
41.6k1056132
41.6k1056132
asked Jan 29 at 9:36
TodTod
1033
1033
Can you runmc
?
– Kamil Maciorowski
Jan 29 at 9:44
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51
add a comment |
Can you runmc
?
– Kamil Maciorowski
Jan 29 at 9:44
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51
Can you run
mc
?– Kamil Maciorowski
Jan 29 at 9:44
Can you run
mc
?– Kamil Maciorowski
Jan 29 at 9:44
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51
add a comment |
3 Answers
3
active
oldest
votes
On a GNU system, you could script it as:
#! /bin/bash -
usage()
printf >&2 '%sn' "Usage: $0 <destination> <size> [<file1> [<file2>...]]"
exit 1
(($# >= 2)) || usage
dest=$1
size=$(numfmt --from=iec <<< "$2") || usage
shift 2
(($# == 0)) && exit
selected=()
sum=0
shopt -s lastpipe
LC_ALL=C du -s --null --block-size=1 -- "$@" |
while
((sum < size)) &&
IFS= read -rd '' rec &&
s=$rec%%$'t'* &&
file=$rec#*$'t'
do
selected+=("$file")
((sum += s))
done
(($#selected[@] == 0)) ||
exec mv -t "$dest" -- "$selected[@]"
Used for instance as:
that-script /dest/folder 1G *
To move as many files as necessary from the expansion of that *
glob to make up at least 1GiB.
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors ofdu
to/dev/null
(du 2> /dev/null
instead ofdu
).
– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNUdu
but only if I ignore the SIGPIPE signal (as in(trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you rungrep SigIgn /proc/self/status
?
– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
add a comment |
You could pretty much do the exact same thing within the terminal:
First execute cd /path/to/full/drive/
to get into the filled up drive's root folder.
Then, to view the capacity taken by each folder inside that drive you could use du -hd1
(assuming the GNU implementation of du
).
Explanation: du
(Disk Usage) runs recursively on your file tree from current folder, printing the capacity used by each folder. By default it's printed as number of 512-byte units or kibibytes (depending on whether POSIXLY_CORRECT is in the environment which is somewhat unreadable), and so the -h
option tells it to print sizes as "human readable" (converted to MB/GB). The d
parameter forces du
to stop its descent into the file tree after reaching the specified "depth" (in this case 1).
Once you find a specific directory you'd like to move content from you could use ls -lh
to view file sizes inside this directory to identify specific files to move. Here the h
is once again for printing sizes as "human readable", and -l
is to get the "long" format which includes file sizes.
Bonus point: You could pipe du
into sort
(here again assuming GNU sort
) to get the output sorted by size (assuming the file names don't contain newline characters) to make things easier like so:
du -hd1 | sort -h
and ls
can sort the output by size as well when providing the -S
option:
ls -lhrS
Finally, to move files/folders you can use the mv /path/to/source /path/to/target
command.
I'm assuming that you know what is the root folder of the relevant drive.
1
On Linux, and some other Unices,ls -lS
will sort by size. Your pipelinels -lh | sort -h
would not sort by size.
– Kusalananda
Jan 29 at 10:01
1
@Kusalananda,ls -S
is now POSIX.ls -h
is not (neither aredu -h
, nordu -d1
all GNU extensions, nothing to do with Linux).
– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,ls -S
is POSIX. I'm not keeping updated.
– Kusalananda
Jan 29 at 10:09
add a comment |
Use du -hd1
-h prints size in human readable format
-d <1> is the depth for directory.
Example:
$ du -hd1
11G ./dir1
9.5G. ./dir2
11G ./dir3
6.3G ./dir4
9.1G ./dir5
6.4G ./dir6
4.8G ./dir7
58G .
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%2f497391%2fhow-to-find-the-first-x-gb-of-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
On a GNU system, you could script it as:
#! /bin/bash -
usage()
printf >&2 '%sn' "Usage: $0 <destination> <size> [<file1> [<file2>...]]"
exit 1
(($# >= 2)) || usage
dest=$1
size=$(numfmt --from=iec <<< "$2") || usage
shift 2
(($# == 0)) && exit
selected=()
sum=0
shopt -s lastpipe
LC_ALL=C du -s --null --block-size=1 -- "$@" |
while
((sum < size)) &&
IFS= read -rd '' rec &&
s=$rec%%$'t'* &&
file=$rec#*$'t'
do
selected+=("$file")
((sum += s))
done
(($#selected[@] == 0)) ||
exec mv -t "$dest" -- "$selected[@]"
Used for instance as:
that-script /dest/folder 1G *
To move as many files as necessary from the expansion of that *
glob to make up at least 1GiB.
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors ofdu
to/dev/null
(du 2> /dev/null
instead ofdu
).
– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNUdu
but only if I ignore the SIGPIPE signal (as in(trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you rungrep SigIgn /proc/self/status
?
– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
add a comment |
On a GNU system, you could script it as:
#! /bin/bash -
usage()
printf >&2 '%sn' "Usage: $0 <destination> <size> [<file1> [<file2>...]]"
exit 1
(($# >= 2)) || usage
dest=$1
size=$(numfmt --from=iec <<< "$2") || usage
shift 2
(($# == 0)) && exit
selected=()
sum=0
shopt -s lastpipe
LC_ALL=C du -s --null --block-size=1 -- "$@" |
while
((sum < size)) &&
IFS= read -rd '' rec &&
s=$rec%%$'t'* &&
file=$rec#*$'t'
do
selected+=("$file")
((sum += s))
done
(($#selected[@] == 0)) ||
exec mv -t "$dest" -- "$selected[@]"
Used for instance as:
that-script /dest/folder 1G *
To move as many files as necessary from the expansion of that *
glob to make up at least 1GiB.
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors ofdu
to/dev/null
(du 2> /dev/null
instead ofdu
).
– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNUdu
but only if I ignore the SIGPIPE signal (as in(trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you rungrep SigIgn /proc/self/status
?
– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
add a comment |
On a GNU system, you could script it as:
#! /bin/bash -
usage()
printf >&2 '%sn' "Usage: $0 <destination> <size> [<file1> [<file2>...]]"
exit 1
(($# >= 2)) || usage
dest=$1
size=$(numfmt --from=iec <<< "$2") || usage
shift 2
(($# == 0)) && exit
selected=()
sum=0
shopt -s lastpipe
LC_ALL=C du -s --null --block-size=1 -- "$@" |
while
((sum < size)) &&
IFS= read -rd '' rec &&
s=$rec%%$'t'* &&
file=$rec#*$'t'
do
selected+=("$file")
((sum += s))
done
(($#selected[@] == 0)) ||
exec mv -t "$dest" -- "$selected[@]"
Used for instance as:
that-script /dest/folder 1G *
To move as many files as necessary from the expansion of that *
glob to make up at least 1GiB.
On a GNU system, you could script it as:
#! /bin/bash -
usage()
printf >&2 '%sn' "Usage: $0 <destination> <size> [<file1> [<file2>...]]"
exit 1
(($# >= 2)) || usage
dest=$1
size=$(numfmt --from=iec <<< "$2") || usage
shift 2
(($# == 0)) && exit
selected=()
sum=0
shopt -s lastpipe
LC_ALL=C du -s --null --block-size=1 -- "$@" |
while
((sum < size)) &&
IFS= read -rd '' rec &&
s=$rec%%$'t'* &&
file=$rec#*$'t'
do
selected+=("$file")
((sum += s))
done
(($#selected[@] == 0)) ||
exec mv -t "$dest" -- "$selected[@]"
Used for instance as:
that-script /dest/folder 1G *
To move as many files as necessary from the expansion of that *
glob to make up at least 1GiB.
edited Jan 30 at 9:25
answered Jan 29 at 10:40
Stéphane ChazelasStéphane Chazelas
306k57577931
306k57577931
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors ofdu
to/dev/null
(du 2> /dev/null
instead ofdu
).
– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNUdu
but only if I ignore the SIGPIPE signal (as in(trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you rungrep SigIgn /proc/self/status
?
– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
add a comment |
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors ofdu
to/dev/null
(du 2> /dev/null
instead ofdu
).
– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNUdu
but only if I ignore the SIGPIPE signal (as in(trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you rungrep SigIgn /proc/self/status
?
– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
This looks like exactly what I'm after, but I'm getting du: write error. It's doing the job, but is that error avoidable?
– Tod
Jan 29 at 15:55
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors of
du
to /dev/null
(du 2> /dev/null
instead of du
).– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can't reproduce it. What operating system are you using? You can always redirect all the errors of
du
to /dev/null
(du 2> /dev/null
instead of du
).– Stéphane Chazelas
Jan 29 at 16:51
@Tod, I can reproduce with older versions of GNU
du
but only if I ignore the SIGPIPE signal (as in (trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you run grep SigIgn /proc/self/status
?– Stéphane Chazelas
Jan 29 at 16:55
@Tod, I can reproduce with older versions of GNU
du
but only if I ignore the SIGPIPE signal (as in (trap '' PIPE; du -s /bin/*) | head -n 1
). SIGPIPE should not be ignored under normal conditions though. what do you get if you run grep SigIgn /proc/self/status
?– Stéphane Chazelas
Jan 29 at 16:55
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
I'm using Slackware 14.2. the result of that command: SigIgn: 0000000000001000
– Tod
Jan 30 at 8:33
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
@Tod, yes, it seems you have SIGPIPE ignored, which is wrong. It would be worth investigating how you ended up in that situation.
– Stéphane Chazelas
Jan 30 at 9:19
add a comment |
You could pretty much do the exact same thing within the terminal:
First execute cd /path/to/full/drive/
to get into the filled up drive's root folder.
Then, to view the capacity taken by each folder inside that drive you could use du -hd1
(assuming the GNU implementation of du
).
Explanation: du
(Disk Usage) runs recursively on your file tree from current folder, printing the capacity used by each folder. By default it's printed as number of 512-byte units or kibibytes (depending on whether POSIXLY_CORRECT is in the environment which is somewhat unreadable), and so the -h
option tells it to print sizes as "human readable" (converted to MB/GB). The d
parameter forces du
to stop its descent into the file tree after reaching the specified "depth" (in this case 1).
Once you find a specific directory you'd like to move content from you could use ls -lh
to view file sizes inside this directory to identify specific files to move. Here the h
is once again for printing sizes as "human readable", and -l
is to get the "long" format which includes file sizes.
Bonus point: You could pipe du
into sort
(here again assuming GNU sort
) to get the output sorted by size (assuming the file names don't contain newline characters) to make things easier like so:
du -hd1 | sort -h
and ls
can sort the output by size as well when providing the -S
option:
ls -lhrS
Finally, to move files/folders you can use the mv /path/to/source /path/to/target
command.
I'm assuming that you know what is the root folder of the relevant drive.
1
On Linux, and some other Unices,ls -lS
will sort by size. Your pipelinels -lh | sort -h
would not sort by size.
– Kusalananda
Jan 29 at 10:01
1
@Kusalananda,ls -S
is now POSIX.ls -h
is not (neither aredu -h
, nordu -d1
all GNU extensions, nothing to do with Linux).
– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,ls -S
is POSIX. I'm not keeping updated.
– Kusalananda
Jan 29 at 10:09
add a comment |
You could pretty much do the exact same thing within the terminal:
First execute cd /path/to/full/drive/
to get into the filled up drive's root folder.
Then, to view the capacity taken by each folder inside that drive you could use du -hd1
(assuming the GNU implementation of du
).
Explanation: du
(Disk Usage) runs recursively on your file tree from current folder, printing the capacity used by each folder. By default it's printed as number of 512-byte units or kibibytes (depending on whether POSIXLY_CORRECT is in the environment which is somewhat unreadable), and so the -h
option tells it to print sizes as "human readable" (converted to MB/GB). The d
parameter forces du
to stop its descent into the file tree after reaching the specified "depth" (in this case 1).
Once you find a specific directory you'd like to move content from you could use ls -lh
to view file sizes inside this directory to identify specific files to move. Here the h
is once again for printing sizes as "human readable", and -l
is to get the "long" format which includes file sizes.
Bonus point: You could pipe du
into sort
(here again assuming GNU sort
) to get the output sorted by size (assuming the file names don't contain newline characters) to make things easier like so:
du -hd1 | sort -h
and ls
can sort the output by size as well when providing the -S
option:
ls -lhrS
Finally, to move files/folders you can use the mv /path/to/source /path/to/target
command.
I'm assuming that you know what is the root folder of the relevant drive.
1
On Linux, and some other Unices,ls -lS
will sort by size. Your pipelinels -lh | sort -h
would not sort by size.
– Kusalananda
Jan 29 at 10:01
1
@Kusalananda,ls -S
is now POSIX.ls -h
is not (neither aredu -h
, nordu -d1
all GNU extensions, nothing to do with Linux).
– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,ls -S
is POSIX. I'm not keeping updated.
– Kusalananda
Jan 29 at 10:09
add a comment |
You could pretty much do the exact same thing within the terminal:
First execute cd /path/to/full/drive/
to get into the filled up drive's root folder.
Then, to view the capacity taken by each folder inside that drive you could use du -hd1
(assuming the GNU implementation of du
).
Explanation: du
(Disk Usage) runs recursively on your file tree from current folder, printing the capacity used by each folder. By default it's printed as number of 512-byte units or kibibytes (depending on whether POSIXLY_CORRECT is in the environment which is somewhat unreadable), and so the -h
option tells it to print sizes as "human readable" (converted to MB/GB). The d
parameter forces du
to stop its descent into the file tree after reaching the specified "depth" (in this case 1).
Once you find a specific directory you'd like to move content from you could use ls -lh
to view file sizes inside this directory to identify specific files to move. Here the h
is once again for printing sizes as "human readable", and -l
is to get the "long" format which includes file sizes.
Bonus point: You could pipe du
into sort
(here again assuming GNU sort
) to get the output sorted by size (assuming the file names don't contain newline characters) to make things easier like so:
du -hd1 | sort -h
and ls
can sort the output by size as well when providing the -S
option:
ls -lhrS
Finally, to move files/folders you can use the mv /path/to/source /path/to/target
command.
I'm assuming that you know what is the root folder of the relevant drive.
You could pretty much do the exact same thing within the terminal:
First execute cd /path/to/full/drive/
to get into the filled up drive's root folder.
Then, to view the capacity taken by each folder inside that drive you could use du -hd1
(assuming the GNU implementation of du
).
Explanation: du
(Disk Usage) runs recursively on your file tree from current folder, printing the capacity used by each folder. By default it's printed as number of 512-byte units or kibibytes (depending on whether POSIXLY_CORRECT is in the environment which is somewhat unreadable), and so the -h
option tells it to print sizes as "human readable" (converted to MB/GB). The d
parameter forces du
to stop its descent into the file tree after reaching the specified "depth" (in this case 1).
Once you find a specific directory you'd like to move content from you could use ls -lh
to view file sizes inside this directory to identify specific files to move. Here the h
is once again for printing sizes as "human readable", and -l
is to get the "long" format which includes file sizes.
Bonus point: You could pipe du
into sort
(here again assuming GNU sort
) to get the output sorted by size (assuming the file names don't contain newline characters) to make things easier like so:
du -hd1 | sort -h
and ls
can sort the output by size as well when providing the -S
option:
ls -lhrS
Finally, to move files/folders you can use the mv /path/to/source /path/to/target
command.
I'm assuming that you know what is the root folder of the relevant drive.
edited Jan 29 at 10:11
Stéphane Chazelas
306k57577931
306k57577931
answered Jan 29 at 9:56
Michael SvitMichael Svit
112
112
1
On Linux, and some other Unices,ls -lS
will sort by size. Your pipelinels -lh | sort -h
would not sort by size.
– Kusalananda
Jan 29 at 10:01
1
@Kusalananda,ls -S
is now POSIX.ls -h
is not (neither aredu -h
, nordu -d1
all GNU extensions, nothing to do with Linux).
– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,ls -S
is POSIX. I'm not keeping updated.
– Kusalananda
Jan 29 at 10:09
add a comment |
1
On Linux, and some other Unices,ls -lS
will sort by size. Your pipelinels -lh | sort -h
would not sort by size.
– Kusalananda
Jan 29 at 10:01
1
@Kusalananda,ls -S
is now POSIX.ls -h
is not (neither aredu -h
, nordu -d1
all GNU extensions, nothing to do with Linux).
– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,ls -S
is POSIX. I'm not keeping updated.
– Kusalananda
Jan 29 at 10:09
1
1
On Linux, and some other Unices,
ls -lS
will sort by size. Your pipeline ls -lh | sort -h
would not sort by size.– Kusalananda
Jan 29 at 10:01
On Linux, and some other Unices,
ls -lS
will sort by size. Your pipeline ls -lh | sort -h
would not sort by size.– Kusalananda
Jan 29 at 10:01
1
1
@Kusalananda,
ls -S
is now POSIX. ls -h
is not (neither are du -h
, nor du -d1
all GNU extensions, nothing to do with Linux).– Stéphane Chazelas
Jan 29 at 10:07
@Kusalananda,
ls -S
is now POSIX. ls -h
is not (neither are du -h
, nor du -d1
all GNU extensions, nothing to do with Linux).– Stéphane Chazelas
Jan 29 at 10:07
@StéphaneChazelas Ah,
ls -S
is POSIX. I'm not keeping updated.– Kusalananda
Jan 29 at 10:09
@StéphaneChazelas Ah,
ls -S
is POSIX. I'm not keeping updated.– Kusalananda
Jan 29 at 10:09
add a comment |
Use du -hd1
-h prints size in human readable format
-d <1> is the depth for directory.
Example:
$ du -hd1
11G ./dir1
9.5G. ./dir2
11G ./dir3
6.3G ./dir4
9.1G ./dir5
6.4G ./dir6
4.8G ./dir7
58G .
add a comment |
Use du -hd1
-h prints size in human readable format
-d <1> is the depth for directory.
Example:
$ du -hd1
11G ./dir1
9.5G. ./dir2
11G ./dir3
6.3G ./dir4
9.1G ./dir5
6.4G ./dir6
4.8G ./dir7
58G .
add a comment |
Use du -hd1
-h prints size in human readable format
-d <1> is the depth for directory.
Example:
$ du -hd1
11G ./dir1
9.5G. ./dir2
11G ./dir3
6.3G ./dir4
9.1G ./dir5
6.4G ./dir6
4.8G ./dir7
58G .
Use du -hd1
-h prints size in human readable format
-d <1> is the depth for directory.
Example:
$ du -hd1
11G ./dir1
9.5G. ./dir2
11G ./dir3
6.3G ./dir4
9.1G ./dir5
6.4G ./dir6
4.8G ./dir7
58G .
answered Jan 29 at 9:48
rajaganesh87rajaganesh87
7382825
7382825
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%2f497391%2fhow-to-find-the-first-x-gb-of-data%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
Can you run
mc
?– Kamil Maciorowski
Jan 29 at 9:44
If not a dupe, at least related: Tracking down where disk space has gone on Linux?
– Kusalananda
Jan 29 at 9:51