Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | 云栖社区 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Github | Search | About

第 5 章 Shell command


5.1. Help Commands
5.1.1. man - an interface to the on-line reference manuals manpath.config 查看man手册位置 指定手册位置
5.2. getconf - Query system configuration variables
5.3. Directory and File System Related
5.3.1. dirname
5.3.2. filename 排除扩展名 取扩展名
5.3.3. test - check file types and compare values
5.3.4. file — determine file type
5.3.5. stat
5.3.6. mkdir - make directories
5.3.7. rename
5.3.8. touch
5.3.9. truncate
5.3.10. ls - list directory contents full-time / time-style 定义日期时间格式
5.3.11. cp - copy files and directories copy directories recursively overwrite an existing file -a, --archive same as -dR --preserve=all
5.3.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]?
5.3.13. df - report file system disk space usage
5.3.14. du - estimate file space usage
5.3.15. tac - concatenate and print files in reverse
5.3.16. split - split a file into pieces 按行分割文件 按尺寸分割文件
5.3.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
5.4. package / compress and decompress
5.4.1. tar — The GNU version of the tar archiving utility tar examples gunzip b2zip compress -t, --list tar: Removing leading `/’ from member names -C, --directory=DIR --exclude -T 日期过滤 保留权限 -r, --append 远程传输 分卷压缩
5.4.2. cpio - copy files to and from archives
5.4.3. gzip
5.4.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
5.4.5. bzip2, bunzip2 - a block-sorting file compressor
5.4.6. RAR
5.4.7. 7-Zip 压缩 浏览压缩包 解压 Creates self extracting archive.
5.5. date and time
5.5.1. 日期格式 weekday name
5.5.2. -d --date= 日期偏移量 day month year 时间偏移
5.5.3. 时间戳
5.5.4. RFC 2822
5.5.5. UTC
5.6. Numeric
5.6.1. 数值运算
5.6.2. seq - print a sequence of numbers
5.6.3. bc - An arbitrary precision calculator language
5.6.4. od - dump files in octal and other formats 16进制 使用 od 随机生成密码
5.6.5. hexdump, hd -- ASCII, decimal, hexadecimal, octal dump
5.7. Text Processing
5.7.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
5.7.2. 字符串处理命令expr
5.7.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
5.7.4. nl - number lines of files
5.7.5. tr - translate or delete characters
5.7.6. cut - remove sections from each line of files
5.7.7. printf - format and print data
5.7.8. Free `recode' converts files between various character sets and surfaces.
5.7.9. /dev/urandom 随机字符串
5.7.10. col - filter reverse line feeds from input
5.7.11. apg - generates several random passwords
5.7.12. head/tail
5.7.13. 反转字符串或文件内容
5.7.14. TAB符号与空格处理 expand - convert tabs to spaces unexpand - convert spaces to tabs
5.8. grep, egrep, fgrep, rgrep - print lines matching a pattern
5.8.1. 删除空行
5.8.2. -v, --invert-match
5.8.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
5.8.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
5.8.5. Regexp selection and interpretation .* 2010:(13|14|15|16) []与{} -P, --perl-regexp Perl正则表达式
5.8.6. fgrep
5.8.7. egrep
5.9. sort - sort lines of text files
5.9.1. 对列排序
5.9.2. -s, --stable stabilize sort by disabling last-resort comparison
5.10. uniq
5.11. 表格操作/行列转换
5.11.1. column - columnate lists
5.11.2. paste - merge lines of files
5.11.3. join
5.12. standard input/output
5.12.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
5.13. flock - manage locks from shell scripts
5.14. Logging
5.14.1. logger - a shell command interface to the syslog(3) system log module
5.15. Password
5.15.1. Shadow password suite configuration.
5.15.2. newusers - update and create new users in batch
5.15.3. chpasswd - update passwords in batch mode
5.16. binutils
5.16.1. strings - print the strings of printable characters in files.

5.1. Help Commands

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