first, the Origin
2012, it's been a bad year. Lost his job and stayed at home for 4 months before finding a job until 2013. 4 months, said not long, said short is not short, the complex, the mood is difficult to calm.
2012, the IT industry outlook is not very good, very cold year, CV cast a lot, interview but very few. Of course not a no, which interviewed a lot of companies, because of various reasons have been no work, during the accumulation of a lot of interview topics, to share with you, I hope to help everyone. Some of the topics are the original title, some are adapted by me, there are some people think that a good topic.
second, the topic
1. Linux Mount Winodws shared folder
2. View the number of concurrent requests for HTTP and their TCP connection status:
3, with tcpdump sniffing 80 port access to see who the highest
4, Statistics/var/log/the number of files
5, view the current system per IP connection number
6.32-bit random password generation under shell
7, statistics of Apache Access.log in the most visited 5 IP
8. How to view the contents of a binary file
9. What does the vsz in PS aux mean? What does RSS represent?
10, Detect and Repair/dev/hda5
11. Linux Boot Sequence
12. The difference between symbolic links and hard links
13. Save the partition table of the current disk partition
15. Install Grub Manually
16, change the kernel parameters
17. Take a random number within 1-39
18. Limit the number of Apache connections per second to 1 and a peak of 3
19. FTP Active and Passive mode
20, display/etc/inittab in the beginning of #, and followed by one or more white space characters, followed by any non-whitespace character line;
21, display/etc/inittab contains: A number: (that is, two colons in the middle of a number) line;
22, how to add their own script to the service inside, that is, you can use the service command to invoke
23, write a script, realize the bulk add 20 users, the user name is user1-20, password is user followed by 5 random characters
24, write a script to achieve the Judgment 192.168.1.0/24 Network, the current online IP What, can ping general think online
25, write a script to determine whether a specified script is a syntax error, if there is an error, then remind the user to type Q or Q ignore the error and quit any other key can open the specified script through vim;
26. Write a script:
1, create a function, can accept two parameters:
1) The first parameter is a URL, you can download the file, the second parameter is a directory, that is, the location of the download after the save;
2) If the user-given directory does not exist, the user is prompted to create it, or if it is created, the function returns a 51 error value to the calling script;
3) If the given directory exists, then download the file; Download command after the execution of the test file download success or not; If successful, return 0 to the calling script, otherwise, return 52 to the calling script;
27. Write a script:
1, create a function, you can accept a disk device path (such as/DEV/SDB) as a parameter, before actually starting the next step to remind the user of the danger, and let the user choose whether to continue;
Then empty all partitions on this disk device (prompt, using the command dd If=/dev/zero of=/dev/sdb bs=512 count=1 Implementation, note that the device path is not written incorrectly
If this step fails, return 67 to the main program;
Then create two primary partitions on this disk device, a size of 100M, a size of 1G, and if this step fails, return 68 to the main program;
Format this two partitions, the file system type is ext3; If this step fails, return 69 to the main program;
If the above procedure is normal, return 0 to the main program;
2, call this function, and by receiving function execution of the return value to determine its execution, and display the information;
Third, reward
welcome everyone to actively discuss, the coin is indispensable. This topic is difficult, so if do not, also do not lose heart, if really can all fix, can say your foundation is very solid, in Shanghai 10K is indispensable. Also welcome everyone Baidu Google, with some tools to complete. The reply can be below.
----==========*************** Answer announcement*************** ==========----
# 2013-04-28 Add--==== by gm100861
answers to 1-17 questions
The following needs to be answered to see
1. Linux Mount Winodws shared folder
# mount-t CIFS//1.1.1.254/ok/var/tmp/share/-o username=administrator,password=yourpass
2. View the number of concurrent requests for HTTP and their TCP connection status:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
3. Sniff 80-port access with tcpdump to see who is the tallest
Tcpdump-i ETH0-TNN DST Port 80-c 1000 | Awk-f "." ' {print $ '. $ "." $ "." $4} ' | Sort | uniq-c | Sort-nr |head-20
4. Count the number of files in the specified directory
Find/-type F | Wc-l
5. View the number of IP connections
Netstat-n | awk '/^tcp/{print $} ' | Awk-f: ' {print $} ' | Sort | uniq-c | Sort-rn
6. "32-bit random password generation under shell"
tr-dc \~\ ' \[email protected]#\$\%\^\&\*\ (\) \-\_\+\=\|\\\?\/\.\>\,\<a-za-z0-9_ </dev/urandom|head -C 32|xargs
7, statistics of Apache Access.log in the most visited 5 IP
Cat Access_log_2011_06_26.log |awk ' {print $} ' |uniq-c|sort-rn |head-n 5
8. How to view the contents of a binary file
[Email protected] ~]# ECHO/ETC/PASSWD | Hexdump-c (Canonical hex+ascii Display) with 16 and ASCII codes for the <== specification
9. What does the vsz in PS aux mean? What does RSS represent?
Aux
A displays all terminal-related processes, initiated by the terminal.
X shows all processes unrelated to the terminal.
U displays a user-directed list of users.
VSZ virtual memory set, process-occupied virtual memory space
RSS physical memory set, process warfare with actual physical memory space.
S interruptible Sleep State
R Run State
D non-disruptive sleep state
T Stop State
Z Zombie State
10, Detect and Repair/dev/hda5
E2fsck-p/dev/hda5
11. Linux Boot Sequence
Boot order:
POST (Power-on self-test)--Boot device sequence-->MBR (bootloader)--unzip kernel, load kernel to memory and load init process (/etc/inittab)
12. The difference between symbolic links and hard links
Hard links: Files of different paths specify the same inode
Hard links cannot exist across partitions
Hard links cannot be linked to directories (to avoid circular references)
Deleting a hard link only reduces the number of times the file is hard-linked, and the source file does not move.
Soft Link: is a separate file that has its own independent inode
Refers to the path itself, not the inode
Delete soft links, not related to source files
A soft link does not store any data, just another path that stores access to the file.
Soft links can be created on a directory or across partitions
The source file is deleted and the soft connection will not be available.
13. Save the partition table of the current disk partition
# sfdisk-d/dev/sdb >/etc/sdbpar.bak Save partition Table
# SFDISK/DEV/SDB
14, detect and automatically repair the file system
E2fsck-check a Linux ext2/ext3 file system
-B Specify block size
-F Force Detection.
-P Automatic Repair file system
15. Install Grub Manually
Install grub Manually
# grub-install--root-directory= (Specify boot directory) DEVICE
Or
Grub
Grub>root (hd0,0)
Grub>setup (hd0)
16, change the kernel parameters
# Sysctl
-P Do not restart the system, let the kernel reread/etc/sysctl.conf files
-a displays all kernel parameters and the values they are using.
-W Temporary set/etc/sysctl.conf parameter sysctl-w net.ipv4.ip_froward=0
17. Take random numbers within the specified range
Take random in a specified range
echo $[$RANDOM%39] to the 39, the remainder must be 39 or less of the number.
2013-04-29 Add by gm100861
answers to 18-22 questions
The following needs to be answered to see
18. Limit the number of Apache connections per second to 1 and a peak of 3
# iptables-a input-d 172.16.100.1-p tcp--dport 80-m limit--limit 1/second--limit-burst 3-j ACCEPT
19. FTP Active and Passive mode
Active mode
1. Any port greater than 1024 to the 21 port of the FTP server. (client-initiated connection)
2. The FTP server is 21 ports to a port greater than 1024. (server responds to client's control port)
3. The FTP server is 20 ports to a port greater than 1024. (Server-side initialization data is connected to the client's data port)
4.20 ports greater than 1024 ports to the FTP server (the client sends an ACK response to the server's data port)
Passive mode
1. From any port greater than 1024 to server 21 port (client initiated connection)
2.21 Port of the server to any port greater than 1024 (the server responds to the connection to the client's control port)
3. From any port greater than 1024 to the server (client-initiated data connection to any ports specified by the server)
4. Server greater than 1024 port to remote port greater than 1024 (the server sends ACK response and data to the client's data port)
Client and the server to establish a connection, after the TCP three handshake, the connection is established, the client can be established through the connection channel to send commands to the servers, the server according to the client's command,
When sending data to the client, the server will then establish a TCP connection with the client for the purpose of transmitting the data, and the connection is the data connection.
Data connection has two modes of operation: Active mode and passive mode
Active mode means that the server is active
Passive mode means that the server is passive.
Active mode:
The server side automatically opens Port 20th, which is the data transfer port. Actively go to the port that connects the client's command port +1. The data connection is automatically disconnected when the transfer is complete.
Passive mode:
The server-side notifies the client of its open port, notifies the client to connect to its own data port, and the client uses the port of command port +1 to connect to the server-side data port.
In passive mode, the server's data connection port uses a random port. The active mode server is using port 20.
20, display/etc/inittab in the beginning of #, and followed by one or more white space characters, followed by any non-whitespace character line;
# grep "^\#[[:space:]]\{1,\}.\{1,\}"/etc/inittab
21, display/etc/inittab contains: A number: (that is, two colons in the middle of a number) line;
# grep "\:[0-9]\{1\}\:"/etc/inittab
22, how to add their own script to the service inside, that is, you can use the service command to invoke
#!/bin/bash
# Chkconfig:-90 10
# Description:just a test
echo "Hello,$1"
# MV Test/etc/init.d/
# chmod +x/etc/init.d/test
# chkconfig--add Test
# Service Test start//Can see Hello,start indicates success
23-24 Script Answers
2013-05-24 Add by gm100861
The following needs to be answered to see
23, write a script, realize the bulk add 20 users, the user name is user1-20, password is user followed by 5 random characters
#!/bin/bash
For i in {1..20}; Do
pass=$ (tr-dc \~\ ' \[email protected]#\$\%\^\&\*\ (\) \-\_\+\=\|\\\?\/\.\>\,\<a-za-z0-9_ <= "" dev= "" Urandom|head= ""-c= "" 5)
Useradd User${i}
echo $pass | passwd User${i}--stdin
echo "User${i} <=============> $pass" >>./userlist.out
Done
Echo ' sucess,passwd is in Userlist.out '
24, write a script to achieve the Judgment 192.168.1.0/24 Network, the current online IP What, can ping general think online
#!/bin/bash
Ips= "192.168.1."
For i in {1..254}; Do
Ping-w 1-c 1 ${ips}${i} &>/dev/null && echo "${ips}${i} is up" | Tee-a Uplog | | echo "${ips}${i} is down"
Done
echo "Please read Uplog-know which host is online."
Linux Most handsome moderator experienced the face of the question, all the correct monthly salary 10k+ ...