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

第 27 章 Shell command


27.1. Help Commands
27.1.1. man - an interface to the on-line reference manuals manpath.config 查看man手冊位置 指定手冊位置
27.2. getconf - Query system configuration variables
27.3. Directory and File System Related
27.3.1. dirname
27.3.2. filename 排除副檔名 取副檔名
27.3.3. test - check file types and compare values
27.3.4. file — determine file type
27.3.5. stat
27.3.6. mkdir - make directories
27.3.7. rename
27.3.8. touch
27.3.9. truncate
27.3.10. ls - list directory contents full-time / time-style 定義日期時間格式
27.3.11. cp - copy files and directories copy directories recursively overwrite an existing file -a, --archive same as -dR --preserve=all
27.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]?
27.3.13. df - report file system disk space usage
27.3.14. du - estimate file space usage
27.3.15. tac - concatenate and print files in reverse
27.3.16. split - split a file into pieces 按行分割檔案 按尺寸分割檔案
27.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
27.4. package / compress and decompress
27.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 遠程傳輸 分卷壓縮
27.4.2. cpio - copy files to and from archives
27.4.3. gzip
27.4.4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
27.4.5. RAR
27.4.6. 7-Zip 壓縮 瀏覽壓縮包 解壓 Creates self extracting archive.
27.5. date and time
27.5.1. 日期格式 weekday name
27.5.2. -d --date= 日期偏移量 day month year 時間偏移
27.5.3. 時間戳
27.5.4. RFC 2822
27.5.5. UTC
27.6. Numeric
27.6.1. 數值運算
27.6.2. seq - print a sequence of numbers
27.6.3. bc - An arbitrary precision calculator language
27.7. Text Processing
27.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
27.7.2. 字元串處理命令expr
27.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
27.7.4. nl - number lines of files
27.7.5. od - dump files in octal and other formats 16進制
27.7.6. tr - translate or delete characters
27.7.7. cut - remove sections from each line of files
27.7.8. printf - format and print data
27.7.9. Free `recode' converts files between various character sets and surfaces.
27.7.10. /dev/urandom 隨機字元串
27.7.11. col - filter reverse line feeds from input
27.7.12. apg - generates several random passwords
27.7.13. head/tail
27.7.14. 反轉字元串或檔案內容
27.7.15. TAB符號與空格處理 expand - convert tabs to spaces unexpand - convert spaces to tabs
27.8. grep, egrep, fgrep, rgrep - print lines matching a pattern
27.8.1. 刪除空行
27.8.2. -v, --invert-match
27.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
27.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
27.8.5. Regexp selection and interpretation .* 2010:(13|14|15|16) []與{} -P, --perl-regexp Perl正則表達式
27.8.6. fgrep
27.8.7. egrep
27.9. sort - sort lines of text files
27.9.1. 對列排序
27.9.2. -s, --stable stabilize sort by disabling last-resort comparison
27.10. uniq
27.11. 表格操作/行列轉換
27.11.1. column - columnate lists
27.11.2. paste - merge lines of files
27.11.3. join
27.12. standard input/output
27.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
27.13. flock - manage locks from shell scripts
27.14. Logging
27.14.1. logger - a shell command interface to the syslog(3) system log module
27.15. Password
27.15.1. Shadow password suite configuration.
27.15.2. newusers - update and create new users in batch
27.15.3. chpasswd - update passwords in batch mode
27.16. binutils
27.16.1. strings - print the strings of printable characters in files.

27.1. Help Commands

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