Common basic interview practice questions for Linux operation and maintenance (4) - improvement
1 ( ZZ ) command is to execute save and exit in vi editor
A :q B ZZ C :q! D :WQ
2 I installed a Linux system with a virtual machine, and suddenly I wanted to clone a server. After cloning, I found that I could not access the Internet. How to solve it?
1 Delete the uuid Mac address of the linux network card eth0
2 Clear /etc/udev/rules.d/70-persistent-net.rules
3 reboot
3 Common network detection commands and parameter enumeration instructions
1 ping
2 telnet
3 netstat -lntup
4 traceroute
4 Script implementation: Find files larger than 1M in the directory /var/log/ and move them to /tmp/log
find /var/log -type f -size +1m |xargs -i mv {} /tmp/log
find /var/log -type f -size +1m -exec -mv {} /tmp/log
5 If you need to pack and compress all the files in the /home/zheng directory into /tmp/zheng.tar.gz, what are you going to do? What should I do when I need to recover from a compressed package?
tar -zcf /tmp/zheng.tar.gz /home/zheng
tar -xf /tmp/zheng.tar.gz -C /home/zheng
6 ways to solve the forgotten root password
1 Enter single-user mode and change the password
2 Enter rescue mode and change password
Modify the passwd configuration file directly passwd modification
7 The command to detect the route taken by the host to the destination host under Linux is ( traceroute ) .
A ping B route C tracerouteD ifconfig
8 How to view the top 5 processes that consume the most memory resources and write out the command
Top
free -m
9 How to check how much memory a process occupies
[root@zxc ~]# ps aux | grep ssh
root 1477 0.0 0.2 66260 1076 ? Ss Apr08 0:00 /usr/sbin/sshd
root 72692 0.1 0.8 102104 4152 ? Ss 02:56 0:00 sshd: root@pts/0
root 72741 0.0 0.1 103332 840 pts/0 S+ 03:01 0:00 grep --color=auto ssh
[root@zxc ~]#
10 How to view the processes occupying port 8080?
[root @ zxc ~] # ps -ef | grep 8080
root 4056 4039 0 18:42 pts/2 00:00:00 grep 8080
[root@zxc ~]#
How to check the tcp port that the process with pid 100 is listening on
[root @ zxc ~] # ps -ef | awk '{print $ 2}' | grep 100
11 Command to see which process a port belongs to
ps -ef