---
title: "查看文件大小"
author: "vergilwang"
date: "2013-06-13T16:22:00Z"
tags: []
categories: ["操作系统"]
slug: "untitled"
draft: false
lastmod: "2014-02-15T14:20:55Z"
id: 2011179
url: "https://vergilwang.iteye.com/blog/2011179"
---

du -sh * | sort -n 统计当前文件夹(目录)大小，并按文件大小排序

附送:

du -sk filename查看指定文件大小

&lt;wbr&gt;&lt;/wbr&gt;

Linux:ls以K、M、G为单位查看文件大小

Linux:ls以K、M、G为单位查看文件大小。  
#man ls  
……  
\-h, --human-readable  
print sizes in human readable format (e.g., 1K 234M 2G)  
……  
\# ls  
cuss.war nohup.out  
\# ls -l  
total 30372  
\-rw-r--r-- 1 root root 31051909 May 24 10:07 cuss.war  
\-rw------- 1 root root 0 Mar 20 13:52 nohup.out  
\# ls -lh  
total 30M  
\-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war  
\-rw------- 1 root root 0 Mar 20 13:52 nohup.out  
\# ll -h  
total 30M  
\-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war  
\-rw------- 1 root root 0 Mar 20 13:52 nohup.out

\[root@localhost rice\_f2]# ls -lhs  
总计 28G  
&lt;wbr&gt;15G -rw-r--r-- 1 root root&lt;wbr&gt;15G 06-04 14:35 all.txt&lt;br&gt; 8.0K -rwx--x--x 1 root root&lt;wbr&gt;632 06-04 15:57 hash.pl&lt;br&gt; 371M -rw-r--r-- 1 root root 371M 06-03 18:06 1.fa&lt;br&gt; 360M -rw-r--r-- 1 root root 359M 06-03 18:07 2.fna&lt;br&gt; 8.0K drwxr-xr-x 2 root root 4.0K 06-03 19:13 lane&lt;br&gt;&lt;wbr&gt;24K drwxr-xr-x 2 root root&lt;wbr&gt;20K 06-04 15:03 111&lt;br&gt; 3.1G -rw-r--r-- 1 root root 3.1G 06-04 15:32 sample1.txt&lt;br&gt; 2.4G -rw-r--r-- 1 root root 2.4G 06-04 15:53 sample2.txt&lt;br&gt; 1.4G -rw-r--r-- 1 root root 1.4G 06-04 16:11 sample3.txt&lt;br&gt; 1.3G -rw-r--r-- 1 root root 1.3G 06-04 16:11 sample4.txt&lt;br&gt; 4.2G -rw-r--r-- 1 root root 4.2G 06-04 14:51 22222.txt&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;