du命令

2023-10-27

du命令

NAME
du - estimate file space usage
估计文件空间使用情况

SYNOPSIS
du [OPTION]… [FILE]…
du [OPTION]… --files0-from=F

DESCRIPTION
Summarize disk usage of the set of FILEs, recursively for directories.
递归地总结一组文件的磁盘使用情况。(du命令的对象是目录)

   Mandatory arguments to long options are mandatory for short options too.
   长期权的强制参数对于短期权也是强制参数。

查看指定目录大小

在这里插入图片描述

查看指定文件大小

在这里插入图片描述

递归查询文件大小

   -0, --null
          end each output line with NUL, not newline
          用NUL结束每个输出行,而不是换行

   -a, --all
          write counts for all files, not just directories
          递归式写计数的所有文件,不只是目录

在这里插入图片描述
可见如果只是du则递归查询当前所有目录的大小
如果指定-a,则也也递归查询所有文件大小

   --apparent-size
          print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes in ('sparse') files, internal fragmentation, indirect blocks, and the like

   -B, --block-size=SIZE
          scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes; see SIZE format below

按指定内存单位查看

   -b, --bytes
          equivalent to '--apparent-size --block-size=1'
          内存单位为字节

在这里插入图片描述
-k like --block-size=1K
在这里插入图片描述

   -m     like --block-size=1M

打印出total总大小

   -c, --total
          produce a grand total
          合计 打印多了一个total

在这里插入图片描述

   -D, --dereference-args
          dereference only symlinks that are listed on the command line

指定递归层级

   -d, --max-depth=N
          print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument;  --max-depth=0 is the same as --summarize
          仅当目录(或文件)在命令行参数以下N个或更少的级别时,才打印目录(或文件)的total;——max-depth=0等于——summary

只打印第一级目录
在这里插入图片描述

   --files0-from=F
          summarize disk usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input

   -H     equivalent to --dereference-args (-D)

人性化输出结果(带单位)

   -h, --human-readable
          print sizes in human readable format (e.g., 1K 234M 2G)
          以人类可读格式列印尺寸(例如1K 234M 2G)

在这里插入图片描述
–inodes
list inode usage information instead of block usage

   -L, --dereference
          dereference all symbolic links

   -l, --count-links
          count sizes many times if hard linked



   -P, --no-dereference
          don't follow any symbolic links (this is the default)

   -S, --separate-dirs
          for directories do not include size of subdirectories

   --si   like -h, but use powers of 1000 not 1024

只显示文件总大小(-s 常用)

   -s, --summarize
          display only a total for each argument
          只显示每个参数的总数

在这里插入图片描述
显示当前目录下各个文件大小(包括目录和文件夹)
在这里插入图片描述
-t, --threshold=SIZE
exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative

   --time show time of the last modification of any file in the directory, or any of its subdirectories

   --time=WORD
          show time as WORD instead of modification time: atime, access, use, ctime or status

   --time-style=STYLE
          show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT; FORMAT is interpreted like in 'date'

   -X, --exclude-from=FILE
          exclude files that match any pattern in FILE

   --exclude=PATTERN
          exclude files that match PATTERN

   -x, --one-file-system
          skip directories on different file systems

   --help display this help and exit

   --version
          output version information and exit

   Display values are in units of the first available SIZE from --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.  Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

   The SIZE argument is an integer and optional unit (example: 10K is 10*1024).  Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).

PATTERNS
PATTERN is a shell pattern (not a regular expression). The pattern ? matches any one character, whereas * matches any string (composed of zero, one or multiple characters). For example, *.o will match any files whose names
end in .o. Therefore, the command

          du --exclude='*.o'

   will skip all files and subdirectories ending in .o (including the file .o itself).

df命令

   df - report file system disk space usage
   报告文件系统磁盘空间使用情况

SYNOPSIS
df [OPTION]… [FILE]…

DESCRIPTION
This manual page documents the GNU version of df. df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted
file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
此手册页记录了df的GNU版本。df显示包含每个文件名参数的文件系统上可用的磁盘空间量。如果没有指定文件名,则当前挂载的所有文件上的可用空间
显示了文件系统。磁盘空间默认显示为1K块,除非设置了环境变量POSIXLY_CORRECT,在这种情况下使用512字节的块。

    df命令用于显示磁盘分区上的可使用的磁盘空间。默认显示单位为KB。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息

   If an argument is the absolute file name of a disk device node containing a mounted file system, df shows the space available on that file system rather than on the file system containing the device node.  This version of  df
   cannot show the space available on unmounted file systems, because on most kinds of systems doing so requires very nonportable intimate knowledge of file system structures.

OPTIONS
Show information about the file system on which each FILE resides, or all file systems by default.
显示每个文件所在的文件系统的信息,默认情况下显示所有文件系统的信息。
没有指定挂载点时,显示所有挂载点的文件系统:

   Mandatory arguments to long options are mandatory for short options too.

查看全部文件系统,单位默认KB

在这里插入图片描述
在这里插入图片描述

   -a, --all
          include pseudo, duplicate, inaccessible file systems
          包括伪、复制、不可访问的文件系统

在这里插入图片描述
-B, --block-size=SIZE
scale sizes by SIZE before printing them; e.g., ‘-BM’ prints sizes in units of 1,048,576 bytes; see SIZE format below

查看指定文件系统

在这里插入图片描述

人性化打印(-h)

   -h, --human-readable
          print sizes in powers of 1024 (e.g., 1023M)
          列印尺寸以1024倍(例如1023M)为单位

在这里插入图片描述
-H, --si
print sizes in powers of 1000 (e.g., 1.1G)
列印尺寸(例如1.1G)

   -i, --inodes
          list inode information instead of block usage

   -k     like --block-size=1K

   -l, --local
          limit listing to local file systems

   --no-sync
          do not invoke sync before getting usage info (default)

   --output[=FIELD_LIST]
          use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.

   -P, --portability
          use the POSIX output format

   --sync invoke sync before getting usage info

   --total
          elide all entries insignificant to available space, and produce a grand total

   -t, --type=TYPE
          limit listing to file systems of type TYPE

   -T, --print-type
          print file system type

   -x, --exclude-type=TYPE
          limit listing to file systems not of type TYPE

   -v     (ignored)

   --help display this help and exit

   --version
          output version information and exit

   Display values are in units of the first available SIZE from --block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.  Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

   The SIZE argument is an integer and optional unit (example: 10K is 10*1024).  Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).

   FIELD_LIST is a comma-separated list of columns to be included.  Valid field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent', 'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

du命令 的相关文章

  • C++:Linux平台上的线程同步场景

    我正在为 Linux 平台实现多线程 C 程序 其中我需要类似于 WaitForMultipleObjects 的功能 在搜索解决方案时 我发现有一些文章描述了如何在 Linux 中实现 WaitForMultipleObjects 功能
  • 如何从远程 ssh 连接上运行的 tmux(复制模式)复制到本地剪贴板

    我通过 OS X 上的 VirtualBox 运行 Linux 我通过在无头状态下运行虚拟机 然后使用端口转发 sshing 到 Linux 机器来实现这一点 现在 无论复制到我的虚拟机上的剪贴板 我都可以粘贴到我的远程 ssh 会话上 但
  • 如何在 Linux/OS X 上温和地终止 Firefox 进程

    我正在使用 Firefox 进行一些自动化操作 尽管我可以从 shell 打开 Firefox 窗口 但我无法正确终止它 如果我kill火狐进程与kill 3 or kill 2当我下次打开新的 Firefox 窗口时 命令会询问我是否要在
  • 使用c在linux上分块读写

    我有一个 ASCII 文件 其中每一行都包含一个可变长度的记录 例如 Record 1 15 characters Record 2 200 characters Record 3 500 characters Record n X cha
  • 裸机交叉编译器输入

    裸机交叉编译器的输入限制是什么 比如它不编译带有指针或 malloc 的程序 或者任何需要比底层硬件更多的东西 以及如何才能找到这些限制 我还想问 我为目标 mips 构建了一个交叉编译器 我需要使用这个交叉编译器创建一个 mips 可执行
  • 为什么docker容器提示“权限被拒绝”?

    我使用以下命令来运行 docker 容器 并从主机映射目录 root database 到容器 tmp install database docker run it name oracle install v root database t
  • 运行 shell 命令并将输出发送到文件?

    我需要能够通过 php 脚本修改我的 openvpn 身份验证文件 我已将我的 http 用户设置为免通 sudoer 因为这台机器仅在我的家庭网络中可用 我目前有以下命令 echo shell exec sudo echo usernam
  • Visual Studio - X11:缺少 DISPLAY 环境变量

    我正在使用 Visual Studio 2019 Enterprise 开发跨平台 Windows Linux x64 GUI 应用程序 在这个 2019 版本中 我们可以使用 Visual Studio调试平台 Windows 本机 和
  • Grep 递归和计数

    需要在具有大量子目录的目录中搜索文件内的字符串 我在用着 grep c r string here 我怎样才能找到总数量 如何仅输出至少具有一个实例的文件 使用 Bash 的进程替换 这给出了我认为是您想要的输出 如果不是 请澄清问题 gr
  • 在嵌入式系统上将内核控制台发送到哪里?

    我正在开发一个嵌入式系统 该系统当前通过串行端口 1 上的控制台输出启动 Linux 使用启动加载程序中的控制台启动参数 然而 最终我们将使用这个串行端口 内核控制台输出的最佳解决方案是什么 dev null 能否以某种方式将其放在 pty
  • 从哪里获取 iostream.h

    我正在尝试在 Linux 中做一些事情 但它抱怨找不到 iostream h 我需要安装什么才能获取此文件 这个标准头的正确名称是iostream没有扩展名 如果您的编译器仍然找不到它 请尝试以下操作 find usr include na
  • Unix 中的访问时间是多少

    我想知道访问时间是多少 我在网上搜索但得到了相同的定义 读 被改变 我知道与touch我们可以改变它 谁能用一个例子来解释一下它是如何改变的 有没有办法在unix中获取创建日期 时间 stat结构 The stat 2 结构跟踪所有文件日期
  • 如果输入被重定向则执行操作

    我想知道如果我的输入被重定向 我应该如何在 C 程序中执行操作 例如 假设我有已编译的程序 prog 并且我将输入 input txt 重定向到它 我这样做 prog lt input txt 我如何在代码中检测到这一点 一般来说 您无法判
  • 为什么无论 -rdynamic 如何,backtrace 都不包含 Objective-C 符号?

    Update 我正在 Linux 上使用 GNU 运行时 问题是not发生在带有 Apple 运行时的 MacOS 上 更新2 我在 MacOS 上编译了 GNU 运行时并用它构建了示例 该错误确实not发生在带有 GNU 运行时的 Mac
  • 如何在 Linux 中向热敏打印机发送 ESC/POS 命令

    我正在尝试在热敏打印机上发送 ESC POS 命令 但每当我发送它们时 热敏打印机都会将它们打印为文本 而不是作为命令执行它们 我在 prn 文件中编写这些命令 每当我执行 lp 命令来打印文件时 这些 prn 文件也会被打印 但作为文本
  • C++ Linux GCC 应用程序中的 GUID

    我有很多服务器运行这个 Linux 应用程序 我希望他们能够生成一个碰撞概率较低的 GUID 我确信我可以从 dev urandom 中提取 128 个字节 这可能没问题 但是有没有一种简单易用的方法来生成与 Win32 更等效的 GUID
  • 使用 Python 将阿拉伯语或任何从右到左书写系统的字符串打印到 Linux 终端

    非常简单的例子是 city print city 我期望输出是 但实际上输出是相反的字符串 字母看起来有点不同 因为它们有开始 中间和结束形式 我无法将其粘贴到此处 因为复制粘贴会再次更正字符串的顺序 如何在 Linux 终端上正确打印阿拉
  • 打印 STDOUT/STDERR 并将它们写入 Bash 中的文件?

    有没有办法让 Bash 将 STDOUT STDERR 重定向到文件 但仍然将它们打印到终端 这会将 STDOUT 和 STDERR 重定向到同一个文件 some command 2 gt 1 tee file log Example to
  • 在 Linux 服务器上创建和编辑 MS-Word 文档?

    希望开发处理文档的服务器端应用程序 源文档大多是MS Word 2003 2007 即MS版本的Docx 希望服务器应用程序能够在linux或windows上运行 想知道在linux下读写MS Word文件最好的工具或库是什么 兼容性是最重
  • Linux 上的“软/硬 nofile”是什么意思

    当我尝试在RedHat EL5上安装软件时 我得到了错误 软 硬nofile的期望值是4096 而默认值是1024 我设法增加了这个数字 但我不知道参数是什么 他们指的是软链接和硬链接吗 我改变的方法是 a 修改 etc security

随机推荐

  • Typora + Gitee 配置图床_图片自动上传教程

    一 创建 Gitee 仓库 进入 Gitee 官网 注册一个属于自己的账号 点击创建仓库并且设置为开源 一定要是开源的public 只有这样你的图片才能被别人访问到 二 设置私人令牌 进入个人设置 gt 选择私人令牌进行创建 gt 设置自己
  • 华为od机考真题-HJ6-质数因子(简单)

    while 1 try num int input c 2 while c lt num 0 5 if num c 0 print c end
  • C++ Primer 学习笔记十五 —— 面向对象编程

    记录笔记原则 1 用简单易懂的语言叙述自己的理解 避免照搬原文 2 用实例说明 避免空洞 3 多做总结和横向对比 避免片面 面向对象三个基本概念 抽象 继承 动态绑定 继承使我们简化了类的定义 动态绑定使我们简化了接口的实现 使得所有继承层
  • 探究java IO之AutoCloseable,Closeable和Flushable接口

    http blog csdn net caiwenfeng for 23 article details 41862225 有3个接口对于流类相当重要 其中两个接口是Closeable和Flushable 它们是在java io包中定义的
  • BQ40Z50/BQ4050/BQ40Z80 等 BQ40xxx 系列电量计外围电路设计指导

    TI 电量计在消费和工业市场电池产品广泛应用 本文围绕电量计的功能逐一介绍电量计供电和 采样 对外交互 电池保护 电池均衡等外围电路设计 以帮助大家优化电量计电路设计 提高 开发效率 FAE 壹伍柒 陆陆贰陆 柒捌贰伍 1 电量计外围电路框
  • GPIO 8种工作模式

    GPIO 是什么 GPIO全称General Purpose Input Output 即通用输入 输出 其实GPIO的本质就是芯片的一个引脚 通常在ARM中所有的I O都是通用的 不过由于每个开发板上都会设计不同的外围电路 这就造成GPI
  • QT——操作数据库03

    目录标题 一 安装数据库 二 连接数据库 一 在项目的pro文件中增加一行代码 二 连接sqlite 三 封装连接数据库操作 三 增删查改例子 一 安装数据库 一般使用mysql或者sqlite mysql安装教程 sqlite安装教程 1
  • 多线程顺序打印的5种解法

    多线程同步的方式有许多 有传统的synchronized锁 还可以使用lock锁 下面列举多线程顺序打印的5种解法 算作对线程同步的一个总结 文章目录 经典面试题 多种解法 使用 Lock 使用 wait notify 使用 Lock Co
  • Win10添加开机自动运行软件三种方法(亲测可用)

    Win10管理开机启动项的方法相信大家已经非常熟悉 msconfig命令各系统都通用 那么很多用户发觉Win10和Win7 XP等系统不同 没有启动文件夹 那么我们怎么添加开机启动项呢 如晨软件或程序没有开机启动设置的话 是的 在Win10
  • JGit Authentication JGit验证机制

    验证机制在JGit中大部分与本地git相同 普遍使用SSH协议和HTTP S 协议和他们所支持的验证方法 这篇文章总结了如何使用JGit的验证API去安全连接远程GIT库 虽然在下面的例子中使用的是CloneCommand方法 但是它能实现
  • pip导包时产生错误,UnicodeDecodeError: 'gbk' codec can't decode byte.....illegal multibyte sequence(已解决)

    主要写了解决问题的思路 解决办法在最底部 pip导入python包时产生错误 ERROR Command errored out with exit status 1 command d python38 python exe c impo
  • 使用CSS3的Flex属性让元素居中

    div div
  • 腾讯云,搭建Docker环境

    安装与配置 Docker 任务时间 10min 20min 安装 Docker Docker 软件包已经包括在默认的 CentOS Extras 软件源里 因此想要安装 docker 只需要运行下面的 yum 命令 yum install
  • 【基于大数据的电信诈骗可视化分析-哔哩哔哩】 https://b23.tv/AxkY2Zj

    基于大数据的电信诈骗可视化分析 哔哩哔哩 https b23 tv AxkY2Zj https b23 tv AxkY2Zj
  • SOLIDWORKS如何定制化异型孔向导及其孔标注

    异型孔向导是SOLIDWORKS中一个极为方便的功能 只需要简单的几步设置就可以根据工程师设定好的标准 类型 大小创建符合标准的孔 包括 柱形沉头孔 锥形沉头孔 直孔 直螺纹孔 锥形螺纹孔等等 此外由于工程图和三维模型的协同关联 生成孔的公
  • Linux Vim 简介

    文章目录 01 编辑器 Gedit 介绍 02 什么是 Vi Vim 03 vim工作模式 4 1 命令模式 4 2 编辑模式 4 3 末行模式 04 vim教程 05 vim基本操作 06 vim实用操作 7 1 命令模式下的操作 7 2
  • Anaconda常用指令(详细讲解!!)这一篇文章就够啦!!!小白,新手一定要看的入门文章~~

    各位小伙伴们大家好 今天给大家分享一些关于Anaconda相关的指令 当使用Anaconda作为Python环境和包管理器时 掌握一些常用的指令可以更好地管理和维护您的开发环境 目录 创建和管理环境 安装和管理包 导出和导入环境 管理包仓库
  • Q3营收同比翻三倍,踩猛“油门”零跑必将领跑?

    近日 零跑汽车公布三季度财报 从财报成绩来看 有喜有忧 喜的是销量营收同比环比均出现大幅度增长 忧的是亏损同比扩大86 11 营收同比猛增398 5 销量能否穿越迷雾 详细来看 三季度零跑汽车销量3 56万辆 同比大增186 营收42 88
  • (C语言)打印锯齿矩阵

    关于锯齿矩阵 咱们先来看看题目要求 最近在参与计蒜客的实践 本题是关于链表 但小编想了好久 技术不精 还是没做出来 于是换成了自己比较习惯的结构体 原理 首先 我们需要记录需要插入的整数对应的行号 和这个整数 我用的是结构体 结构体看起来更
  • du命令

    文章目录 du命令 查看指定目录大小 查看指定文件大小 递归查询文件大小 按指定内存单位查看 打印出total总大小 指定递归层级 人性化输出结果 带单位 只显示文件总大小 s 常用 df命令 查看全部文件系统 单位默认KB 查看指定文件系