GNU 核心工具
GNU 核心工具
短目錄
- 1 介紹
- 2 通用選项
- 3 輸出整個文件
- 4 文件内容排版
- 5 輸出文件的一部分
- 6 文件的摘要(行数,单词数,校验和)
- 7 对已排序的文件进行操作
- 8 对字段进行操作
- 9 文字操作
- 10 目錄列表
- 11 基本操作
- 12 特殊文件類型
- 13 修改文件属性
- 14 磁盤使用情况報告
- 15 显示文本
- 16 条件
- 17 重定向
- 18 文件名稱操作
- 19 工作環境
- 20 用户信息
- 21 系统环境
- 22 SELinux context
- 23 Modified command invocation
- 24 進程控製
- 25 延时
- 26 数字操作
- 27 File permissions
- 28 文件的时間戳
- 29 日期输入的格式
- 30 Opening the Software Toolbox
- Appendix A GNU Free Documentation License
- 索引
目錄
- 1 介紹
- 2 通用選项
- 2.1 退出狀态
- 2.2 備份選项
- 2.3 塊大小
- 2.4 浮点数
- 2.5 专门指定的信號
- 2.6 chown, chgrp, chroot, id: Disambiguating user names and IDs
- 2.7 随机数据的来源
- 2.8 Target directory
- 2.9 Trailing slashes
- 2.10 Traversing symlinks
- 2.11 Treating / specially
- 2.12 Special built-in utilities
- 2.13 Standards conformance
- 2.14
coreutils: Multi-call program
- 3 輸出整個文件
- 4 文件内容排版
- 5 輸出文件的一部分
- 6 文件的摘要(行数,单词数,校验和)
- 7 对已排序的文件进行操作
- 8 对字段进行操作
- 9 文字操作
- 10 目錄列表
- 11 基本操作
- 12 特殊文件類型
- 13 修改文件属性
- 14 磁盤使用情况報告
- 15 显示文本
- 16 条件
- 17 重定向
- 18 文件名稱操作
- 19 工作環境
- 20 用户信息
- 21 系统环境
- 22 SELinux context
- 23 Modified command invocation
- 24 進程控製
- 25 延时
- 26 数字操作
- 27 File permissions
- 28 文件的时間戳
- 29 日期输入的格式
- 29.1 General date syntax
- 29.2 Calendar date items
- 29.3 Time of day items
- 29.4 Time zone items
- 29.5 Combined date and time of day items
- 29.6 Day of week items
- 29.7 Relative items in date strings
- 29.8 Pure numbers in date strings
- 29.9 Seconds since the Epoch
- 29.10 Specifying time zone rules
- 29.11 Authors of
parse_datetime
- 30 Opening the Software Toolbox
- Appendix A GNU Free Documentation License
- 索引
GNU 核心工具
本文檔是 GNU 核心工具 8.29版的手册,包含了用於文本和文本操作的標準程序。
Copyright © 1994-2017 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
| • 介紹: | Caveats, overview, and authors | |
| • 通用選項: | Common options | |
| • 輸出整個文件: | cat tac nl od base32 base64 | |
| • 文件内容排版: | fmt pr fold | |
| • 輸出文件的一部分: | head tail split csplit | |
| • 文件的摘要(行数,单词数,校验和): | wc sum cksum b2sum md5sum sha1sum sha2 | |
| • 对已排序的文件进行操作: | sort shuf uniq comm ptx tsort | |
| • 对字段进行操作: | cut paste join | |
| • 文字操作: | tr expand unexpand | |
| • 目錄列表: | ls dir vdir dircolors | |
| • 基本操作: | cp dd install mv rm shred | |
| • 特殊文件類型: | mkdir rmdir unlink mkfifo mknod ln link readlink | |
| • 修改文件属性: | chgrp chmod chown touch | |
| • 磁盤使用情况報告: | df du stat sync truncate | |
| • 显示文本: | echo printf yes | |
| • 条件: | false true test expr | |
| • 重定向: | tee | |
| • 文件名稱操作: | dirname basename pathchk mktemp realpath | |
| • 工作環境: | pwd stty printenv tty | |
| • 用户信息: | id logname whoami groups users who | |
| • 系统环境: | date arch nproc uname hostname hostid uptime | |
| • SELinux context: | chcon runcon | |
| • Modified command invocation: | chroot env nice nohup stdbuf timeout | |
| • 進程控製: | kill | |
| • 延时: | sleep | |
| • 数字操作: | factor numfmt seq | |
| • File permissions: | Access modes | |
| • 文件的时間戳: | File timestamp issues | |
| • 日期输入的格式: | Specifying date strings | |
| • Opening the software toolbox: | The software tools philosophy | |
| • GNU Free Documentation License: | Copying and sharing this manual | |
| • Concept index: | General index | |
|
|
||
|---|---|---|
|
||
| • 退出狀态: | Indicating program success or failure | |
| • 備份選项: | 備份選项 | |
| • 塊大小: | 塊大小 | |
| • Floating point: | Floating point number representation | |
| • 专门指定的信號: | Specifying signals | |
| • Disambiguating names and IDs: | chgrp, chown, chroot, id: user and group syntax | |
| • 随機源: | 随机数据的来源 | |
| • Target directory: | Target directory | |
| • Trailing slashes: | Trailing slashes | |
| • Traversing symlinks: | Traversing symlinks to directories | |
| • Treating / specially: | Treating / specially | |
| • Standards conformance: | Standards conformance | |
| • Multi-call invocation: | Multi-call program invocation | |
|
||
| • cat invocation: | 把文本文件的内容送到标准输出 | |
| • tac invocation: | 逆向显示指定的文件,最后一行在前 | |
| • nl invocation: | 把每个指定文件的内容写到标准输出,在每行加上行号 | |
| • od invocation: | 以数字方式显示指定文件的内容,默认是八进制 | |
| • base32 invocation: | 將數據轉換為可打印的數據 | |
| • base64 invocation: | 將數據轉換為可打印的數據 | |
|
||
| • fmt invocation: | 预格式化指定文件的段落,送到标准输出 | |
| • pr invocation: | 将文件分成适当大小的页送到打印机 | |
| • fold invocation: | 断开指定文件(默认是标准输入)较长的行,在屏幕上显示 | |
|
||
| • head invocation: | 显示每个指定文件的前几行(默认是10) | |
| • tail invocation: | 在屏幕上显示每个指定文件的最后几行(默认是10) | |
| • split invocation: | 把文件分成固定大小的片 | |
| • csplit invocation: | 把一个文件分片 | |
|
||
| • wc invocation: | 统计文件中包含的字节数、单词数和行数 | |
| • sum invocation: | 显示指定文件的校验和及块数 | |
| • cksum invocation: | 输出指定的每个文件的 CRC(循环冗余校验)和字节数 | |
| • b2sum invocation: | Print or check BLAKE2 digests | |
| • md5sum invocation: | 显示或者校验MD5校验码 | |
| • sha1sum invocation: | 顯示或校验 SHA-1 校验碼 | |
| • sha2 utilities: | 顯示或校验 SHA-2 校验碼 | |
|
||
| • sort invocation: | 排序文本文件 | |
| • shuf invocation: | Shuffle text files | |
| • uniq invocation: | 抛弃指定文件或者标准输入中内容重复的行 | |
| • comm invocation: | 一行一行对两个已经排序的文件进行比较 | |
| • ptx invocation: | 为指定的文件提供一个排序索引 | |
| • tsort invocation: | 对给定的文件进行拓扑排序 | |
|
||
| • General options in ptx: | Options which affect general program behavior | |
| • Charset selection in ptx: | Underlying character set considerations | |
| • Input processing in ptx: | Input fields, contexts, and keyword selection | |
| • Output formatting in ptx: | Types of output format, and sizing the fields | |
| • Compatibility in ptx: | The GNU extensions to ptx |
|
|
||
| • cut invocation: | 从指定的文件中提取特定的列送到标准输出 | |
| • paste invocation: | 合并文件的行 | |
| • join invocation: | 合并两个文件的行 | |
|
||
| • tr invocation: | 从标准输入读入正文,对字符进行转换、压缩或者删除,然后写到标准输出 | |
| • expand invocation: | 把 tab 转换为空格符 | |
| • unexpand invocation: | 把空格符转换成 tab | |
|
||
| • Character sets: | Specifying sets of characters | |
| • Translating: | Changing one set of characters to another | |
| • Squeezing and deleting: | Removing characters | |
|
||
| • ls invocation: | 列出目錄内容 | |
| • dir invocation: | 列出目錄内容 | |
| • vdir invocation: | 详细列出目錄的内容 | |
| • dircolors invocation: | 设置 ls 工具的默認颜色 |
|
|
||
| • Which files are listed: | Which files are listed | |
| • What information is listed: | What information is listed | |
| • Sorting the output: | Sorting the output | |
| • Details about version sort: | More details about version sort | |
| • General output formatting: | General output formatting | |
| • Formatting the file names: | Formatting the file names | |
|
||
| • cp invocation: | 複製文件和目錄 | |
| • dd invocation: | 复制文件,可以在复制文件过程中进行一些转换 | |
| • install invocation: | 复制文件,设置它们的权限 | |
| • mv invocation: | 移动(重命名)文件 | |
| • rm invocation: | 删除文件或目錄 | |
| • shred invocation: | 安全地删除文件 | |
|
||
| • link invocation: | 创建从指定文件到指定名称的硬链接 | |
| • ln invocation: | 在文件之間創建连接 | |
| • mkdir invocation: | 創建目錄 | |
| • mkfifo invocation: | 以给定的参数作为名字建立FIFO(又叫命名管道)文件 | |
| • mknod invocation: | 使用给出的文件名,建立一个FIFO、字符特殊文件(special file)或者块特殊文件(special file) | |
| • readlink invocation: | 显示指定符号链接的值 | |
| • rmdir invocation: | 移除空白目錄 | |
| • unlink invocation: | 通过 unlink syscall 删除指定文件 | |
|
||
| • chown invocation: | 改变文件和目录的所有权(包括用户和/或组) | |
| • chgrp invocation: | 改变文件和目录属组 | |
| • chmod invocation: | 修改访问权限 | |
| • touch invocation: | 修改文件的时间戳 | |
|
||
| • df invocation: | 报告文件系统磁盘空间的使用情况 | |
| • du invocation: | 报告磁盘空间使用情况 | |
| • stat invocation: | Report file or file system status | |
| • sync invocation: | 將内存中的數據同步到磁盤數據 | |
| • truncate invocation: | Shrink or extend the size of a file | |
|
||
| • echo invocation: | 顯示一行文本 | |
| • printf invocation: | 格式化输出数据 | |
| • yes invocation: | 重复输出一个'y'字符串,直到被杀死 | |
|
||
| • false invocation: | 返回一个不成功或者逻辑假的结果 | |
| • true invocation: | 返回一个成功或者逻辑真的结果 | |
| • test invocation: | 检查文件类型,以及进行变量的比较 | |
| • expr invocation: | 执行简单的整数计算 | |
|
||
| • 检测文件的类型: | 检测文件的类型 | |
| • 测试访间的权限: | 测试访间的权限 | |
| • File characteristic tests: | File characteristic tests | |
| • String tests: | String tests | |
| • Numeric tests: | Numeric tests | |
|
||
| • String expressions: | + : match substr index length | |
| • Numeric expressions: | + - * / % | |
| • Relations for expr: | | & < <= = == != >= > | |
| • Examples of expr: | Examples of using expr |
|
|
||
| • tee invocation: | 从标准输入读取数据,输出到标准输出和文件 | |
|
||
| • basename invocation: | 去掉文件名中的目錄和后缀 | |
| • dirname invocation: | 去掉文件名中的目錄和后缀 | |
| • pathchk invocation: | 检查文件名是否是有效的或者是可移植的 | |
| • mktemp invocation: | Create temporary file or directory | |
| • realpath invocation: | Print resolved file names | |
|
||
| • pwd invocation: | 顯示當前工作目錄 | |
| • stty invocation: | 改变和显示终端行的设置 | |
| • printenv invocation: | 顯示所有或部分環境變量 | |
| • tty invocation: | 顯示標準輸入终端的設備文件名 | |
|
||
| • Control: | Control settings | |
| • Input: | Input settings | |
| • Output: | Output settings | |
| • Local: | Local settings | |
| • Combination: | Combination settings | |
| • Characters: | Special characters | |
| • Special: | Special settings | |
|
||
| • id invocation: | 显示某个用户或者当前用户的真实和有效UID、GID | |
| • logname invocation: | 显示当前用户的登录名 | |
| • whoami invocation: | 打印用户有效的用户标志符 | |
| • groups invocation: | 显示一个用户所在的组 | |
| • users invocation: | 显示在当前主机登录的用户名 | |
| • who invocation: | 显示哪些用户登录 | |
|
||
| • arch invocation: | 顯示當前主機的硬件架构类型 | |
| • date invocation: | 顯示或設置系统日期和时間 | |
| • nproc invocation: | Print the number of processors | |
| • uname invocation: | 打印系统信息 | |
| • hostname invocation: | 显示或设置主机名 | |
| • hostid invocation: | 以16进制方式,显示当前主机的数字标志符 | |
| • uptime invocation: | 显示系统已经运行的时间 | |
|
||
| • Time conversion specifiers: | %[HIklMNpPrRsSTXzZ] | |
| • Date conversion specifiers: | %[aAbBcCdDeFgGhjmuUVwWxyY] | |
| • Literal conversion specifiers: | %[%nt] | |
| • Padding and other flags: | Pad with zeros, spaces, etc. | |
| • Setting the time: | Changing the system clock | |
| • Options for date: | Instead of the current time | |
| • 日期输入的格式: | Specifying date strings | |
| • Examples of date: | Examples | |
|
||
| • chcon invocation: | Change SELinux context of file | |
| • runcon invocation: | Run a command in specified SELinux context | |
|
||
| • chroot invocation: | 使用特定的目录作为执行某个命令或者交互 shell 的 root 目录 | |
| • env invocation: | 在一个被修改的环境运行一个程序 | |
| • nice invocation: | 修改某个进程的调度优先级 | |
| • nohup invocation: | 使某个命令不被挂起 | |
| • stdbuf invocation: | Run a command with modified I/O buffering | |
| • timeout invocation: | Run a command with a time limit | |
|
||
| • kill invocation: | 向一個进程发送特定的信号。 | |
|
||
| • sleep invocation: | 延时一個指定的时間 | |
|
||
| • factor invocation: | 输出所有指定整数的质因数 | |
| • numfmt invocation: | Reformat numbers | |
| • seq invocation: | 以指定的步长输出一个数列 | |
|
||
| • 文件的时間戳: | File timestamp issues | |
|
||
| • Mode Structure: | Structure of file mode bits | |
| • Symbolic Modes: | Mnemonic representation of file mode bits | |
| • Numeric Modes: | File mode bits as octal numbers | |
| • Directory Setuid and Setgid: | Set-user-ID and set-group-ID on directories | |
|
||
| • General date syntax: | Common rules | |
| • Calendar date items: | 19 Dec 1994 | |
| • Time of day items: | 9:20pm | |
| • Time zone items: | EST, PDT, UTC, … | |
| • Combined date and time of day items: | 1972-09-24T20:02:00,000000-0500 | |
| • Day of week items: | Monday and others | |
| • Relative items in date strings: | next tuesday, 2 years ago | |
| • Pure numbers in date strings: | 19931219, 1440 | |
| • Seconds since the Epoch: | @1078100502 | |
| • Specifying time zone rules: | TZ="America/New_York", TZ="UTC0" | |
| • Authors of parse_datetime: | Bellovin, Eggert, Salz, Berets, et al. | |
|
||
| • Toolbox introduction: | Toolbox introduction | |
| • I/O redirection: | I/O redirection | |
| • The who command: | The who command |
|
| • The cut command: | The cut command |
|
| • The sort command: | The sort command |
|
| • The uniq command: | The uniq command |
|
| • Putting the tools together: | Putting the tools together | |
|
||
| • GNU Free Documentation License: | Copying and sharing this manual | |
|
|
||
下一篇: Introduction, 上一级: (dir) [目錄][索引]

浙公网安备 33010602011771号