Home | Mirror | Search

部分 II. System Commands

目錄

6. Help Commands
1. man - an interface to the on-line reference manuals
1.1. manpath.config
1.2. 查看man手冊位置
1.3. 指定手冊位置
7. Directory and File System Related
1. dirname
2. filename
2.1. 排除副檔名
2.2. 取副檔名
3. test - check file types and compare values
4. stat
5. mkdir - make directories
6. rename
7. touch
8. ls - list directory contents
9. cp - copy files and directories
9.1. copy directories recursively
9.2. overwrite an existing file
10. rm - remove files or directories
10.1. -bash: /bin/rm: Argument list too long
10.2. zsh: sure you want to delete all the files in /tmp [yn]?
11. df - report file system disk space usage
12. du - estimate file space usage
13. tac - concatenate and print files in reverse
14. find - search for files in a directory hierarchy
14.1. name
14.2. regex
14.3. user
14.4. perm
14.5. type
14.5.1. 分別設置檔案與目錄的權限
14.6. -delete
14.7. exec
14.8. xargs
14.9. 排除目錄
14.10. -mtime / -mmin
14.11. --newer
14.12. -print / -printf
8. package / compress and decompress
1. tar — The GNU version of the tar archiving utility
1.1. tar examples
1.2. gunzip
1.3. b2zip
1.4. compress
1.5. -t, --list
1.6. tar: Removing leading `/’ from member names
1.7. -C, --directory=DIR
1.8. --exclude
1.9. -T
1.10. 日期過濾
1.11. 保留權限
1.12. -r, --append
1.13. 遠程傳輸
1.14. 分卷壓縮
2. cpio - copy files to and from archives
3. gzip
4. zip, zipcloak, zipnote, zipsplit - package and compress (archive) files
5. RAR
6. 7-Zip
9. date and time
1. 日期格式
2. -d --date=
2.1. 日期偏移量
2.1.1. day
2.1.2. month
2.1.3. year
2.2. 時間偏移
3. weekday name
4. UTC
10. Numeric
1. 數值運算
2. seq - print a sequence of numbers
3. bc - An arbitrary precision calculator language
11. Text Processing
1. iconv - Convert encoding of given files from one encoding to another
1.1. cconv - A iconv based simplified-traditional chinese conversion tool
2. 字元串處理命令expr
3. cat - concatenate files and print on the standard output
3.1. -s, --squeeze-blank suppress repeated empty output lines
4. nl - number lines of files
5. od - dump files in octal and other formats
5.1. 16進制
6. tr - translate or delete characters
7. cut - remove sections from each line of files
8. printf - format and print data
9. Free `recode' converts files between various character sets and surfaces.
10. /dev/urandom 隨機字元串
11. col - filter reverse line feeds from input
12. apg - generates several random passwords
13. head/tail
14. grep, egrep, fgrep, rgrep - print lines matching a pattern
14.1. 刪除空行
14.2. -v, --invert-match
14.3. Output control
14.3.1. -o, --only-matching show only the part of a line matching PATTERN
14.3.2. 遞歸操作
14.3.3. -c, --count print only a count of matching lines per FILE
14.4. Context control
14.4.1. -A, --after-context=NUM print NUM lines of trailing context
14.4.2. -B, --before-context=NUM print NUM lines of leading context
14.4.3. -C, --context=NUM print NUM lines of output context
14.4.4. --color
14.5. Regexp selection and interpretation
14.5.1. .*
14.5.2. 2010:(13|14|15|16)
14.5.3. []與{}
14.6. ^M
14.7. egrep
15. sort - sort lines of text files
15.1. 對列排序
16. uniq
17. 行列轉換,表格操作
17.1. column - columnate lists
17.2. paste - merge lines of files
12. Logging
1. logger - a shell command interface to the syslog(3) system log module
13. Password
1. Shadow password suite configuration.
2. newusers - update and create new users in batch
3. chpasswd - update passwords in batch mode
14. binutils
1. strings - print the strings of printable characters in files.
15. Utility Programs
1. ed, red - text editor
2. vim
2.1. 查找與替換
2.2. 批處理
2.2.1. vi 批處理
2.3. line()
3. awk
3.1. 處理列
3.2. printf
3.3. 查找檔案並刪除
3.4. Pattern(字元匹配)
3.4.1. Pattern, Pattern
3.5. Built-in Variables
3.5.1. NF
3.5.1.1. TCP/IP Status
3.5.1.2. 用戶shell統計
3.5.1.3. access.log POST與GET統計
3.6. Built-in Functions
3.6.1. length
3.7. 過濾相同的行
4. sed
4.1. find and replace
4.1.1. 正則
4.1.2. delete
4.1.3. aaa="bbb" 提取bbb
5. CURL - transfer a URL
5.1. 基本用法
5.2. data
5.3. connect-timeout
5.4. compressed
5.5. vhosts
5.6. http status
5.7. -A/--user-agent <agent string>
5.8. referer
5.9. -v
5.10. -o/--output <file>
5.11. -H/--header <line> Custom header to pass to server (H)
5.11.1. Last-Modified / If-Modified-Since
5.11.2. ETag / If-None-Match
5.11.3. Accept-Encoding:gzip,defalte
5.11.4. HOST
5.12. curl-config
5.13. FAQ
6. expect
6.1. 模擬登錄 telnet 獲取Cisco配置
6.2. 模擬登錄 ssh
6.3. SCP
7. Klish - Kommand Line Interface Shell (the fork of clish project)
7.1. 安裝Klish
7.2. 為用戶指定clish作為預設Shell
7.3. FAQ
7.3.1. clish/shell/shell_expat.c:36:19: fatal error: expat.h: No such file or directory
8. wget - retrieves files from the web
8.1. HTTP options
8.1.1. --post-data=STRING use the POST method; send STRING as the data.
8.2. Recursive download
8.2.1. -r, --recursive specify recursive download.
8.2.2. -m, --mirror shortcut for -N -r -l inf --no-remove-listing.
8.3. --no-passive-ftp disable the "passive" transfer mode.
9. screen - screen manager with VT100/ANSI terminal emulation
10. TUI
10.1. tmux
10.2. htop - interactive process viewer
10.3. elinks
10.4. chat

1. getconf - Query system configuration variables

$ getconf LONG_BIT
32
$ getconf WORD_BIT
32
	
$ getconf -a
LINK_MAX                           32000
_POSIX_LINK_MAX                    32000
MAX_CANON                          255
_POSIX_MAX_CANON                   255
MAX_INPUT                          255
_POSIX_MAX_INPUT                   255
NAME_MAX                           255
_POSIX_NAME_MAX                    255
PATH_MAX                           4096
_POSIX_PATH_MAX                    4096
PIPE_BUF                           4096
_POSIX_PIPE_BUF                    4096
SOCK_MAXBUF                        
_POSIX_ASYNC_IO                    
_POSIX_CHOWN_RESTRICTED            1
_POSIX_NO_TRUNC                    1
_POSIX_PRIO_IO                     
_POSIX_SYNC_IO                     
_POSIX_VDISABLE                    0
ARG_MAX                            2097152
ATEXIT_MAX                         2147483647
CHAR_BIT                           8
CHAR_MAX                           127
CHAR_MIN                           -128
CHILD_MAX                          15989
CLK_TCK                            100
INT_MAX                            2147483647
INT_MIN                            -2147483648
IOV_MAX                            1024
LOGNAME_MAX                        256
LONG_BIT                           32
MB_LEN_MAX                         16
NGROUPS_MAX                        65536
NL_ARGMAX                          4096
NL_LANGMAX                         2048
NL_MSGMAX                          2147483647
NL_NMAX                            2147483647
NL_SETMAX                          2147483647
NL_TEXTMAX                         2147483647
NSS_BUFLEN_GROUP                   1024
NSS_BUFLEN_PASSWD                  1024
NZERO                              20
OPEN_MAX                           1024
PAGESIZE                           4096
PAGE_SIZE                          4096
PASS_MAX                           8192
PTHREAD_DESTRUCTOR_ITERATIONS      4
PTHREAD_KEYS_MAX                   1024
PTHREAD_STACK_MIN                  16384
PTHREAD_THREADS_MAX                
SCHAR_MAX                          127
SCHAR_MIN                          -128
SHRT_MAX                           32767
SHRT_MIN                           -32768
SSIZE_MAX                          32767
TTY_NAME_MAX                       32
TZNAME_MAX                         6
UCHAR_MAX                          255
UINT_MAX                           4294967295
UIO_MAXIOV                         1024
ULONG_MAX                          4294967295
USHRT_MAX                          65535
WORD_BIT                           32
_AVPHYS_PAGES                      60912
_NPROCESSORS_CONF                  2
_NPROCESSORS_ONLN                  2
_PHYS_PAGES                        515189
_POSIX_ARG_MAX                     2097152
_POSIX_ASYNCHRONOUS_IO             200809
_POSIX_CHILD_MAX                   15989
_POSIX_FSYNC                       200809
_POSIX_JOB_CONTROL                 1
_POSIX_MAPPED_FILES                200809
_POSIX_MEMLOCK                     200809
_POSIX_MEMLOCK_RANGE               200809
_POSIX_MEMORY_PROTECTION           200809
_POSIX_MESSAGE_PASSING             200809
_POSIX_NGROUPS_MAX                 65536
_POSIX_OPEN_MAX                    1024
_POSIX_PII                         
_POSIX_PII_INTERNET                
_POSIX_PII_INTERNET_DGRAM          
_POSIX_PII_INTERNET_STREAM         
_POSIX_PII_OSI                     
_POSIX_PII_OSI_CLTS                
_POSIX_PII_OSI_COTS                
_POSIX_PII_OSI_M                   
_POSIX_PII_SOCKET                  
_POSIX_PII_XTI                     
_POSIX_POLL                        
_POSIX_PRIORITIZED_IO              200809
_POSIX_PRIORITY_SCHEDULING         200809
_POSIX_REALTIME_SIGNALS            200809
_POSIX_SAVED_IDS                   1
_POSIX_SELECT                      
_POSIX_SEMAPHORES                  200809
_POSIX_SHARED_MEMORY_OBJECTS       200809
_POSIX_SSIZE_MAX                   32767
_POSIX_STREAM_MAX                  16
_POSIX_SYNCHRONIZED_IO             200809
_POSIX_THREADS                     200809
_POSIX_THREAD_ATTR_STACKADDR       200809
_POSIX_THREAD_ATTR_STACKSIZE       200809
_POSIX_THREAD_PRIORITY_SCHEDULING  200809
_POSIX_THREAD_PRIO_INHERIT         200809
_POSIX_THREAD_PRIO_PROTECT         200809
_POSIX_THREAD_ROBUST_PRIO_INHERIT  
_POSIX_THREAD_ROBUST_PRIO_PROTECT  
_POSIX_THREAD_PROCESS_SHARED       200809
_POSIX_THREAD_SAFE_FUNCTIONS       200809
_POSIX_TIMERS                      200809
TIMER_MAX                          
_POSIX_TZNAME_MAX                  6
_POSIX_VERSION                     200809
_T_IOV_MAX                         
_XOPEN_CRYPT                       1
_XOPEN_ENH_I18N                    1
_XOPEN_LEGACY                      1
_XOPEN_REALTIME                    1
_XOPEN_REALTIME_THREADS            1
_XOPEN_SHM                         1
_XOPEN_UNIX                        1
_XOPEN_VERSION                     700
_XOPEN_XCU_VERSION                 4
_XOPEN_XPG2                        1
_XOPEN_XPG3                        1
_XOPEN_XPG4                        1
BC_BASE_MAX                        99
BC_DIM_MAX                         2048
BC_SCALE_MAX                       99
BC_STRING_MAX                      1000
CHARCLASS_NAME_MAX                 2048
COLL_WEIGHTS_MAX                   255
EQUIV_CLASS_MAX                    
EXPR_NEST_MAX                      32
LINE_MAX                           2048
POSIX2_BC_BASE_MAX                 99
POSIX2_BC_DIM_MAX                  2048
POSIX2_BC_SCALE_MAX                99
POSIX2_BC_STRING_MAX               1000
POSIX2_CHAR_TERM                   200809
POSIX2_COLL_WEIGHTS_MAX            255
POSIX2_C_BIND                      200809
POSIX2_C_DEV                       200809
POSIX2_C_VERSION                   
POSIX2_EXPR_NEST_MAX               32
POSIX2_FORT_DEV                    
POSIX2_FORT_RUN                    
_POSIX2_LINE_MAX                   2048
POSIX2_LINE_MAX                    2048
POSIX2_LOCALEDEF                   200809
POSIX2_RE_DUP_MAX                  32767
POSIX2_SW_DEV                      200809
POSIX2_UPE                         
POSIX2_VERSION                     200809
RE_DUP_MAX                         32767
PATH                               /bin:/usr/bin
CS_PATH                            /bin:/usr/bin
LFS_CFLAGS                         -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LFS_LDFLAGS                        
LFS_LIBS                           
LFS_LINTFLAGS                      -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LFS64_CFLAGS                       -D_LARGEFILE64_SOURCE
LFS64_LDFLAGS                      
LFS64_LIBS                         
LFS64_LINTFLAGS                    -D_LARGEFILE64_SOURCE
_XBS5_WIDTH_RESTRICTED_ENVS        XBS5_ILP32_OFF32
XBS5_ILP32_OFFBIG
XBS5_WIDTH_RESTRICTED_ENVS         XBS5_ILP32_OFF32
XBS5_ILP32_OFFBIG
_XBS5_ILP32_OFF32                  1
XBS5_ILP32_OFF32_CFLAGS            -m32
XBS5_ILP32_OFF32_LDFLAGS           -m32
XBS5_ILP32_OFF32_LIBS              
XBS5_ILP32_OFF32_LINTFLAGS         
_XBS5_ILP32_OFFBIG                 1
XBS5_ILP32_OFFBIG_CFLAGS           -m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
XBS5_ILP32_OFFBIG_LDFLAGS          -m32
XBS5_ILP32_OFFBIG_LIBS             
XBS5_ILP32_OFFBIG_LINTFLAGS        
_XBS5_LP64_OFF64                   
XBS5_LP64_OFF64_CFLAGS             
XBS5_LP64_OFF64_LDFLAGS            
XBS5_LP64_OFF64_LIBS               
XBS5_LP64_OFF64_LINTFLAGS          
_XBS5_LPBIG_OFFBIG                 
XBS5_LPBIG_OFFBIG_CFLAGS           
XBS5_LPBIG_OFFBIG_LDFLAGS          
XBS5_LPBIG_OFFBIG_LIBS             
XBS5_LPBIG_OFFBIG_LINTFLAGS        
_POSIX_V6_ILP32_OFF32              1
POSIX_V6_ILP32_OFF32_CFLAGS        -m32
POSIX_V6_ILP32_OFF32_LDFLAGS       -m32
POSIX_V6_ILP32_OFF32_LIBS          
POSIX_V6_ILP32_OFF32_LINTFLAGS     
_POSIX_V6_WIDTH_RESTRICTED_ENVS    POSIX_V6_ILP32_OFF32
POSIX_V6_ILP32_OFFBIG
POSIX_V6_WIDTH_RESTRICTED_ENVS     POSIX_V6_ILP32_OFF32
POSIX_V6_ILP32_OFFBIG
_POSIX_V6_ILP32_OFFBIG             1
POSIX_V6_ILP32_OFFBIG_CFLAGS       -m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
POSIX_V6_ILP32_OFFBIG_LDFLAGS      -m32
POSIX_V6_ILP32_OFFBIG_LIBS         
POSIX_V6_ILP32_OFFBIG_LINTFLAGS    
_POSIX_V6_LP64_OFF64               
POSIX_V6_LP64_OFF64_CFLAGS         
POSIX_V6_LP64_OFF64_LDFLAGS        
POSIX_V6_LP64_OFF64_LIBS           
POSIX_V6_LP64_OFF64_LINTFLAGS      
_POSIX_V6_LPBIG_OFFBIG             
POSIX_V6_LPBIG_OFFBIG_CFLAGS       
POSIX_V6_LPBIG_OFFBIG_LDFLAGS      
POSIX_V6_LPBIG_OFFBIG_LIBS         
POSIX_V6_LPBIG_OFFBIG_LINTFLAGS    
_POSIX_V7_ILP32_OFF32              1
POSIX_V7_ILP32_OFF32_CFLAGS        -m32
POSIX_V7_ILP32_OFF32_LDFLAGS       -m32
POSIX_V7_ILP32_OFF32_LIBS          
POSIX_V7_ILP32_OFF32_LINTFLAGS     
_POSIX_V7_WIDTH_RESTRICTED_ENVS    POSIX_V7_ILP32_OFF32
POSIX_V7_ILP32_OFFBIG
POSIX_V7_WIDTH_RESTRICTED_ENVS     POSIX_V7_ILP32_OFF32
POSIX_V7_ILP32_OFFBIG
_POSIX_V7_ILP32_OFFBIG             1
POSIX_V7_ILP32_OFFBIG_CFLAGS       -m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
POSIX_V7_ILP32_OFFBIG_LDFLAGS      -m32
POSIX_V7_ILP32_OFFBIG_LIBS         
POSIX_V7_ILP32_OFFBIG_LINTFLAGS    
_POSIX_V7_LP64_OFF64               
POSIX_V7_LP64_OFF64_CFLAGS         
POSIX_V7_LP64_OFF64_LDFLAGS        
POSIX_V7_LP64_OFF64_LIBS           
POSIX_V7_LP64_OFF64_LINTFLAGS      
_POSIX_V7_LPBIG_OFFBIG             
POSIX_V7_LPBIG_OFFBIG_CFLAGS       
POSIX_V7_LPBIG_OFFBIG_LDFLAGS      
POSIX_V7_LPBIG_OFFBIG_LIBS         
POSIX_V7_LPBIG_OFFBIG_LINTFLAGS    
_POSIX_ADVISORY_INFO               200809
_POSIX_BARRIERS                    200809
_POSIX_BASE                        
_POSIX_C_LANG_SUPPORT              
_POSIX_C_LANG_SUPPORT_R            
_POSIX_CLOCK_SELECTION             200809
_POSIX_CPUTIME                     200809
_POSIX_THREAD_CPUTIME              200809
_POSIX_DEVICE_SPECIFIC             
_POSIX_DEVICE_SPECIFIC_R           
_POSIX_FD_MGMT                     
_POSIX_FIFO                        
_POSIX_PIPE                        
_POSIX_FILE_ATTRIBUTES             
_POSIX_FILE_LOCKING                
_POSIX_FILE_SYSTEM                 
_POSIX_MONOTONIC_CLOCK             200809
_POSIX_MULTI_PROCESS               
_POSIX_SINGLE_PROCESS              
_POSIX_NETWORKING                  
_POSIX_READER_WRITER_LOCKS         200809
_POSIX_SPIN_LOCKS                  200809
_POSIX_REGEXP                      1
_REGEX_VERSION                     
_POSIX_SHELL                       1
_POSIX_SIGNALS                     
_POSIX_SPAWN                       200809
_POSIX_SPORADIC_SERVER             
_POSIX_THREAD_SPORADIC_SERVER      
_POSIX_SYSTEM_DATABASE             
_POSIX_SYSTEM_DATABASE_R           
_POSIX_TIMEOUTS                    200809
_POSIX_TYPED_MEMORY_OBJECTS        
_POSIX_USER_GROUPS                 
_POSIX_USER_GROUPS_R               
POSIX2_PBS                         
POSIX2_PBS_ACCOUNTING              
POSIX2_PBS_LOCATE                  
POSIX2_PBS_TRACK                   
POSIX2_PBS_MESSAGE                 
SYMLOOP_MAX                        
STREAM_MAX                         16
AIO_LISTIO_MAX                     
AIO_MAX                            
AIO_PRIO_DELTA_MAX                 20
DELAYTIMER_MAX                     2147483647
HOST_NAME_MAX                      64
LOGIN_NAME_MAX                     256
MQ_OPEN_MAX                        
MQ_PRIO_MAX                        32768
_POSIX_DEVICE_IO                   
_POSIX_TRACE                       
_POSIX_TRACE_EVENT_FILTER          
_POSIX_TRACE_INHERIT               
_POSIX_TRACE_LOG                   
RTSIG_MAX                          32
SEM_NSEMS_MAX                      
SEM_VALUE_MAX                      2147483647
SIGQUEUE_MAX                       15989
FILESIZEBITS                       64
POSIX_ALLOC_SIZE_MIN               4096
POSIX_REC_INCR_XFER_SIZE           
POSIX_REC_MAX_XFER_SIZE            
POSIX_REC_MIN_XFER_SIZE            4096
POSIX_REC_XFER_ALIGN               4096
SYMLINK_MAX                        
GNU_LIBC_VERSION                   glibc 2.13
GNU_LIBPTHREAD_VERSION             NPTL 2.13
POSIX2_SYMLINKS                    1
LEVEL1_ICACHE_SIZE                 32768
LEVEL1_ICACHE_ASSOC                8
LEVEL1_ICACHE_LINESIZE             64
LEVEL1_DCACHE_SIZE                 32768
LEVEL1_DCACHE_ASSOC                8
LEVEL1_DCACHE_LINESIZE             64
LEVEL2_CACHE_SIZE                  1048576
LEVEL2_CACHE_ASSOC                 8
LEVEL2_CACHE_LINESIZE              64
LEVEL3_CACHE_SIZE                  0
LEVEL3_CACHE_ASSOC                 0
LEVEL3_CACHE_LINESIZE              0
LEVEL4_CACHE_SIZE                  0
LEVEL4_CACHE_ASSOC                 0
LEVEL4_CACHE_LINESIZE              0
IPV6                               200809
RAW_SOCKETS                        200809

	
comments powered by Disqus