Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About

第 5 章 Shell command

目錄

5.1. Help Commands
5.1.1. man - an interface to the on-line reference manuals
5.1.1.1. manpath.config
5.1.1.2. 查看man手冊位置
5.1.1.3. 指定手冊位置
5.2. getconf - Query system configuration variables
5.3. test 命令
5.3.1. 判斷目錄
5.4. Directory and File System Related
5.4.1. dirname
5.4.2. filename
5.4.2.1. 排除副檔名
5.4.2.2. 取副檔名
5.4.3. test - check file types and compare values
5.4.4. file — determine file type
5.4.5. stat
5.4.6. mkdir - make directories
5.4.7. rename
5.4.8. touch
5.4.9. truncate
5.4.10. ls - list directory contents
5.4.10.1. full-time / time-style 定義日期時間格式
5.4.11. cp - copy files and directories
5.4.11.1. copy directories recursively
5.4.11.2. overwrite an existing file
5.4.11.3. -a, --archive same as -dR --preserve=all
5.4.12. rm - remove files or directories
5.4.12.1. -bash: /bin/rm: Argument list too long
5.4.12.2. zsh: sure you want to delete all the files in /tmp [yn]?
5.4.13. df - report file system disk space usage
5.4.14. du - estimate file space usage
5.4.15. tac - concatenate and print files in reverse
5.4.16. split - split a file into pieces
5.4.16.1. 按行分割檔案
5.4.16.2. 按尺寸分割檔案
5.4.17. find - search for files in a directory hierarchy
5.4.17.1. name
5.4.17.2. regex
5.4.17.3. user
5.4.17.4. perm
5.4.17.5. type
5.4.17.5.1. 分別設置檔案與目錄的權限
5.4.17.6. -delete
5.4.17.7. exec
5.4.17.8. 排除目錄
5.4.17.9. -mmin n File's data was last modified n minutes ago.
5.4.17.10. -ctime
5.4.17.11. -mtime / -mmin
5.4.17.12. --newer
5.4.17.13. -print / -printf
5.4.17.14. -size
5.4.17.15. -path
5.4.17.16. 目錄深度控制
5.4.17.17. -maxdepth
5.4.17.18. xargs
5.5. package / compress and decompress
5.5.1. tar — The GNU version of the tar archiving utility
5.5.1.1. tar examples
5.5.1.2. gunzip
5.5.1.3. b2zip
5.5.1.4. compress
5.5.1.5. .xz 檔案
5.5.1.6. -t, --list
5.5.1.7. tar: Removing leading `/’ from member names
5.5.1.8. -C, --directory=DIR
5.5.1.9. --exclude
5.5.1.10. -T
5.5.1.11. 日期過濾
5.5.1.12. 保留權限
5.5.1.13. -r, --append
5.5.1.14. 遠程傳輸
5.5.1.15. 分卷壓縮
5.5.2. cpio - copy files to and from archives
5.5.3. gzip
5.5.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
5.5.5. bzip2, bunzip2 - a block-sorting file compressor
5.5.6. RAR
5.5.7. 7-Zip
5.5.7.1. 壓縮
5.5.7.2. 瀏覽壓縮包
5.5.7.3. 解壓
5.5.7.4. Creates self extracting archive.
5.5.8. RAR
5.5.9. xz, unxz, xzcat, lzma, unlzma, lzcat - Compress or decompress .xz and .lzma files
5.6. date and time
5.6.1. 日期格式
5.6.1.1. weekday name
5.6.2. -d --date=
5.6.2.1. 日期偏移量
5.6.2.1.1. day
5.6.2.1.2. month
5.6.2.1.3. year
5.6.2.2. 時間偏移
5.6.3. 時間戳
5.6.4. RFC 2822
5.6.5. UTC
5.7. Numeric
5.7.1. 數值運算
5.7.2. seq - print a sequence of numbers
5.7.3. bc - An arbitrary precision calculator language
5.8. Text Processing
5.8.1. iconv - Convert encoding of given files from one encoding to another
5.8.1.1. cconv - A iconv based simplified-traditional chinese conversion tool
5.8.1.2. uconv - convert data from one encoding to another
5.8.2. 字元串處理命令expr
5.8.3. cat - concatenate files and print on the standard output
5.8.3.1. -s, --squeeze-blank suppress repeated empty output lines
5.8.3.2. -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
5.8.4. nl - number lines of files
5.8.5. tr - translate or delete characters
5.8.5.1. 替換字元
5.8.5.2. 英文大小寫轉換
5.8.5.3. [CHAR*] 和 [CHAR*REPEAT]
5.8.5.4. -s, --squeeze-repeats replace each input sequence of a repeated character that is listed in SET1 with a single occurrence of that character
5.8.5.5. -d, --delete delete characters in SET1, do not translate
5.8.6. cut - remove sections from each line of files
5.8.7. printf - format and print data
5.8.8. Free `recode' converts files between various character sets and surfaces.
5.8.9. /dev/urandom 隨機字元串
5.8.10. col - filter reverse line feeds from input
5.8.11. apg - generates several random passwords
5.8.12. head/tail
5.8.13. 反轉字元串或檔案內容
5.8.14. TAB符號與空格處理
5.8.14.1. expand - convert tabs to spaces
5.8.14.2. unexpand - convert spaces to tabs
5.9. grep, egrep, fgrep, rgrep - print lines matching a pattern
5.9.1. 刪除空行
5.9.2. -v, --invert-match
5.9.3. Output control
5.9.3.1. -o, --only-matching show only the part of a line matching PATTERN
5.9.3.1.1. IP 地址
5.9.3.1.2. UUID
5.9.3.1.3. 行列轉換
5.9.3.2. 遞歸操作
5.9.3.3. -c, --count print only a count of matching lines per FILE
5.9.4. Context control
5.9.4.1. -A, --after-context=NUM print NUM lines of trailing context
5.9.4.2. -B, --before-context=NUM print NUM lines of leading context
5.9.4.3. -C, --context=NUM print NUM lines of output context
5.9.4.4. --color
5.9.5. Regexp selection and interpretation
5.9.5.1. .*
5.9.5.2. 2010:(13|14|15|16)
5.9.5.3. []與{}
5.9.5.4. -P, --perl-regexp Perl正則表達式
5.9.6. fgrep
5.9.7. egrep
5.10. sort - sort lines of text files
5.10.1. 對列排序
5.10.2. -s, --stable stabilize sort by disabling last-resort comparison
5.11. uniq
5.12. 表格操作/行列轉換
5.12.1. column - columnate lists
5.12.2. paste - merge lines of files
5.12.3. join
5.13. standard input/output
5.13.1. xargs - build and execute command lines from standard input
5.13.1.1. 格式化
5.13.1.2. standard input
5.13.1.3. -I 替換操作
5.13.1.4. -n, --max-args=MAX-ARGS use at most MAX-ARGS arguments per command line
5.13.1.5. -t, --verbose print commands before executing them
5.13.1.6. -d, --delimiter=CHARACTER items in input stream are separated by CHARACTER, not by whitespace; disables quote and backslash processing and logical EOF processing
5.13.1.7. -0, --null items are separated by a null, not whitespace; disables quote and backslash processing and logical EOF processing
5.13.1.8. -r, --no-run-if-empty if there are no arguments, then do not run COMMAND; if this option is not given, COMMAND will be
5.13.1.9. -p, --interactive prompt before running commands
5.14. flock - manage locks from shell scripts
5.15. 進制轉換 - 16進制 - 8進制 - 二進制
5.15.1. od - dump files in octal and other formats
5.15.1.1. 16進制
5.15.1.2. 使用 od 隨機生成密碼
5.15.2. hexdump, hd -- ASCII, decimal, hexadecimal, octal dump
5.15.3. xxd - make a hexdump or do the reverse.
5.15.3.1. 指定每行的列數
5.15.3.2. 跳過位元組
5.15.4. binutils
5.15.4.1. strings - print the strings of printable characters in files.
5.16. Logging
5.16.1. logger - a shell command interface to the syslog(3) system log module
5.17. Password
5.17.1. Shadow password suite configuration.
5.17.2. newusers - update and create new users in batch
5.17.3. chpasswd - update passwords in batch mode
5.17.4. sshpass - noninteractive ssh password provider
5.18. 信息摘要
5.18.1. cksum, sum -- display file checksums and block counts
5.18.2. md5sum - compute and check MD5 message digest
5.18.3.
5.19. envsubst - substitutes environment variables in shell format strings

5.1. Help Commands

5.1.1. man - an interface to the on-line reference manuals

5.1.1.1. manpath.config

cat /etc/manpath.config
			

5.1.1.2. 查看man手冊位置

$ man -aw ls
/usr/share/man/man1/ls.1.gz
			

5.1.1.3. 指定手冊位置

man -M /home/mysql/man mysql