Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

部分 II. Shell

目录

22. Bash Shell
22.1. bash - GNU Bourne-Again SHell
22.1.1. -n 检查脚本是否有语法错误
22.1.2. -x 显示详细运行过程
22.2. Introduction
22.2.1. chsh - change login shell
22.2.2. 切换身份
22.2.3. test 命令
22.2.4. I/O 重定向
22.2.4.1. error 重定向
22.2.4.2. 使用块记录日志
22.2.4.3. tee - read from standard input and write to standard output and files
22.2.4.4. 创建文件
22.2.4.5. 快速清空一个文件的内容
22.2.5. pipes (FIFOs)
22.2.6. mktemp - create a temporary file or directory 临时目录与文件
22.2.7. History 命令历史记录
22.2.7.1. .bash_history
22.2.7.2. .mysql_history
22.2.8. hash - hash database access method
22.2.9. prompt
22.3. variable
22.3.1. 系统变量
22.3.1.1. 命令行参数传递
22.3.1.2. $n $# $0 $?
22.3.1.3. shift 移位
22.3.2. 表达式
22.3.3. Internal Environment Variables
22.3.4. set 设置变量
22.3.5. unset 变量销毁
22.3.6. 设置变量默认值
22.3.7. export 设置全局变量
22.3.8. declare
22.3.9. Numerical 数值运算
22.3.10. Strings 字符串操作
22.3.10.1. ##/#
22.3.10.2. %%/%
22.3.10.3. :n1:n2
22.3.10.4. #
22.3.10.5. example
22.3.10.6. 计算字符串长度
22.3.10.7. 字符串查找替换
22.3.11. Array 数组
22.3.11.1. for 与 array
22.3.11.2. while 与 array
22.3.11.3. array 与 read
22.3.11.4. 拆分字符串并转换为数组
22.3.11.5. 数组转为字符串
22.3.12. read 赋值多个变量
22.3.13. eval
22.4. conditions if and case
22.4.1. if
22.4.2. case
22.5. Loops for, while and until
22.5.1. for
22.5.2. while
22.5.3. until
22.6. Functions
22.6.1. Local variables
22.7. User interfaces
22.7.1. input
22.8. subshell
22.9. Example
22.9.1. 有趣的Shell
22.9.2. backup
22.9.3. CPU 核心数
22.9.4. Password
22.9.5. processes
22.9.5.1. pid
22.9.5.2. kill
22.9.5.3. pgrep
22.9.6. Shell 技巧
22.9.6.1. 行转列,再批评
22.9.6.2. for vs while
22.9.6.3. 遍历字符串
22.9.7. to convert utf-8 from gb2312 code
22.9.8. 使用内存的百分比
22.9.9. 合并apache被cronlog分割的log文件
23. Z Shell
23.1. installing Z shell
23.2. Oh My ZSH!
23.3. Starting file
23.3.1. ~/.zshrc
23.4. Prompting
23.5. Aliases
23.6. History
23.7. FAQ
23.7.1. Home/End key
24. Berkeley UNIX C shell (csh)
24.1.
25. KornShell
25.1.
26. Shell command
26.1. Help Commands
26.1.1. man - an interface to the on-line reference manuals
26.1.1.1. manpath.config
26.1.1.2. 查看man手册位置
26.1.1.3. 指定手册位置
26.2. getconf - Query system configuration variables
26.3. Directory and File System Related
26.3.1. dirname
26.3.2. filename
26.3.2.1. 排除扩展名
26.3.2.2. 取扩展名
26.3.3. test - check file types and compare values
26.3.4. stat
26.3.5. mkdir - make directories
26.3.6. rename
26.3.7. touch
26.3.8. truncate
26.3.9. ls - list directory contents
26.3.9.1. full-time / time-style 定义日期时间格式
26.3.10. cp - copy files and directories
26.3.10.1. copy directories recursively
26.3.10.2. overwrite an existing file
26.3.10.3. -a, --archive same as -dR --preserve=all
26.3.11. rm - remove files or directories
26.3.11.1. -bash: /bin/rm: Argument list too long
26.3.11.2. zsh: sure you want to delete all the files in /tmp [yn]?
26.3.12. df - report file system disk space usage
26.3.13. du - estimate file space usage
26.3.14. tac - concatenate and print files in reverse
26.3.15. split - split a file into pieces
26.3.15.1. 按行分割文件
26.3.15.2. 按尺寸分割文件
26.3.16. find - search for files in a directory hierarchy
26.3.16.1. name
26.3.16.2. regex
26.3.16.3. user
26.3.16.4. perm
26.3.16.5. type
26.3.16.6. -delete
26.3.16.7. exec
26.3.16.8. xargs
26.3.16.9. 排除目录
26.3.16.10. -mmin n File's data was last modified n minutes ago.
26.3.16.11. -mtime / -mmin
26.3.16.12. --newer
26.3.16.13. -print / -printf
26.3.16.14. -size
26.4. package / compress and decompress
26.4.1. tar — The GNU version of the tar archiving utility
26.4.1.1. tar examples
26.4.1.2. gunzip
26.4.1.3. b2zip
26.4.1.4. compress
26.4.1.5. -t, --list
26.4.1.6. tar: Removing leading `/’ from member names
26.4.1.7. -C, --directory=DIR
26.4.1.8. -P, --absolute-names don't strip leading `/'s from file names
26.4.1.9. --exclude
26.4.1.10. -T
26.4.1.11. 日期过滤
26.4.1.12. 保留权限
26.4.1.13. -r, --append
26.4.1.14. 远程传输
26.4.1.15. 分卷压缩
26.4.2. cpio - copy files to and from archives
26.4.3. gzip
26.4.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
26.4.5. RAR
26.4.6. 7-Zip
26.4.6.1. 压缩
26.4.6.2. 浏览压缩包
26.4.6.3. 解压
26.4.6.4. Creates self extracting archive.
26.5. date and time
26.5.1. 日期格式
26.5.2. -d --date=
26.5.2.1. 日期偏移量
26.5.2.2. 时间偏移
26.5.3. weekday name
26.5.4. UTC
26.6. Numeric
26.6.1. 数值运算
26.6.2. seq - print a sequence of numbers
26.6.3. bc - An arbitrary precision calculator language
26.7. Text Processing
26.7.1. iconv - Convert encoding of given files from one encoding to another
26.7.1.1. cconv - A iconv based simplified-traditional chinese conversion tool
26.7.1.2. uconv - convert data from one encoding to another
26.7.2. 字符串处理命令expr
26.7.3. cat - concatenate files and print on the standard output
26.7.3.1. -s, --squeeze-blank suppress repeated empty output lines
26.7.4. nl - number lines of files
26.7.5. od - dump files in octal and other formats
26.7.5.1. 16进制
26.7.6. tr - translate or delete characters
26.7.7. cut - remove sections from each line of files
26.7.8. printf - format and print data
26.7.9. Free `recode' converts files between various character sets and surfaces.
26.7.10. /dev/urandom 随机字符串
26.7.11. col - filter reverse line feeds from input
26.7.12. apg - generates several random passwords
26.7.13. head/tail
26.7.14. 反转字符串或文件内容
26.8. grep, egrep, fgrep, rgrep - print lines matching a pattern
26.8.1. 删除空行
26.8.2. -v, --invert-match
26.8.3. Output control
26.8.3.1. -o, --only-matching show only the part of a line matching PATTERN
26.8.3.2. 递归操作
26.8.3.3. -c, --count print only a count of matching lines per FILE
26.8.4. Context control
26.8.4.1. -A, --after-context=NUM print NUM lines of trailing context
26.8.4.2. -B, --before-context=NUM print NUM lines of leading context
26.8.4.3. -C, --context=NUM print NUM lines of output context
26.8.4.4. --color
26.8.5. Regexp selection and interpretation
26.8.5.1. .*
26.8.5.2. 2010:(13|14|15|16)
26.8.5.3. []与{}
26.8.5.4. -P, --perl-regexp Perl正则表达式
26.8.6. fgrep
26.8.7. egrep
26.9. sort - sort lines of text files
26.9.1. 对列排序
26.10. uniq
26.11. 表格操作/行列转换
26.11.1. column - columnate lists
26.11.2. paste - merge lines of files
26.12. standard input/output
26.12.1. xargs - build and execute command lines from standard input
26.12.1.1. 格式化
26.12.1.2. standard input
26.12.1.3. -I 替换操作
26.13. Logging
26.13.1. logger - a shell command interface to the syslog(3) system log module
26.14. Password
26.14.1. Shadow password suite configuration.
26.14.2. newusers - update and create new users in batch
26.14.3. chpasswd - update passwords in batch mode
26.15. binutils
26.15.1. strings - print the strings of printable characters in files.
28. Utility Programs
28.1. ed, red - text editor
28.2. vim
28.2.1. 查找与替换
28.2.2. 插入文件
28.2.3. 批处理
28.2.3.1. vi 批处理
28.2.4. line()
28.3. awk
28.3.1. 处理列
28.3.2. printf
28.3.3. Pattern(字符匹配)
28.3.3.1. Pattern, Pattern
28.3.4. Built-in Variables (NR/NF)
28.3.4.1. NR
28.3.4.2. NF
28.3.4.3. 练习
28.3.5. Built-in Functions
28.3.5.1. length
28.3.6. 过滤相同的行
28.4. sed
28.4.1. 查找与替换
28.4.1.1. 正则
28.4.1.2. delete
28.4.1.3. aaa="bbb" 提取bbb
28.4.1.4. 首字母大写
28.4.2. 编辑文件
28.4.3. 内容打印
28.4.4. 编辑操作
28.4.4.1. insert
28.4.5. 管道操作
28.5. CURL - transfer a URL
28.5.1. 基本用法
28.5.2. data
28.5.3. connect-timeout
28.5.4. max-time
28.5.5. compressed
28.5.6. vhosts
28.5.7. 输出格式定义
28.5.8. -A/--user-agent <agent string>
28.5.9. referer
28.5.10. -v
28.5.11. -o, --output FILE Write output to <file> instead of stdout
28.5.12. -H/--header <line> Custom header to pass to server (H)
28.5.12.1. Last-Modified / If-Modified-Since
28.5.12.2. ETag / If-None-Match
28.5.12.3. Accept-Encoding:gzip,defalte
28.5.12.4. HOST
28.5.12.5. HTTP 认证
28.5.13. curl-config
28.5.14. FAQ
28.6. expect
28.6.1. 模拟登录 telnet 获取Cisco配置
28.6.2. 模拟登录 ssh
28.6.3. SCP
28.7. expect-lite - quick and easy command line automation tool
28.8. sshpass - noninteractive ssh password provider
28.9. Klish - Kommand Line Interface Shell (the fork of clish project)
28.9.1. 安装Klish
28.9.2. 为用户指定clish作为默认Shell
28.9.3. FAQ
28.9.3.1. clish/shell/shell_expat.c:36:19: fatal error: expat.h: No such file or directory
28.10. Limited command Shell (lshell)
28.11. wget - retrieves files from the web
28.11.1. Logging and input file
28.11.1.1. -i, --input-file=FILE download URLs found in local or external FILE.
28.11.2. HTTP options
28.11.2.1. --post-data=STRING use the POST method; send STRING as the data.
28.11.3. Recursive download
28.11.3.1. -r, --recursive specify recursive download.
28.11.3.2. -m, --mirror shortcut for -N -r -l inf --no-remove-listing.
28.11.4. --no-passive-ftp disable the "passive" transfer mode.
28.12. TUI
28.12.1. screen - screen manager with VT100/ANSI terminal emulation
28.12.2. tmux — terminal multiplexer
28.12.3. byobu - wrapper script for seeding a user's byobu configuration and launching a text based window manager (either screen or tmux)
28.12.4. htop - interactive process viewer
28.12.5. elinks
28.12.6. chat
28.13. parallel - build and execute shell command lines from standard input in parallel
29. Shell Terminal
29.1. terminal
29.1.1. resize - set TERMCAP and terminal settings to current xterm window size
29.1.2. tset, reset - terminal initialization
29.1.3. stty - change and print terminal line settings
29.2. tput
29.2.1. Change the prompt color using tput
29.3. dialog
29.3.1. --inputbox
29.4. whiptail - display dialog boxes from shell scripts
29.4.1. --msgbox
29.4.2. --infobox
29.4.3. --yesno
29.4.4. --inputbox
29.4.5. --passwordbox
29.4.6. --textbox
29.4.7. --checklist
29.4.8. --radiolist
29.4.9. --menu
29.4.10. --gauge