ʹÓà Linux ÃüÁ×÷¿ÉÒÔ»ñµÃÐí¶àÀÖȤ£¬µ«ÊÇÈç¹ûÄúʹÓÃһЩÃüÁËüÃÇ¿ÉÒÔ¼õÉÙÄúµÄ¹¤×÷»òÒÔÓÐȤµÄ·½Ê½ÏÔʾÐÅϢʱ£¬Äú½«»ñµÃ¸ü¶àµÄÀÖȤ¡£ÔÚ½ñÌìµÄÎÄÕÂÖУ¬ÎÒÃǽ«½éÉÜÁù¸öÃüÁËüÃÇ¿ÉÄÜ»áʹÄãÓÃÔÚÃüÁîÐÐÉϵÄʱ¼ä¸ü¼ÓÖµµ±¡£
watch
watch ÃüÁî»áÖظ´ÔËÐÐÄú¸ø³öµÄÈκÎÃüÁ²¢ÏÔʾÊä³ö¡£Ä¬ÈÏÇé¿öÏ£¬ËüÿÁ½ÃëÔËÐÐÒ»´ÎÃüÁî¡£ÃüÁîµÄÿ´ÎÔËÐж¼½«¸²¸ÇÉÏÒ»´ÎÔËÐÐʱÏÔʾµÄÄÚÈÝ£¬Òò´ËÄúʼÖÕ¿ÉÒÔ¿´µ½×îеÄÊý¾Ý¡£
Äú¿ÉÄÜ»áÔڵȴýijÈ˵ǼʱʹÓÃËü¡£ÔÚÕâÖÖÇé¿öÏ£¬Äú¿ÉÒÔʹÓà watch who ÃüÁî»òÕß watch -n 15 who ÃüÁîʹÿ 15 ÃëÔËÐÐÒ»´Î£¬¶ø²»ÊÇÁ½ÃëÒ»´Î¡£ÁíÍâÖն˴°¿ÚµÄÓÒÉϽǻáÏÔʾÈÕÆÚºÍʱ¼ä¡£
$ watch -n 5 who
Every 5.0s: who stinkbug: Wed Aug 23 14:52:15 2017
shs pts/0 2017-08-23 14:45 (192.168.0.11)
zoe pts/1 2017-08-23 08:15 (192.168.0.19)
ÄúÒ²¿ÉÒÔʹÓÃËüÀ´²é¿´ÈÕÖ¾Îļþ¡£Èç¹ûÄúÏÔʾµÄÊý¾ÝûÓÐÈκα仯£¬ÔòÖ»Óд°¿Ú½ÇÂäÀïµÄÈÕÆÚºÍʱ¼ä»á·¢Éú±ä»¯¡£
$ watch tail /var/log/syslog
Every 2.0s: tail /var/log/syslog stinkbug: Wed Aug 23 15:16:37 2017
Aug 23 14:45:01 stinkbug CRON[7214]: (root) CMD (command -v debian-sa1 > /dev/nu
ll && debian-sa1 1 1)
Aug 23 14:45:17 stinkbug systemd[1]: Started Session 179 of user shs.
Aug 23 14:55:01 stinkbug CRON[7577]: (root) CMD (command -v debian-sa1 > /dev/nu
ll && debian-sa1 1 1)
Aug 23 15:05:01 stinkbug CRON[7582]: (root) CMD (command -v debian-sa1 > /dev/nu
ll && debian-sa1 1 1)
Aug 23 15:08:48 stinkbug systemd[1]: Starting Cleanup of Temporary Directories...
Aug 23 15:08:48 stinkbug systemd-tmpfiles[7584]: [/usr/lib/tmpfiles.d/var.conf:1
4] Duplicate line for path "/var/log", ignoring.
Aug 23 15:08:48 stinkbug systemd[1]: Started Cleanup of Temporary Directories.
Aug 23 15:13:41 stinkbug systemd[1]: Started Session 182 of user shs.
Aug 23 15:14:29 stinkbug systemd[1]: Started Session 183 of user shs.
Aug 23 15:15:01 stinkbug CRON[7828]: (root) CMD (command -v debian-sa1 > /dev/nu
ll && debian-sa1 1 1)
ÕâÀïµÄÊä³öºÍʹÓÃÃüÁî tail -f /var/log/syslog µÄÊä³öÏàËÆ¡£
look
Õâ¸öÃüÁîµÄÃû×Ö look ¿ÉÄÜ»áÈÃÎÒÃÇÒÔΪËüºÍ watch ×öÀàËƵÄÊÂÇ飬µ«ÆäʵÊDz»Í¬µÄ¡£look ÃüÁîÓÃÓÚËÑË÷ÒÔij¸öÌض¨×Ö·û´®¿ªÍ·µÄµ¥´Ê¡£
$ look ecl
eclectic
eclectic's
eclectically
eclecticism
eclecticism's
eclectics
eclipse
eclipse's
eclipsed
eclipses
eclipsing
ecliptic
ecliptic's
look ÃüÁîͨ³£ÓÐÖúÓÚµ¥´ÊµÄƴд£¬ËüʹÓà /usr/share/dict/words Îļþ£¬³ý·ÇÄãʹÓÃÈçϵÄÃüÁîÖ¸¶¨ÁËÎļþÃû£º
$ look esac .bashrc
esac
esac
esac
ÔÚÕâÖÖÇé¿öÏ£¬ËüµÄ×÷ÓþÍÏñ¸úÔÚÒ»¸ö awk ÃüÁîºóÃæµÄ grep £¬Ö»´òÓ¡Æ¥ÅäÐÐÉϵĵÚÒ»¸öµ¥´Ê¡£
man -k
man -k ÃüÁîÁгö°üº¬Ö¸¶¨µ¥´ÊµÄÊÖ²áÒ³¡£ËüµÄ¹¤×÷»ù±¾ÉÏºÍ apropos ÃüÁîÒ»Ñù¡£
$ man -k logrotate
dh_installlogrotate (1) - install logrotate config files
logrotate (8) - rotates, compresses, and mails system logs
logrotate.conf (5) - rotates, compresses, and mails system logs
help
µ±ÄãÍêÈ«¾øÍûµÄʱºò£¬Äú¿ÉÄÜ»áÊÔͼʹÓôËÃüÁhelp ÃüÁîʵ¼ÊÉÏÊÇÏÔʾһ¸ö shell ÄÚÖÃÃüÁîµÄÁÐ±í¡£×îÁîÈ˾ªÑȵÄÊÇËüÓÐÏ൱¶àµÄ²ÎÊý±äÁ¿¡£Äã¿ÉÄܻῴµ½ÕâÑùµÄ¶«Î÷£¬È»ºó¿ªÊ¼ÏëÖªµÀÕâЩÄÚÖù¦ÄÜ¿ÉÒÔΪÄã×öЩʲô£º
$ help
GNU bash, version 4.4.7(1)-release (i686-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
job_spec [&] history [-c] [-d offset] [n] or hist>
(( expression )) if COMMANDS; then COMMANDS; [ elif C>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs >
: kill [-s sigspec | -n signum | -sigs>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-d delim] [-n count] [-O or>
bind [-lpsvPSVX] [-m keymap] [-f file> popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->
cd [-L|[-P [-e]] [-@]] [dir] readarray [-n count] [-O origin] [-s>
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] o>
compgen [-abcdefgjksuv] [-o option] [> return [n]
complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>
compopt [-o|+o option] [-DE] [name ..> set [-abefhkmnptuvxBCHP] [-o option->
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgilnrtux] [-p] [name[=v> source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ... | pid > test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [na> times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [argume> true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or ex> typeset [-aAfFgilnrtux] [-p] name[=v>
false ulimit [-SHabcdefiklmnpqrstuvxPT] [l>
fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name > variables - Names and meanings of so>
getopts optstring name [arg] wait [-n] [id ...]
hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
help [-dms] [pattern ...] { COMMANDS ; }
stat -c
stat ÃüÁîÓÃÓÚÏÔʾÎļþµÄ´óС¡¢ËùÓÐÕß¡¢Óû§×é¡¢Ë÷Òý½ÚµãºÅ¡¢È¨ÏÞ¡¢Ð޸ĺͷÃÎÊʱ¼äµÈÖØÒªµÄͳ¼ÆÐÅÏ¢¡£ÕâÊÇÒ»¸ö·Ç³£ÓÐÓõÄÃüÁ¿ÉÒÔÏÔʾ±È ls -l ¸ü¶àµÄϸ½Ú¡£
$ stat .bashrc
File: .bashrc
Size: 4048 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 421481 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ shs) Gid: ( 1000/ shs)
Access: 2017-08-23 15:13:41.781809933 -0400
Modify: 2017-06-21 17:37:11.875157790 -0400
Change: 2017-06-21 17:37:11.899157791 -0400
Birth: -
ʹÓà -c Ñ¡ÏÄú¿ÉÒÔÖ¸¶¨Òª²é¿´µÄ×ֶΡ£ÀýÈ磬Èç¹ûÄúÖ»Ïë²é¿´Ò»¸öÎļþ»òһϵÁÐÎļþµÄÎļþÃûºÍ·ÃÎÊȨÏÞ£¬Ôò¿ÉÒÔÕâÑù×ö£º
$ stat -c '%n %a' .bashrc
.bashrc 644
ÔÚ´ËÃüÁîÖУ¬ %n ±íʾÿ¸öÎļþµÄÃû³Æ£¬¶ø %a ±íʾ·ÃÎÊȨÏÞ¡£%u ±íʾÊý×ÖÀàÐ굀 UID£¬¶ø %U ±íʾÓû§Ãû¡£
$ stat -c '%n %a' bin/*
bin/loop 700
bin/move2nohup 700
bin/nohup.out 600
bin/show_release 700
$ stat -c '%n %a %U' bin/*
bin/loop 700 shs
bin/move2nohup 700 shs
bin/nohup.out 600 root
bin/show_release 700 shs
TAB
Èç¹ûÄãûÓÐʹÓùý tab ¼üÀ´²¹È«ÎļþÃû£¬ÄãÕæµÄ´í¹ýÁËÒ»¸ö·Ç³£ÓÐÓõÄÃüÁîÐм¼ÇÉ¡£tab ¼üÌṩÎļþÃû²¹È«¹¦ÄÜ£¨°üÀ¨Ê¹Óà cd ʱµÄĿ¼£©¡£ËüÔÚ³öÏÖÆçÒå֮ǰ¾¡¿ÉÄܶàµÄÌî³äÎļþÃû£¨¶à¸öÎļþÒÔÏàͬµÄ×Öĸ¿ªÍ·¡£Èç¹ûÄúÓÐÒ»¸öÃûΪ bigplans µÄÎļþ£¬ÁíÒ»¸öÃûΪ bigplans2017 µÄÎļþ»á·¢ÉúÆçÒ壬Ä㽫Ìýµ½Ò»¸öÉùÒô£¬È»ºóÐèÒª¾ö¶¨ÊÇ°´Ï»سµ¼ü»¹ÊÇÊäÈë 2 Ö®ºóÔÙ°´Ï tab ¼üÑ¡ÔñµÚ¶þ¸öÎļþ¡£
±¾ÎÄתÔØ×Ô£ºhttp://www.linuxprobe.com/linux-cli-666.html
Ãâ·ÑÌṩ×îÐÂLinux¼¼Êõ½Ì³ÌÊé¼®£¬Îª¿ªÔ´¼¼Êõ°®ºÃÕßŬÁ¦×öµÃ¸ü¶à¸üºÃ£¬¿ªÔ´Õ¾µã£ºhttp://www.linuxprobe.com/
Ronny ÓÚ 2017-09-08 10:04:04·¢±í:
ÔÀ´»¹ÓÐÕâÖÖ¼¼ÇÉ~£¡