Tuesday, April 19, 2005

Use ls -h to show Kilobyte, Megabyte, Gigabyte, etc

Use the -h switch when doing an ls to get a more readable filesize value (K for kilobyte,

M for megabyte, G for gigabyte), e.g.:

[root@server backup]# ls -altrh
total 9.4G
drwxr-xr-x 2 4294967294 4294967294 4.0K Oct 6 2004 last.txt
-rw-r--r-- 1 4294967294 4294967294 4.3G Oct 6 2004 backup.tgz
-rw-r--r-- 1 4294967294 4294967294 843M Nov 23 14:31 backup_20041123.tgz
-rw-r--r-- 1 4294967294 4294967294 863M Dec 4 02:33 backup_20041204.tgz
-rw-r--r-- 1 4294967294 4294967294 5.9M Jan 17 01:55 20050117.tgz
-rw-r--r-- 1 4294967294 4294967294 928M Jan 17 02:49 backup_20050117.tgz
-rw-r--r-- 1 4294967294 4294967294 960M Feb 2 15:03 backup_20050202.tgz
drwxr-xr-x 23 root root 4.0K Feb 25 18:12 ..
drwxrwxrwx 3 root root 4.0K Apr 3 01:28 .
-rw-r--r-- 1 4294967294 4294967294 1.6G Apr 3 03:36 backup_20050403.tgz
[root@server backup]#

1 comment:

Anonymous said...

niice
i will use it instead of #ls -la

thank you!