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. 在本篇我们来学习一下文件系统的其他特性和一个文件的属性,涉及的函数功能包括: 查看文件的所有属性: 改变文件所 ...
随机推荐
- tar 打包压缩
tar命令详解 -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用 ...
- hibernate log4j 输出sql
applicationContext.xml <bean id="sessionFactory" class="org.springframework ...
- word表分页表头
选中表,右键-表格属性. 调出表格属性对话框. 选择行,在各页顶端以标题行形式重复出现划上钩确定.
- 一道有意思的找规律题目 --- CodeForces - 964A
题目连接: https://vjudge.net/problem/1502082/origin 这一题第一眼看过去貌似是模拟,但是根据其范围是1e9可以知道,如果暴力解基本上是不可能的(不排除大佬级优 ...
- 一个用SAM维护多个串的根号特技
一个用SAM维护多个串的根号特技 基本介绍 在多个串的字符串题中,往往会出现一类题需要用到某个子串是否在一些母串中出现.此时对于 \(\text{parent}\) 树的 \(\text{right} ...
- Shell脚本笔记(三)shell中的数学计算
shell中的数学计算 一.使用方括号 #!/bin/bash a= b= c= res=$[$a * ($c-$b)] echo $res 二.使用(()) +)) ((i=+)) b=$((-*) ...
- BZOJ4964 : 加长的咒语
把$($看作$-1$,$)$看作$1$,设$a$为前缀和,则相当于找两个位置$x,y$使得$a[x]=a[y]$,且$a[x]$是$[x,y]$的区间最大值. 求出询问区间的最大值$o$,然后找到$o ...
- [BZOJ1899][ZJOI2004]Lunch 午餐 (DP)
比较水的DP 但是比较难想 整体思路还是很好理解的 在洛谷的题解里有一个一维的 > 什么时候去看一下 下面发我的代码 #include<bits/stdc++.h> #define ...
- Yii2 数据搜索类 PostSearch
数据搜索类 PostSearch /** * @Purpose : 添加 authorName 属性,使属性和搜索表单相对应 * @return array */ public function at ...
- JS膏集01
JS膏集01 1.动态页面: 向服务器发送请求,服务器那边没有页面,动态生成后,返回给客户端 由html/css/js组成. js还不是面向对象的语言,是基于对象的语言.js中没有类的概念,js的继承 ...