Linux查询磁盘文件内存占用情况-du指令使用简介
1.在服务器输入下面指令--help作用是查询方法使用教程du --help # 会出现 Usage: du [OPTION]... [FILE]... or: du [OPTION]... --files0-fromF Summarize disk usage of the set of FILEs, recursively for directories.2.常用参数介绍# 其中 [OPTION] 是指令对应的操作[FILE] 是你要操作的目录地址。 # 推荐几个常用方法-字母是方法简写--字符串是方法全名 内存容量单位 -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) 查询目录的最大深度 -d, --max-depthN print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth0 is the same as --summarize 排除指定文件 -X, --exclude-fromFILE exclude files that match any pattern in FILE --excludePATTERN exclude files that match PATTERN3.例如 du -h --max-depth1 /mnt/d/soft补充针对上面的内容可以通过管道符 |的进行更进一步的筛选例如文件大小排序、获取前多少条等等。下面列举示例供参考# 对文件行排序可以使用sort对于sort方法的使用可以按照步骤1查询方法使用介绍。 sort --help Usage: sort [OPTION]... [FILE]... or: sort [OPTION]... --files0-fromF Write sorted concatenation of all FILE(s) to standard output. 容量单位从小到大 -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G) 排序反转 -r, --reverse reverse the result of comparisons # 获取内存较大的前多少条使用head同样按照步骤1查询方法使用介绍。 head --help Usage: head [OPTION]... [FILE]... Print the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. 指定数目-n, --lines[-]NUM print the first NUM lines instead of the first 10; with the leading -, print all but the last NUM lines of each file使用示例按照内存占用倒排du -h --max-depth1 /mnt/d/soft | sort -rh获取第一条du -h --max-depth1 /mnt/d/soft | head -n 1今日学习笔记结束。

相关新闻

最新新闻

日新闻

周新闻

月新闻