In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the common interview questions for Linux operation and maintenance". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "what are the common interview questions for Linux operation and maintenance".
1. How to filter out all the first-level directories in the oldboy under the known current directory (excluding subdirectories, that is, only first-level directories)
Method 1:find. /-type d-maxdepth 1 method 2:ls-F method 3:ls-l | grep ^ d method 4:ls-F | grep / $method 5:ls-l | grep-v ^-method 6:tree-L 1 method 7: distinguish file and directory methods 8:ls-l by color | sed-n / ^ ddeband
2. There are many files in a directory (many screens when ls is viewed). If you want to see the recently updated files as quickly as possible, how do you look at them?
At the bottom of ls-lrt / etc # is the latest updated file parameter description:-r,-reverse # flip sort-t # sort by modification time
3. It is known that the access log of the apache service is recorded daily in the local directory / app/logs of the server. Due to the shortage of disk space, it is required that you can only keep the access log for the last 7 days! May I ask how to solve it?
Method or configuration or processing command (hint: you can start with the apache service configuration or from the generated log)
1 >. The function of the service itself is realized 2 >. Manually delete find. /-mtime + 7-type f-name "* .log"-exec rm-f {} /; # find logs from 7 days ago and delete them
4. What should I do if I print the line number and content of the configuration file nginx.conf?
Methods 1:cat-n nginx.conf method 2:less-N nginx.conf method 3:grep-n. Nginx.conf # here. (dot) sign, which represents any single character, and-n adds a line number to each filtered line
5. How can I quickly return to the last directory?
The cd-# environment variable OLDPWD always records the last location
6. When debugging system services, you want to view Syslog / var/log/messages updates in real time. How do you do that?
Method 1:tail-f / var/log/messages method 2:tail-F / var/log/messages # and-f ratio the function of multiple retries is that the file no longer exists and will keep trying
7. After installing the system (CentOS/RHEL), what should I do if I want the network file sharing service NFS to boot only at level 3?
Chkconfig-level 3 nfs off
8. How to check how many lines are in the / etc/services file?
Method 1: directly use the command wcwc-l / etc/services method 2: add the line number cat-n / etc/services to the file content | tail-1 method 3:sed-n'$='/ etc/services method 4:grep-n $/ etc/services | tail-1
9. Please filter out the ip address in ifconfig?
Method 1:ifconfig eth2 | grep "inet add" | cut-donglug'- f2 | cut-d''- F1 method 2:ifconfig eth2 | grep "inet addr" | awk-F:'{print $2}'| awk'{print $1} 'method 3:ifconfig eth2 | awk-F' [:] + 'NR==2 {print $4}' method 4:ifconfig eth0 | sed-n '2p' | sed's # ^. * addr:##g' | sed's # Bc.*$##g'
10. How to take out the permissions in / etc/inittab and print them in the form of the number 644
Method 1:stat / etc/inittab | sed-n '4p' | awk-F "[(/]"' {print $2} 'method 2:stat-c% a / etc/inittab method 3:ll / etc/passwd | cut-c 1-9 | tr rwx- 4210 | awk-F "{print $1 / 3 $4" 6 $7 / 8 "9}"
11. Advertising links are implanted in the files in the / tools directory, how to remove them
Delete the placed ad:
Sed-I'/ You are using an outdated browser. Please upgrade your browser/a > and try again./p > / d'kaka
12. Print out the contents of the kaka file with blank lines removed.
Method 1:grep-v "^ $" kaka method 2:sed'/ ^ $/ d 'kaka
13. Print the date of 3 days ago in a format such as 2016-05-06
Methods 1:date "+% F"-d "3 day ago" method 2:date "+% F"-d "- 3 day" are all the contents of this article entitled "what are the common interview questions for Linux operation and maintenance?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.