gnu coreutils内核工具

本文深入探讨了gnucoreutils集合中各种强大且常用的shell、文件和文本处理工具,包括cat、tac、nl、od、base64等,并详细介绍了其功能和用途。同时,提供了在Ubuntu 9.10中安装并查询核心实用程序版本号的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

周海汉 /文

 

gnu coreutils 是原来的gnu shellutils, fileutils, textutils三部分合成的。里面有许多很强大的shell,文件和文本处理工具。如sort, seq, split,uniq,cut,md5sum,wc等

 

gnu coreutils的手册英文版放在:http://www.gnu.org/software/coreutils/manual/,可以text,html,pdf等各种格式。

 

查询我utuntu 9.10安装的coreutils版本号是: 7.4-2:

 

 

下面是gnu coreutils工具简介:

3 Output of entire files
3.1 `cat': Concatenate and write files
3.2 `tac': Concatenate and write files in reverse
3.3 `nl': Number lines and write files
3.4 `od': Write files in octal or other formats
3.5 `base64': Transform data into printable data
4 Formatting file contents
4.1 `fmt': Reformat paragraph text
4.2 `pr': Paginate or columnate files for printing
4.3 `fold': Wrap input lines to fit in specified width
5 Output of parts of files
5.1 `head': Output the first part of files
5.2 `tail': Output the last part of files
5.3 `split': Split a file into fixed-size pieces
5.4 `csplit': Split a file into context-determined pieces
6 Summarizing files
6.1 `wc': Print newline, word, and byte counts
6.2 `sum': Print checksum and block counts
6.3 `cksum': Print CRC checksum and byte counts
6.4 `md5sum': Print or check MD5 digests
6.5 `sha1sum': Print or check SHA-1 digests
6.6 sha2 utilities: Print or check SHA-2 digests
7 Operating on sorted files
7.1 `sort': Sort text files
7.2 `shuf': Shuffling text
7.3 `uniq': Uniquify files
7.4 `comm': Compare two sorted files line by line
7.5 `ptx': Produce permuted indexes
7.5.1 General options
7.5.2 Charset selection
7.5.3 Word selection and input processing
7.5.4 Output formatting
7.5.5 The GNU extensions to `ptx'
7.6 `tsort': Topological sort
7.6.1 `tsort': Background
8 Operating on fields
8.1 `cut': Print selected parts of lines
8.2 `paste': Merge lines of files
8.3 `join': Join lines on a common field
9 Operating on characters
9.1 `tr': Translate, squeeze, and/or delete characters
9.1.1 Specifying sets of characters
9.1.2 Translating
9.1.3 Squeezing repeats and deleting
9.2 `expand': Convert tabs to spaces
9.3 `unexpand': Convert spaces to tabs
10 Directory listing
10.1 `ls': List directory contents
10.1.1 Which files are listed
10.1.2 What information is listed
10.1.3 Sorting the output
10.1.4 Details about version sort
10.1.5 General output formatting
10.1.6 Formatting file timestamps
10.1.7 Formatting the file names
10.2 `dir': Briefly list directory contents
10.3 `vdir': Verbosely list directory contents
10.4 `dircolors': Color setup for `ls'
11 Basic operations
11.1 `cp': Copy files and directories
11.2 `dd': Convert and copy a file
11.3 `install': Copy files and set attributes
11.4 `mv': Move (rename) files
11.5 `rm': Remove files or directories
11.6 `shred': Remove files more securely
12 Special file types
12.1 `link': Make a hard link via the link syscall
12.2 `ln': Make links between files
12.3 `mkdir': Make directories
12.4 `mkfifo': Make FIFOs (named pipes)
12.5 `mknod': Make block or character special files
12.6 `readlink': Print value of a symlink or canonical file name
12.7 `rmdir': Remove empty directories
12.8 `unlink': Remove files via the unlink syscall
13 Changing file attributes
13.1 `chown': Change file owner and group
13.2 `chgrp': Change group ownership
13.3 `chmod': Change access permissions
13.4 `touch': Change file timestamps
14 Disk usage
14.1 `df': Report file system disk space usage
14.2 `du': Estimate file space usage
14.3 `stat': Report file or file system status
14.4 `sync': Synchronize data on disk with memory
14.5 `truncate': Shrink or extend the size of a file
15 Printing text
15.1 `echo': Print a line of text
15.2 `printf': Format and print data
15.3 `yes': Print a string until interrupted
16 Conditions
16.1 `false': Do nothing, unsuccessfully
16.2 `true': Do nothing, successfully
16.3 `test': Check file types and compare values
16.3.1 File type tests
16.3.2 Access permission tests
16.3.3 File characteristic tests
16.3.4 String tests
16.3.5 Numeric tests
16.3.6 Connectives for `test'
16.4 `expr': Evaluate expressions
16.4.1 String expressions
16.4.2 Numeric expressions
16.4.3 Relations for `expr'
16.4.4 Examples of using `expr'
17 Redirection
17.1 `tee': Redirect output to multiple files or processes
18 File name manipulation
18.1 `basename': Strip directory and suffix from a file name
18.2 `dirname': Strip non-directory suffix from a file name
18.3 `pathchk': Check file name validity and portability
18.4 `mktemp': Create temporary file or directory
19 Working context
19.1 `pwd': Print working directory
19.2 `stty': Print or change terminal characteristics
19.2.1 Control settings
19.2.2 Input settings
19.2.3 Output settings
19.2.4 Local settings
19.2.5 Combination settings
19.2.6 Special characters
19.2.7 Special settings
19.3 `printenv': Print all or some environment variables
19.4 `tty': Print file name of terminal on standard input
20 User information
20.1 `id': Print user identity
20.2 `logname': Print current login name
20.3 `whoami': Print effective user ID
20.4 `groups': Print group names a user is in
20.5 `users': Print login names of users currently logged in
20.6 `who': Print who is currently logged in
21 System context
21.1 `date': Print or set system date and time
21.1.1 Time conversion specifiers
21.1.2 Date conversion specifiers
21.1.3 Literal conversion specifiers
21.1.4 Padding and other flags
21.1.5 Setting the time
21.1.6 Options for `date'
21.1.7 Examples of `date'
21.2 `arch': Print machine hardware name
21.3 `nproc': Print the number of available processors
21.4 `uname': Print system information
21.5 `hostname': Print or set system name
21.6 `hostid': Print numeric host identifier
21.7 `uptime': Print system uptime and load
22 SELinux context
22.1 `chcon': Change SELinux context of file
22.2 `runcon': Run a command in specified SELinux context
23 Modified command invocation
23.1 `chroot': Run a command with a different root directory
23.2 `env': Run a command in a modified environment
23.3 `nice': Run a command with modified niceness
23.4 `nohup': Run a command immune to hangups
23.5 `stdbuf': Run a command with modified I/O stream buffering
23.6 `su': Run a command with substitute user and group ID
23.6.1 Why GNU `su' does not support the `wheel' group
23.7 `timeout': Run a command with a time limit
24 Process control
24.1 `kill': Send a signal to processes
25 Delaying
25.1 `sleep': Delay for a specified time
26 Numeric operations
26.1 `factor': Print prime factors
26.2 `seq': Print numeric sequences
27 File permissions
27.1 Structure of File Mode Bits
27.2 Symbolic Modes
27.2.1 Setting Permissions
27.2.2 Copying Existing Permissions
27.2.3 Changing Special Mode Bits
27.2.4 Conditional Executability
27.2.5 Making Multiple Changes
27.2.6 The Umask and Protection
27.3 Numeric Modes
27.4 Directories and the Set-User-ID and Set-Group-ID Bits
28 Date input formats
28.1 General date syntax
28.2 Calendar date items
28.3 Time of day items
28.4 Time zone items
28.5 Day of week items
28.6 Relative items in date strings
28.7 Pure numbers in date strings
28.8 Seconds since the Epoch
28.9 Specifying time zone rules
28.10 Authors of `get_date'
29 Opening the Software Toolbox
Toolbox Introduction
I/O Redirection
The `who' Command
The `cut' Command
The `sort' Command
The `uniq' Command
Coreutils 软件包包括一整套基本的 shell 工具。 basename 去掉文件名中的目录和后缀 cat 把文本文件的内容发送到标准输出 chgrp 改变文件和目录属组,属组可以使用组名或者组识别号表示 chmod 改变文件和目录的权限,权限可以使用符号或者八进制两种表达方式 chown 改变文件和目录的所有权(包括用户和/或组) chroot 使用特定的目录作为执行某个命令或者交互 shell 的根目录(/)。在多数系统中,只有 root 用户能运行这个命令 cksum 输出指定的每个文件的CRC(循环冗余校验)校验和与字节数 comm 一行一行对两个已经排序的文件进行比较,在第三列中显示同一行是否相同 cp 复制文件 csplit 把一个文件按照给定的模式或者行号分成几块 cut 从指定的文件中提取特定的列送到标准输出 date 以特定的格式显示当前时间,或者设置系统日期 dd 以可选块长度复制文件,默认情况下从标准输入设备输出到标准输出设备。复制过程中,还可以对文件进行一些转换。 df 显示参数中的文件所在分区磁盘空间的使用情况,如果没有给出文件参数就显示所有已经安装的文件系统的可用空间数量。 dir 同 ls dircolors 设置 LS_COLOR 环境变量(用来改变 ls 及相关工具默认颜色组合)。 dirname 显示从文件名去掉非目录后缀之后的内容 du 显示参数使用的磁盘空间的数量,对于参数为目录还会列出每个子目录磁盘空间占用情况。 echo 显示给定字符串或变量值 env 在一个被修改的环境中运行一个程序 expand 把 tab 转换为空格符 expr 执行表达式计算 factor 输出所有指定整数的质因数 false 返回一个不成功或者逻辑假的结果 fmt 重新格式化指定文件的段落 fold 断开指定文件(默认是标准输入)较长的行,在屏幕上显示。 groups 显示一个用户所在的组 head 显示每个指定文件的前几行(默认是10)。 hostid 以16进制方式,显示当前主机的数字标志符。 hostname 显示或设置主机名 id 显示某个用户或者当前用户的真实和有效的 UID、GID 。 install 复制文件,设置它们的权限,如果可能还设置拥有它们的用户和组 join 合并两个文件的行 link 创建从指定文件到指定名称的硬链接 ln 创建文件之间的硬/软(符号)连接 logname 显示当前用户的登录名 ls 列出指定目录的所有内容。缺省是将文件和子目录按字母顺序排列。 md5sum 显示或者校验 MD5 校验码。 mkdir 建立目录,使用给定的参数作为目录名。 mkfifo 以给定的参数作为名字建立FIFO(又叫"命名管道")文件。 mknod 使用给出的文件名,建立一个设备节点,也就是:FIFO、字符特殊文件(special file)或者块特殊文件(special file)。 mv 根据所给参数的不同,把文件或者目录移动到另外的目录或者将其改名 nice 修改某个进程的调度优先级 nl 把每个指定文件的内容写到标准输出,在每行加上行号 nohup 使某个命令不被挂起,并将输出重定向到一个日志文件。 od 以数字方式显示指定文件的内容,默认为八进制。 paste 将字段连接在一起,在字段之间自动插入分割符,默认的分割符是 Tab 。 pathchk 检查文件名是否是有效的或者是可移植的 pinky 一个轻量级的 finger 客户端,用来得到某个用户的信息。 pr 将文件分成适当大小的页送到打印机 printenv 显示环境变量 printf 根据给定的参数格式化输出数据,与 C 语言中的该函数相似。 ptx 为指定的文件提供一个排序索引 pwd 显示当前工作目录 readlink 显示指定符号链接的值 rm 删除文件或者目录 rmdir 删除目录(目录必需为空) seq 以指定的步长输出一个数列 sha1sum 显示或校验 160 位的 SHA1 校验码 shred 安全删除一个文件,重写其占用的磁盘空间,使其无法恢复。 sleep 延迟一段时间 sort 对文件进行排序 split 把文件分成固定大小(字节或行数)的片断 stat 显示文件或者文件系统的状态 stty 改变和显示终端行的设置 sum 显示指定文件的校验和及块数 sync 刷新文件系统缓冲区,使磁盘和内存的数据同步。 tac 逆向显示指定的文
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值