{"id":70236,"date":"2023-10-02T18:21:04","date_gmt":"2023-10-02T10:21:04","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=70236"},"modified":"2023-10-02T18:21:04","modified_gmt":"2023-10-02T10:21:04","slug":"linux-test-questions","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-test-questions.html","title":{"rendered":"Linux\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u7b14\u8bd5\u9898\u5b9e\u4f8b\u8bb2\u89e3"},"content":{"rendered":"
\u65b9\u6cd51\uff1afind .\/ -type d -maxdepth 1<\/pre>\n\u65b9\u6cd52\uff1als -F<\/pre>\n\u65b9\u6cd53\uff1als -l \u00a0| grep ^d<\/pre>\n\u65b9\u6cd54\uff1als -F | grep \/$<\/pre>\n\u65b9\u6cd55\uff1als -l | grep -v ^-<\/pre>\n\u65b9\u6cd56\uff1atree -L 1<\/pre>\n\u65b9\u6cd57\uff1a\u6839\u636e\u989c\u8272\u6765\u533a\u5206\u6587\u4ef6\u548c\u76ee\u5f55<\/pre>\n\u65b9\u6cd58\uff1als -l | sed -n \/^d\/p<\/pre>\n2\u3001\u4e00\u4e2a\u76ee\u5f55\u4e2d\u6709\u5f88\u591a\u6587\u4ef6(ls\u67e5\u770b\u65f6\u597d\u591a\u5c4f)\uff0c\u60f3\u6700\u5feb\u901f\u5ea6\u67e5\u770b\u5230\u6700\u8fd1\u66f4\u65b0\u7684\u6587\u4ef6\uff0c\u5982\u4f55\u770b\uff1f<\/strong><\/span><\/div>\nls -lrt \u00a0\/etc #\u6700\u5e95\u90e8\u7684\u5c31\u662f\u6700\u65b0\u66f4\u65b0\u7684\u6587\u4ef6\r\n\u53c2\u6570\u8bf4\u660e\uff1a\r\n-r, \u2013reverse #\u7ffb\u8f6c\u6392\u5e8f\r\n-t #\u6309\u7167\u4fee\u6539\u65f6\u95f4\u6392\u5e8f<\/pre>\n3\u3001\u5df2\u77e5apache\u670d\u52a1\u7684\u8bbf\u95ee\u65e5\u5fd7\u6309\u5929\u8bb0\u5f55\u5728\u670d\u52a1\u5668\u672c\u5730\u76ee\u5f55\/app\/logs\u4e0b\uff0c\u7531\u4e8e\u78c1\u76d8\u7a7a\u95f4\u7d27\u5f20\uff0c\u73b0\u5728\u8981\u6c42\u53ea\u80fd\u4fdd\u7559\u6700\u8fd17\u5929\u8bbf\u95ee\u65e5\u5fd7\uff01\u8bf7\u95ee\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><\/span><\/div>\n\u529e\u6cd5\u6216\u914d\u7f6e\u6216\u5904\u7406\u547d\u4ee4(\u63d0\u793a\uff1a\u53ef\u4ee5\u4eceapache\u670d\u52a1\u914d\u7f6e\u4e0a\u7740\u624b\uff0c\u4e5f\u53ef\u4ee5\u4ece\u751f\u6210\u51fa\u6765\u7684\u65e5\u5fd7\u4e0a\u7740\u624b)<\/p>\n
1>.\u670d\u52a1\u81ea\u8eab\u7684\u529f\u80fd\u5b9e\u73b0\r\n2>.\u624b\u52a8\u5220\u9664\r\nfind .\/ -mtime +7 -type f -name \u201c*.log\u201d -exec rm -f {} \/; #\u67e5\u627e7\u5929\u4ee5\u524d\u7684\u65e5\u5fd7\u5e76\u5220\u9664\u4e4b<\/pre>\n4\u3001\u6253\u5370\u914d\u7f6e\u6587\u4ef6nginx.conf\u5185\u5bb9\u7684\u884c\u53f7\u53ca\u5185\u5bb9\uff0c\u8be5\u5982\u4f55\u505a\uff1f<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1acat -n nginx.conf<\/pre>\n\u65b9\u6cd52\uff1aless -N nginx.conf<\/pre>\n\u65b9\u6cd53\uff1agrep -n . nginx.conf #\u6b64\u5904\u7684.(\u70b9)\u53f7\uff0c\u8868\u793a\u4efb\u610f\u5355\u4e2a\u5b57\u7b26\uff0c-n\u662f\u7ed9\u8fc7\u6ee4\u51fa\u7684\u6bcf\u4e00\u884c\u52a0\u884c\u53f7<\/pre>\n5\u3001\u5982\u4f55\u8fc5\u901f\u8fd4\u56de\u5230\u4e0a\u4e00\u6b21\u7684\u76ee\u5f55\uff1f<\/strong><\/span><\/div>\ncd \u2013\u00a0\u00a0\u00a0\u00a0#\u73af\u5883\u53d8\u91cfOLDPWD\u59cb\u7ec8\u8bb0\u5f55\u7740\u4e0a\u4e00\u6b21\u7684\u4f4d\u7f6e<\/pre>\n6\u3001\u8c03\u8bd5\u7cfb\u7edf\u670d\u52a1\u65f6\uff0c\u5e0c\u671b\u80fd\u5b9e\u65f6\u67e5\u770b\u7cfb\u7edf\u65e5\u5fd7\/var\/log\/messages\u7684\u66f4\u65b0\uff0c\u5982\u4f55\u505a\uff1f<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1atail -f \/var\/log\/messages<\/pre>\n\u65b9\u6cd52\uff1atail -F \/var\/log\/messages #\u548c-f\u6bd4\u591a\u4e2a\u91cd\u8bd5\u7684\u529f\u80fd\uff0c\u5c31\u662f\u6587\u4ef6\u4e0d\u5b58\u5728\u4e86\uff0c\u4f1a\u4e0d\u65ad\u5c1d\u8bd5<\/pre>\n7\u3001\u5b89\u88c5\u5b8c\u7cfb\u7edf(CentOS\/RHEL)\u540e\uff0c\u5e0c\u671b\u8ba9\u7f51\u7edc\u6587\u4ef6\u5171\u4eab\u670d\u52a1NFS,\u4ec5\u57283\u7ea7\u522b\u4e0a\u5f00\u673a\u81ea\u542f\u8be5\u5982\u4f55\u505a\uff1f<\/strong><\/span><\/div>\nchkconfig \u2013level 3 nfs off<\/pre>\n8\u3001\u5982\u4f55\u67e5\u770b\/etc\/services\u6587\u4ef6\u6709\u591a\u5c11\u884c\uff1f<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1a\u76f4\u63a5\u4f7f\u7528\u547d\u4ee4wc\r\nwc -l \u00a0\/etc\/services<\/pre>\n\u65b9\u6cd52\uff1a\u7ed9\u6587\u4ef6\u5185\u5bb9\u52a0\u884c\u53f7\r\ncat -n \u00a0\/etc\/services | tail -1<\/pre>\n\u65b9\u6cd53\uff1ased \u00a0-n \u00a0\u2018$=\u2019 \u00a0\/etc\/services<\/pre>\n\u65b9\u6cd54\uff1agrep -n $ \/etc\/services | tail -1<\/pre>\n9\u3001\u8bf7\u8fc7\u6ee4\u51faifconfig\u4e2d\u7684ip\u5730\u5740\uff1f<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1aifconfig eth1|grep \u201cinet add\u201d|cut -d\u2019:\u2019 -f2|cut -d\u2019 \u2018 -f1<\/pre>\n\u65b9\u6cd52\uff1aifconfig eth1|grep \u201cinet addr\u201d|awk -F: \u2018{print $2}\u2019|awk \u2018{print $1}\u2019<\/pre>\n\u65b9\u6cd53\uff1aifconfig eth1|awk -F \u2018[ :]+\u2019 \u2018NR==2 {print $4}\u2019<\/pre>\n\u65b9\u6cd54\uff1aifconfig eth0|sed -n \u20182p\u2019|sed \u2018s#^.*addr:##g\u2019|sed \u2018s# Bc.*$##g\u2019<\/pre>\n10\u3001\u5982\u4f55\u5c06\/etc\/inittab\u4e2d\u7684\u6743\u9650\u53d6\u51fa\u6765\uff0c\u4ee5\u6570\u5b57644\u8fd9\u6837\u7684\u5f62\u5f0f\u6253\u5370<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1astat \/etc\/inittab |sed -n \u20184p\u2019|awk -F \u201c[(\/]\u201d \u2018{print $2}\u2019<\/pre>\n\u65b9\u6cd52\uff1astat -c %a \u00a0\/etc\/inittab<\/pre>\n\u65b9\u6cd53\uff1all \/etc\/passwd |cut -c 1-9|tr rwx- 4210|awk -F \u201c\u201d \u2018{print $1+$2+$3 $4+$5+$6 $7+$8+$9}\u2019<\/pre>\n11\u3001\u5728\/tools\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u91cc\u9762\u90fd\u88ab\u690d\u5165\u4e86\u5e7f\u544a\u94fe\u63a5\uff0c\u5982\u4f55\u5c06\u5176\u53bb\u9664<\/strong><\/span><\/div>\n\u5220\u9664\u690d\u5165\u5e7f\u544a\uff1a<\/p>\n
sed -i \u2018\/<p class=\u201dchromeframe\u201d>You are using an outdated browser. Please <a href=\u201dhttps:\/\/\/\/www.google.com\/\/chrome\/\/\u201d rel=\u201dexternal nofollow\u201d target=\u201d_blank\u201d>upgrade your browser<\/\/a> and try again.<\/\/p>\/\/\/d\u2019 kaka<\/pre>\n12\u3001\u6253\u5370\u51fakaka\u6587\u4ef6\u4e2d\u9664\u6389\u7a7a\u884c\u7684\u5185\u5bb9<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1agrep -v \u201c^$\u201d kaka<\/pre>\n\u65b9\u6cd52\uff1ased \u00a0\u2018\/^$\/d\u2019 kaka<\/pre>\n13\u3001\u6253\u53703\u5929\u524d\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u5982\uff1a2016-05-06<\/strong><\/span><\/div>\n\u65b9\u6cd51\uff1adate \u201c+%F\u201d -d \u201c3 day ago\u201d<\/pre>\n\u65b9\u6cd52\uff1adate \u201c+%F\u201d -d \u201c-3 day\u201d<\/pre>\n\n\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.yunweipai.com\/archives\/18796.html<\/a><\/p>\n