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. 在本篇我们来学习一下文件系统的其他特性和一个文件的属性,涉及的函数功能包括: 查看文件的所有属性: 改变文件所 ...
随机推荐
- python数据结构之栈
栈 栈(stack),有些地方称为堆栈,是一种容器,可存入数据元素.访问元素.删除元素,它的特点在于只能允许在容器的一端(称为栈顶端指标,英语:top)进行加入数据(英语:push)和输出数据(英语: ...
- 《重回耶路撒冷——犹太人的三千年》(Return to Jerusalem)读后感
写在前面 书名:<重回耶路撒冷——犹太人的三千年>(Return to Jerusalem) 作者:张力升 来源:长清图书馆 阅读用时:其实年前拿到书,本来想寒假在家看的,但是在家一点儿都 ...
- 深入理解原型链(Prototype chain) __proto__
原型链(Prototype chain) 原型对象也是普通的对象,并且也有可能有自己的原型,如果一个原型对象的原型不为null的话,我们就称之为原型链(prototype chain). A prot ...
- 3.27模拟赛 sutoringu(后缀数组)
\(\color{white}{mjt是机房模拟赛独自切过题的唯一的人...}\) (应本人要求删掉惹) \(Description\) 给你\(n,k\)和长为\(n\)的字符串\(s\).一个区间 ...
- 2107 ACM 水题
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2107 题意:比较大小,即使简单还是没有一次过,粗心的我,终于放假了,虽然我平时课还是有点多,但是希望自己能 ...
- 如何在Android中的Activity启动第三方应用程序?
如何在点击某个按键后,执行启动第三方应用程序界面? /** * <功能描述> 启动应用程序 * * @return void [返回类型说明] */ private void startU ...
- 三十分钟学完Vue
基础知识: vue的生命周期: beforeCreate/created. beforeMount/mounted. beforeUpdate/updated. beforeDestory/desto ...
- redis(六)
安装包 到中文官网查找客户端代码 联网安装 sudo pip install redis 使用源码安装 unzip redis-py-master.zip cd redis-py-master sud ...
- 2017.07.06【NOIP提高组】模拟赛B组
Summary 今天比赛感觉题目很奇葩,都可以用许多简单方法来做,正确性都显然,当然也有点水,也就是说是考我们的数感和数学知识,而程序,只是代码的体现. 这次的时间安排感觉不错,因为很快就打完最后一道 ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) C. String Reconstruction 并查集
C. String Reconstruction 题目连接: http://codeforces.com/contest/828/problem/C Description Ivan had stri ...