how-can-i-see-the-size-of-files-and-directories-in-linux
It's simple. Use ls
command for files and du
command for directories.
Checking File Sizes
ls -l filename /* Size of the file*/
ls -l * /* Size of All the files in the current directory */
ls -al * /* Size of All the files including hidden files in the current directory */
ls -al dir/ /* Size of All the files including hidden files in the 'dir' directory */
ls
command will not list the actual size of directories(why?). Therefore, we use du
for this purpose.
Checking Directory sizes
du -sh directory_name /* Gives you the summarized(-s) size of the directory in human readable(-h) format*/
du -bsh * /* Gives you the apparent(-b) summarized(-s) size of all the files and directories in the current directory in human readable(-h) format*/
Including -h
option in any of the above commands (for Ex: ls -lh *
or du -sh
) will give you size in human readable format (kb
, mb
,gb
, ...)
For more information see man ls
and man du
how-can-i-see-the-size-of-files-and-directories-in-linux的更多相关文章
- 10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories
The Linux “du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk ...
- Files and Directories
Files and Directories Introduction In the previous chapter we coveredthe basic functions that pe ...
- Notes for Apue —— chapter 4 Files and Directories(文件和目录)
4.1 Introduction 4.2 stat, fstat, fstatat, and lstat Functions The lstat function is similar to stat ...
- 【原】The Linux Command Line - Manipulation Files And Directories
cp - Copy Files and directories mv - move/rename files and directories mkdir - create directories rm ...
- How to ignore files and directories in subversion?
Step 1 Copy the files and directories to other place. Step 2 Delete the files and directories. Step ...
- Getting svn to ignore files and directories
August 27, 2013Software Developmentresources, subversion, svn, tutorial, version control Who knew it ...
- Finding files on a *nix/Linux and sorting by size
1. Finding files on *NIX and sort by size find ~ -iregex ".*/*.sh" -type f -print0 | xargs ...
- UNIX高级环境编程(4)Files And Directories - umask、chmod、文件系统组织结构和链接
本篇主要介绍文件和文件系统中常用的一些函数,文件系统的组织结构和硬链接.符号链接. 通过对这些知识的了解,可以对Linux文件系统有更为全面的了解. 1 umask函数 之前我们已经了解了每个文件 ...
- UNIX高级环境编程(5)Files And Directories - 文件相关时间,目录文件相关操作
1 File Times 每个文件会维护三个时间字段,每个字段代表的时间都不同.如下表所示: 字段说明: st_mtim(the modification time)记录了文件内容最后一次被修改的时 ...
- UNIX高级环境编程(3)Files And Directories - stat函数,文件类型,和各种ID
在前面的两篇,我们了解了IO操作的一些基本操作函数,包括open.read和write. 在本篇我们来学习一下文件系统的其他特性和一个文件的属性,涉及的函数功能包括: 查看文件的所有属性: 改变文件所 ...
随机推荐
- Hibernate中Restrictions查询用法(转)
Restrictions查询用法 HQL运算符 QBC运算符 含义 = Restrictions.eq() 等于equal <> Restrictions.ne() 不等于not equa ...
- [PA2014]Żarówki
[PA2014]Żarówki 题目大意: 有\(n(n\le5\times10^5)\)个房间和\(n\)盏灯,你需要在每个房间里放入一盏灯.每盏灯都有一定功率\(p_i\),每间房间都需要功率不小 ...
- Android EditText设置为Number类型后获取数字
s_video_seg1 = Integer.parseInt(video_seg1.getEditableText().toString().trim()); 此处要使用getEditableTex ...
- [P1516]青蛙的约会 (扩展欧几里得/中国剩余定理?)
每日做智推~ 一看就是一道数学题. 再看是一道公约数的题目. 标签是中国孙子定理. 题解是扩展欧几里得 (笑) 一开始没看数据范围 只有50分 开一个longlong就可以了 #include< ...
- Js全等和等于
Javascript只有六个假值(用在条件if的判断) 全等于 类型不同,返回false类型相同,则 等于 类型相同:同上=== 类型不同:尝试类型转换==[不是真值和假值的比较] null == u ...
- python网络编程(三)
udp网络通信过程 udp应用:echo服务器 参考代码 #coding=utf-8 from socket import * #1. 创建套接字 udpSocket = socket(AF_INET ...
- es6冲刺02
1.Symbol es6新增的数据类型 1)概念 提供一个独一无二的值 let a=Symbol() let b=Symbol() 或 let c=Symbol.for('c') let d=Symb ...
- Kubernetes中的Configmap和Secret
本文的试验环境为CentOS 7.3,Kubernetes集群为1.11.2,安装步骤参见kubeadm安装kubernetes V1.11.1 集群 应用场景:镜像往往是一个应用的基础,还有很多需要 ...
- SpringCloud无废话入门04:Hystrix熔断器及监控
1.断路器(Circuit Breaker)模式 在上文中,我们人为停掉了一个provider,在实际的生产环境中,因为意外某个服务down掉,甚至某一层服务down掉也是会是有发生的.一旦发生这种情 ...
- androidstudio全局搜索快捷键Ctrl+Shift+F失效的解决办法
与输入法设置冲突!!修改了就可以了.用的搜狗输入法,它的此快捷键也为简繁体替换.修改成其他的即可 null