Problems with Linux

Source: Internet
Author: User
Tags parent directory switch loop

(2017/8/3)
1. Can I delete the files that are occupied by the process?

2. How can I view the files being consumed by the process or by looking at I_count?

3. How do I retrieve files that are not linked to but are occupied by the process?

4. The enterprise produces the soft connection function:
1. When compiling the software, specify the version number (/application/apache2.2.23), you want to remove the version number (/application/appache) when accessing, you can set the soft connection to the compiled path. All Programs access the software files (/application/appache), and when the software is upgraded to a higher version, simply remove the link file to rebuild the soft connection to the high version path (/application/appache)
2. When the Enterprise Code is published (PHP program), it is necessary to upload all the code to a new temporary directory or a new site. Either a MV at the time of publishing or a soft connection can be rebuilt only to think of this new temporary directory or the new site directory.
3. Inconvenient directory move, use Ln-s.

5. Say 20 Linux commands and common parameters?
1.ls
-iinode
2.mkdir-p Continuous creation of directories
3.grep is good at filtering, separating the desired and unwanted areas.
-V matches the opposite character;
-I is case insensitive
-E Extended Regular expression
-N Display Line number
-a2 ' kay ' Print string Kay after two lines
-b2 ' kay ' Print string Kay first two lines
-c2 ' kay ' Print string Kay up and down two lines
Egrep
Similar to GREP-E
4.sed excels at fetching rows, replacing
-N cancels the default output
-I change file contents
Sed-i "s## #g" filename
-R Extended Regular expression
5.awk filter content (Fetch column)
Awk-f "separator symbol" ' {print '} ' filename
$: Whole Line
$: first column;
$NF-1: Last second column;
$NF: the last column;


6. Say 10 important Linux directories and what does it mean?
1./ETC/PASSWD Profile for user information
/etc/shadow encrypted files for user passwords
/etc/
2./etc/profile user global variable permanently active configuration file
3./etc/inittab setting the system-level configuration file at boot
4./etc/init.d/storage System and Server Software Launcher directory installed via Yum or RPM, is a link file (file pointing to/etc/rc.d/init.d/) soft connection
Service sshd Restart = = =/etc/init.d/sshd restart
5./etc/rc.local Boot program command file, (the system boot process will automatically execute the file memory)
6./etc/sysconfig/network-script/ifconfig-eth0 NIC configuration information

7./var/log/message system default log file
8.var/log/secure Logging Login System Information (ftp/ssh/telnet)
DMESG can view information about a system failure

9./proc/cpuinfo Viewing CPU information
/proc/meminfo Viewing memory information
/proc/mounts Viewing mount Information
/PROC/LOADAVG View your system load (System performance)

10./usr/local/default storage directory for software installed through the source package
/usr/src/Store the kernel source directory

7. Enterprise Case:
A lamp server, all files under the site directory are implanted as follows:
<script Language=javascript src=http://www.baidu.com></script> trojan, including picture files are also implanted, the website opens is will call this address, display ads, cause adverse effects.

1.find/kay/shell/-type F|xargs sed-i ' S#<script language=javascript src=http://www.baidu.com></script># #g '
2.find. -type f-exec sed-i '/^.*google_add.*$/d ' {} \:
8. Remove spaces
[email protected] shell]# cat Kay.txt
Hefas

Fdskf

Fdsfsaf

Fdsaffsd
[[email protected] shell]# grep '. ' Kay.txt
Hefas
Fdskf
Fdsfsaf
Fdsaffsd
[Email protected] shell]# grep-v ' ^$ ' kay.txt
Hefas
Fdskf
Fdsfsaf
Fdsaffsd
[[Email protected] shell]# sed '/^$/d ' kay.txt
Hefas
Fdskf
Fdsfsaf
Fdsaffsd
[Email protected] shell]#
9. Unable to add user
[Email protected] ~]# Useradd kay1
Useradd:cannot open/etc/passwd

Method:
[Email protected] ~]# chattr-i/etc/gshadow/etc/group/etc/shadow/etc/passwd
[Email protected] ~]#
[Email protected] ~]# Useradd kay1

10. Enterprise Case:
Prevent Trojan Invasion:
What permissions are given to files and directories, security thresholds:
Directory 755 root root
File 644 root root

11. Problem: You want Kay users to be able to delete files that are not authorized to delete:
1.sudo to Kay authorized RM
2. Set SUID to RM command
3. Set Parent directory Permissions

12. Name 10 Linux Regular expression characters
^
$kay match the character ending with Kay
[A-z]
. Any one character
* Repeat one or more of the preceding characters

13. Delete the first seven days of *.tar.gz in a scheduled task
[Email protected] scripts]# more del_tar.sh
find/kay/-type f-name "*.tar.gz"-mtime +7|xargs rm-f
[Email protected] scripts]#

[Email protected] scripts]# crontab-l
###########
* * * * * */bin/sh/server/scripts/del_tar.sh >/dev/null 2>&1
[Email protected] scripts]#

14.crond Enterprise Face Test

15. Operation:

16. When switching to a normal user, the following is displayed:
[[email protected] scripts]# SU FS
bash-4.1$
bash-4.1$
How to recover???

Recovery:
[Email protected] ~]# cp-a/etc/skel/.bash*/home/fs/
[[email protected] ~]# SU FS
[Email protected] root]$

17. Batch Create 10 user Stu01-stu10, and set a random 8-bit password, the request can not be used shell loop, can only be implemented by command and pipeline.

18.linux root password forgot how to find it back.

19. User access to the site process

20. Network or Service Troubleshooter:
1.ping www.baidu.com
2.traceroute www.baidu.com-n
3.telnet www.baidu.com
Nmap
NC
1. Firewall is not open
2.80 port is not open or not this port
4. Grab kit:
Linux:
TCPDUNP
nmap
Windows:
Wireshark
Sniffer
21. It is known that a port is 333, how to view the port corresponding to what is the service name?
1.lsof-i:333
2.netstat-lntup|grep 333
22. ( Interview questions) a computer on a local area network cannot access the Internet?
A.step1:ping www.baidu.com
If the pass, may be a browser, poisoning and other issues,
if not, Step2;
Step2:ping Gateway (The purpose is to exclude physical links [network cable, network card, driver, IP settings, etc.])
If the ping gateway is not visible, view the IP settings, and then ping localhost or ping the other machine IPs on the LAN.
If ping own IP: Check IP settings, network card driver, network cable, etc.
if you ping the LAN other machine IP, the gateway does not let the network
step3:ping Gateway Pass, check the DNS settings are correct
1. Check the method is: Ping public network IP, see unobstructed situation.
2.host/dig/nslookup Check Domain name resolution
STEP4: Internet router issues (configuration and hardware) and ISP line issues
1. Log in, check the superior line, call the ISP technology.
Step5: Secondary Troubleshooting: Other people can surf the Internet, IP address conflict, ARP virus, core switch bad, switch loop (see log).
B. The idea of a large area of the network:
Other people can surf the Internet, IP address conflict, ARP virus, core switch bad, switch loop (see log).

23. (Interview questions) Open the Site server access slow, not open the troubleshooting?
1. User case, or all.
A.ping Www.kay.com, the expressway has not been repaired.
If the ping is a pass, do not drop the packet. HTTP Service problem (service is down, service is overloaded.) )
If the ping is a pass, drop the packet. The room bandwidth is not stable. Each line is unstable.
If it is not ping, ping www.kay.com, machine room down or server problem
b.tracet-d www.kay.com Check each line between client and server
C.telnet www.kay.com 80 Check if the server Web service is turned on and the firewall is blocked.
Nmap Www.kay.com-p 80
Curl www.kay.com or wget www.kay.com, equivalent to browser access.
D. server servers are overloaded with server and service connections, high load, high CPU, higher IO
E. The bandwidth of the website purchase is full and is viewed through the traffic monitoring service.
G.web Service Issues,
H. Database problems, log in to the database, see if there are slow query statements show proceslist, adjust the MySQL configuration, optimize SQL statements;
I: storage and other issues. is not a storage server, such as NFS,MFS load and disk IO high

24. (Network basis) must have written oral interview
Three handshake and four disconnection process for the 1.TCP/IP protocol
How the 2.http protocol works
3.dns principle Analysis
4.osi seven-layer model
Physical Layer Data Link Layer Network layer Transport Layer Session Layer presentation Layer application layer
5.route How do I add a network route?

25.

Problems with Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.