https://stackoverflow.com/questions/11720079/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 (kbmb,gb, ...)

For more information see man ls and man du

how-can-i-see-the-size-of-files-and-directories-in-linux的更多相关文章

  1. 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 ...

  2. Files and Directories

    Files and Directories Introduction     In the previous chapter we coveredthe basic functions that pe ...

  3. 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 ...

  4. 【原】The Linux Command Line - Manipulation Files And Directories

    cp - Copy Files and directories mv - move/rename files and directories mkdir - create directories rm ...

  5. 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 ...

  6. Getting svn to ignore files and directories

    August 27, 2013Software Developmentresources, subversion, svn, tutorial, version control Who knew it ...

  7. 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 ...

  8. UNIX高级环境编程(4)Files And Directories - umask、chmod、文件系统组织结构和链接

    本篇主要介绍文件和文件系统中常用的一些函数,文件系统的组织结构和硬链接.符号链接. 通过对这些知识的了解,可以对Linux文件系统有更为全面的了解.   1 umask函数 之前我们已经了解了每个文件 ...

  9. UNIX高级环境编程(5)Files And Directories - 文件相关时间,目录文件相关操作

     1 File Times 每个文件会维护三个时间字段,每个字段代表的时间都不同.如下表所示: 字段说明: st_mtim(the modification time)记录了文件内容最后一次被修改的时 ...

  10. UNIX高级环境编程(3)Files And Directories - stat函数,文件类型,和各种ID

    在前面的两篇,我们了解了IO操作的一些基本操作函数,包括open.read和write. 在本篇我们来学习一下文件系统的其他特性和一个文件的属性,涉及的函数功能包括: 查看文件的所有属性: 改变文件所 ...

随机推荐

  1. Adobe Premiere Pro生成峰值文件假死

    一.正文 使用Adobe的Premiere Pro CC进行视频剪辑制作的时候,有的时候在右下角总会出现一个“自动生成峰值文件”的提示符,并跟随一个进度条: 大部分时候,这并不会引起什么问题.虽然我也 ...

  2. Python爬虫:更加优雅的执行JavaScript(PyV8)

    https://www.jianshu.com/p/c534d6eb881a?utm_source=oschina-app

  3. Wan Android 项目总结

    Wan Android 项目总结 项目的由来 这个项目也算是自己学习了一段时间的Android以后的一个总结和学习吧,项目采用了Kotlin语言,Api采用的hongyang大神的WanAndroid ...

  4. AE插入音乐

    将音乐文件(如MP3文件)直接拖拽到工程里就可以. 然后添加到合成里. 点击内容预览 ,就自动播放了. 在合成窗口里面,我们可以对于音频文件进行拖动,以及裁剪等操作,但是需要注意的是AE里面不能预览声 ...

  5. 给有C或C++基础的Python入门 :Python Crash Course 1 - 3

    暑假ACM集训结束,预习下个学期要学习的Python. 前几章比较基础,玩玩学学很快学完了,这里随意写点收获. 第一章 搭建编译环境   用的是最新的Python3.编译器用的是推荐的Geany..具 ...

  6. 转 U-BOOT之stage1

    前言 本文主要是基于大家比较熟悉的 s3c2410 ,对移植 u-boot 时 stage1 过程进行一个分析,网上关于之方面的资料很多,但是几乎都只是对代码作注解,容易让人产生知其一不知其二的感觉, ...

  7. 潭州课堂25班:Ph201805201 django 项目 第四十三课 后台 用户管理前后功能实现 (课堂笔记)

    用户的展示,编辑,删除, 把用户显示出来,用户名,员工(是,否), 超级用户(是, 否) 活跃状态,(非活跃示为删除) 在前台要显示该用户所属的用户组,在前台代码中是调用类的属性,所以在 user 的 ...

  8. 小型资源管理器之动态添加TreeView节点

    FrmMain主界面 using System; using System.Collections.Generic; using System.ComponentModel; using System ...

  9. [Vijos1130][NOIP2001]数的计数 (递推)

    自己的递推一塌糊涂 考前抱佛脚 #include<bits/stdc++.h> using namespace std; ]; int main() { int n;scanf(" ...

  10. 初识hibernate——环境搭建

    一  配置过程 1. 创建一个项目 2. 导包    required里的包 optional里的c3p0连接池的三个包 数据库驱动包 Junit 3.创建Hibernate的配置文件(hiberna ...