尊龙凯时人生就是博

ÔõÑùͨ¹ýLinux¹¤¾ß¶Ô´ó¹æÄ£ÈÕÖ¾¾ÙÐÐÆÊÎö £¿

ÔõÑùͨ¹ýlinux¹¤¾ß¶Ô´ó¹æÄ£ÈÕÖ¾¾ÙÐÐÆÊÎö £¿

Åä¾°£º

ÔÚÏÖ´ú»¥ÁªÍøÓ¦ÓÃÖÐ £¬±¬·¢´ó×ÚµÄÈÕÖ¾Êý¾ÝÊǺܳ£¼ûµÄ¡£ÕâЩÈÕÖ¾Êý¾Ý°üÀ¨ÁËÓ¦ÓóÌÐòµÄÔËÐÐ״̬¡¢¹ýʧÐÅÏ¢¡¢»á¼û¼Í¼µÈÖ÷ÒªÐÅÏ¢¡£¹ØÓÚϵͳÖÎÀíÔ±»ò¿ª·¢Ö°Ô±À´Ëµ £¬ÔõÑù¸ßЧµØ¶ÔÕâЩ´ó¹æÄ£µÄÈÕÖ¾¾ÙÐÐÆÊÎöºÍÌáÈ¡ÓÐמÙ×ãÇáÖصÄÒâÒå¡£±¾ÎĽ«ÏÈÈÝһЩ³£ÓõÄLinux¹¤¾ß £¬²¢ÌṩʾÀý´úÂë £¬×ÊÖú¶ÁÕ߸üºÃµØÃ÷È·ºÍÕÆÎÕÔõÑùÔÚLinuxƽ̨É϶Դó¹æÄ£ÈÕÖ¾¾ÙÐÐÆÊÎö¡£

Ò»¡¢ grep

grepÊÇLinuxÖзǾ­³£ÓõÄÏÂÁîÐй¤¾ß £¬ÓÃÓÚÔÚÎı¾ÖвéÕÒÆ¥ÅäµÄ×Ö·û´®¡£ËüµÄ»ù±¾Ó÷¨ÈçÏ£º

grep "Òªº¦×Ö" ÎļþÃû

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬Òªº¦×ÖÊÇÄãÒª²éÕÒµÄÄÚÈÝ £¬ÎļþÃûÊÇÄãÒªËÑË÷µÄÎļþÃû¡£

ʾÀý´úÂ룺

¼ÙÉèÎÒÃÇÓÐÒ»¸ö°üÀ¨ÁË´ó×Ú»á¼û¼Í¼µÄÈÕÖ¾Îļþaccess.log £¬ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÃæµÄÏÂÁîÀ´²éÕÒÆäÖаüÀ¨Ìض¨Òªº¦×ֵļͼ£º

grep "404" access.log

µÇ¼ºó¸´ÖÆ

Õâ»á·µ»ØËùÓаüÀ¨Òªº¦×Ö”404″µÄ¼Í¼¡£

¶þ¡¢ awk

awkÊÇÒ»ÖÖÇ¿Ê¢µÄÎı¾´¦Àí¹¤¾ß £¬¿ÉÒÔ¶ÔÎı¾¾ÙÐÐÖݪֲÙ×÷¡£ËüµÄ»ù±¾Ó÷¨ÈçÏ£º

awk '{pattern + action}' ÎļþÃû

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬patternÊÇÄãҪƥÅäµÄģʽ £¬actionÊǶÔÆ¥Åäµ½µÄÎı¾Ö´ÐеIJÙ×÷¡£

ʾÀý´úÂ룺

¼ÙÉèÎÒÃÇÐèÒªÌáÈ¡³öaccess.logÖеÄIPµØµãºÍ»á¼ûʱ¼ä £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔϵÄawkÏÂÁ

awk '{print $1, $4}' access.log

µÇ¼ºó¸´ÖÆ

Õâ»á·µ»ØÒ»¸öÒÔ¿Õ¸ñÍÑÀëµÄIPµØµãºÍ»á¼ûʱ¼äµÄÁбí¡£

Èý¡¢ sed

sedÊÇÒ»¸öÁ÷±à¼­Æ÷ £¬ÓÃÓÚ¶ÔÎı¾¾ÙÐÐÖݪֲÙ×÷¡£ËüµÄ»ù±¾Ó÷¨ÈçÏ£º

sed 's/Æ¥Åä×Ö·û´®/Ìæ»»×Ö·û´®/g' ÎļþÃû

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬Æ¥Åä×Ö·û´®ÊÇÄãÒªÌæ»»µÄÎı¾ £¬Ìæ»»×Ö·û´®ÊÇÄãÒªÌæ»»³ÉµÄÎı¾¡£

ʾÀý´úÂ룺

¼ÙÉèÎÒÃÇÐèÒª½«access.logÖеÄËùÓÐIPµØµãÌ滻Ϊ”xxx.xxx.xxx.xxx” £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔϵÄsedÏÂÁ

sed 's/[0-9]+.[0-9]+.[0-9]+.[0-9]+/xxx.xxx.xxx.xxx/g' access.log

µÇ¼ºó¸´ÖÆ

Õâ»á½«ËùÓÐIPµØµãÌ滻Ϊ”xxx.xxx.xxx.xxx”¡£

ËÄ¡¢ sort

sortÊÇÒ»¸öÓÃÓÚÅÅÐòÎı¾µÄ¹¤¾ß £¬ËüµÄ»ù±¾Ó÷¨ÈçÏ£º

sort ÎļþÃû

µÇ¼ºó¸´ÖÆ

ʾÀý´úÂ룺

¼ÙÉèÎÒÃÇÓÐÒ»¸ö°üÀ¨ÁË´ó×ÚÊý×ÖµÄÎļþnumbers.txt £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔϵÄsortÏÂÁî¶ÔÆä¾ÙÐÐÅÅÐò£º

sort numbers.txt

µÇ¼ºó¸´ÖÆ

Õâ»á·µ»ØÒ»¸öƾ֤Êý×ÖÉýÐòÅÅÁеÄÁбí¡£

Îå¡¢ headºÍtail

headºÍtailÊÇÓÃÓÚÌáÈ¡ÎļþµÄÇ°nÐкͺónÐеŤ¾ß £¬ËüÃǵĻù±¾Ó÷¨ÈçÏ£º

head -n ÎļþÃû
tail -n ÎļþÃû

µÇ¼ºó¸´ÖÆ

ʾÀý´úÂ룺

¼ÙÉèÎÒÃÇÐèÒªÉó²éaccess.logµÄÇ°10Ðкͺó10ÐÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔϵÄheadºÍtailÏÂÁ

head -n 10 access.log
tail -n 10 access.log

µÇ¼ºó¸´ÖÆ

Õâ»á·µ»Øaccess.logµÄÇ°10Ðкͺó10ÐС£

×ÛÉÏËùÊö £¬Í¨¹ýÉÏÊöÏÈÈݵÄgrep¡¢awk¡¢sed¡¢sort¡¢headºÍtailµÈLinux¹¤¾ß £¬ÎÒÃÇ¿ÉÒÔÀû±ãµØ¶Ô´ó¹æÄ£ÈÕÖ¾¾ÙÐÐÆÊÎöºÍÌáÈ¡¡£ËäÈ» £¬Linuxƽ̨»¹ÓµÓиü¶àÀàËƹ¤¾ßºÍÏÂÁî £¬¶ÁÕß¿ÉÒÔͨ¹ý½øÒ»²½µÄÑо¿ºÍʵ¼ù £¬¾ò¿Í¸ü¶àÇ¿Ê¢µÄ¹¦Ð§ £¬Ìá¸ßÈÕÖ¾ÆÊÎöµÄЧÂʺÍ׼ȷÐÔ¡£Ï£Íû±¾ÎĶԶÁÕßÓÐËù×ÊÖú£¡

ÒÔÉϾÍÊÇÔõÑùͨ¹ýLinux¹¤¾ß¶Ô´ó¹æÄ£ÈÕÖ¾¾ÙÐÐÆÊÎö £¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ