Directories and files sorted by creation time
Du -H --time --max-# depth =. 1 |. Sort -R & lt -t $ '\ T' -k 2
. 30M 2020-04-01 14:54
28K is ./ 2020-04-01 13:25 .dbus
9.6 M 2020-04-01 13:25 ./.config
32K 2020-03-31 10:50 ./.gnupg
1.5M 2020-03-31 10:49 ./.vnc
228K 2020-03-31 10 : 49 ./.sogouinput
14M 2020-03-31 10:49 ./.mozilla
68K 2020-03-31 10:48 ./.local
4.4M 2020-03-31 10:47 ./.cache
8.0K 2020- 10:44 ./Desktop 03-31
8.0K 2020-03-23 16:47 ./.ssh
24K 2020-03-22 15:52 ./3d-haiguang-zhaoxim
4.0 K 2020-03-20 19:46. / Desktop
12K 2020-03-20 19:46 ./.presage
Next time required to sort, it is natural to think pipeline:
Pipe symbol unix is a very powerful symbol as a vertical line: "|".
Usage: command 1 | command 2 of his function is to command the result of the first command executed 1 as input passed to command2 command 2 and then use the results du pipeline to sort of sort
sort Command Summary
Function: Sort
Syntax: sort [-bcdfimMnr] [- o < output file>] [- T <separator character>] [+ <start column> - <End field>] [- help] [- verison ][file]
Parameters:
-b ignore the space character in front of each line start out.
When -d sorting, processing letters, numbers and space characters, but ignore other characters.
-f When ordering, lowercase letters as uppercase letters.
-i When ordering, in addition to ASCII characters between 040-176, ignore the other characters.
-c Check whether the file has been sorted in the order.
-m to merge several files sorted.
Front -M 3-letter abbreviation be sorted by month.
-n sorted in accordance with size values.
-o <output file> The results sorted into the specified file.
-r sorted in reverse order.
-t field when <separator character> Specifies the sort used separator characters.
-k specified domain
--help displays help.
--version display version information.
2, a combination of the following commands:
du -h --time --max-depth=1 . |grep 'M'| sort -r -t $'\t' -k 2
Wherein grep 'M' are only removed M sort level folder,
After the sort -t $ '\ t' refers to use the tab key string segmentation, -k 2 refers to the second column in accordance with the divided character string to sort:
----------------
Disclaimer: This article is CSDN bloggers' nickname let me try to think of "original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/classicer/java/article/details/52221596