Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 视频教程 | 打赏(Donations) | About
知乎专栏多维度架构 微信号 netkiller-ebook | QQ群:128659835 请注明“读者”

第 26 章 Shell command


26.1. Help Commands
26.1.1. man - an interface to the on-line reference manuals manpath.config 查看man手册位置 指定手册位置
26.2. getconf - Query system configuration variables
26.3. test 命令
26.3.1. 判断目录
26.4. Directory and File System Related
26.4.1. dirname
26.4.2. filename 排除扩展名 取扩展名
26.4.3. test - check file types and compare values
26.4.4. file — determine file type
26.4.5. stat
26.4.6. mkdir - make directories
26.4.7. rename
26.4.8. touch
26.4.9. truncate
26.4.10. ls - list directory contents full-time / time-style 定义日期时间格式
26.4.11. cp - copy files and directories copy directories recursively overwrite an existing file -a, --archive same as -dR --preserve=all
26.4.12. rm - remove files or directories -bash: /bin/rm: Argument list too long zsh: sure you want to delete all the files in /tmp [yn]?
26.4.13. df - report file system disk space usage
26.4.14. du - estimate file space usage
26.4.15. tac - concatenate and print files in reverse
26.4.16. split - split a file into pieces 按行分割文件 按尺寸分割文件
26.4.17. find - search for files in a directory hierarchy name regex user perm type 分别设置文件与目录的权限 -delete exec 排除目录 -mmin n File's data was last modified n minutes ago. -ctime -mtime / -mmin --newer -print / -printf -size -path 目录深度控制 -maxdepth xargs
26.5. package / compress and decompress
26.5.1. tar — The GNU version of the tar archiving utility tar examples gunzip b2zip compress .xz 文件 -t, --list tar: Removing leading `/’ from member names -C, --directory=DIR --exclude -T 日期过滤 保留权限 -r, --append 远程传输 分卷压缩
26.5.2. cpio - copy files to and from archives
26.5.3. gzip
26.5.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
26.5.5. bzip2, bunzip2 - a block-sorting file compressor
26.5.6. RAR
26.5.7. 7-Zip 压缩 浏览压缩包 解压 Creates self extracting archive.
26.5.8. RAR
26.5.9. xz, unxz, xzcat, lzma, unlzma, lzcat - Compress or decompress .xz and .lzma files
26.6. date and time
26.6.1. 日期格式 weekday name
26.6.2. -d --date= 日期偏移量 day month year 时间偏移
26.6.3. 时间戳
26.6.4. RFC 2822
26.6.5. UTC
26.7. Numeric
26.7.1. 数值运算
26.7.2. seq - print a sequence of numbers
26.7.3. bc - An arbitrary precision calculator language
26.8. Text Processing
26.8.1. iconv - Convert encoding of given files from one encoding to another cconv - A iconv based simplified-traditional chinese conversion tool uconv - convert data from one encoding to another
26.8.2. 字符串处理命令expr
26.8.3. cat - concatenate files and print on the standard output -s, --squeeze-blank suppress repeated empty output lines -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
26.8.4. nl - number lines of files
26.8.5. tr - translate or delete characters 替换字符 英文大小写转换 [CHAR*] 和 [CHAR*REPEAT] -s, --squeeze-repeats replace each input sequence of a repeated character that is listed in SET1 with a single occurrence of that character -d, --delete delete characters in SET1, do not translate
26.8.6. cut - remove sections from each line of files
26.8.7. printf - format and print data
26.8.8. Free `recode' converts files between various character sets and surfaces.
26.8.9. /dev/urandom 随机字符串
26.8.10. col - filter reverse line feeds from input
26.8.11. apg - generates several random passwords
26.8.12. head/tail
26.8.13. 反转字符串或文件内容
26.8.14. TAB符号与空格处理 expand - convert tabs to spaces unexpand - convert spaces to tabs
26.9. grep, egrep, fgrep, rgrep - print lines matching a pattern
26.9.1. 删除空行
26.9.2. -v, --invert-match
26.9.3. Output control -o, --only-matching show only the part of a line matching PATTERN IP 地址 UUID 行列转换 递归操作 -c, --count print only a count of matching lines per FILE
26.9.4. Context control -A, --after-context=NUM print NUM lines of trailing context -B, --before-context=NUM print NUM lines of leading context -C, --context=NUM print NUM lines of output context --color
26.9.5. Regexp selection and interpretation .* 2010:(13|14|15|16) []与{} -P, --perl-regexp Perl正则表达式
26.9.6. fgrep
26.9.7. egrep
26.10. sort - sort lines of text files
26.10.1. 对列排序
26.10.2. -s, --stable stabilize sort by disabling last-resort comparison
26.11. uniq
26.12. 表格操作/行列转换
26.12.1. column - columnate lists
26.12.2. paste - merge lines of files
26.12.3. join
26.13. standard input/output
26.13.1. xargs - build and execute command lines from standard input 格式化 standard input -I 替换操作 -n, --max-args=MAX-ARGS use at most MAX-ARGS arguments per command line -t, --verbose print commands before executing them -d, --delimiter=CHARACTER items in input stream are separated by CHARACTER, not by whitespace; disables quote and backslash processing and logical EOF processing -0, --null items are separated by a null, not whitespace; disables quote and backslash processing and logical EOF processing -r, --no-run-if-empty if there are no arguments, then do not run COMMAND; if this option is not given, COMMAND will be -p, --interactive prompt before running commands
26.14. flock - manage locks from shell scripts
26.15. 进制转换 - 16进制 - 8进制 - 二进制
26.15.1. od - dump files in octal and other formats 16进制 使用 od 随机生成密码
26.15.2. hexdump, hd -- ASCII, decimal, hexadecimal, octal dump
26.15.3. xxd - make a hexdump or do the reverse. 指定每行的列数 跳过字节
26.15.4. binutils strings - print the strings of printable characters in files.
26.16. Logging
26.16.1. logger - a shell command interface to the syslog(3) system log module
26.17. Password
26.17.1. Shadow password suite configuration.
26.17.2. newusers - update and create new users in batch
26.17.3. chpasswd - update passwords in batch mode
26.17.4. sshpass - noninteractive ssh password provider
26.18. 信息摘要
26.18.1. cksum, sum -- display file checksums and block counts
26.18.2. md5sum - compute and check MD5 message digest
26.19. envsubst - substitutes environment variables in shell format strings

26.1. Help Commands

26.1.1. man - an interface to the on-line reference manuals manpath.config

cat /etc/manpath.config 查看man手册位置

$ man -aw ls
/usr/share/man/man1/ls.1.gz 指定手册位置

man -M /home/mysql/man mysql