Linux face question 002

Source: Internet
Author: User
Tags uuid

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
Ls-l/var/log|grep "^-" |wc-l ls-l/var/log|grep "^-d" |wc-l Statistics folder count
5, view the current system per IP connection number

6.32-bit random password generation under shell
#!/bin/bash
#author: Ligths
Psd= "/proc/sys/kernel/random/uuid"
For PS in $PSD
Do
Echo $ps
Done

Cat/proc/sys/kernel/random/uuid
7, statistics of Apache Access.log in the most visited 5 IP

8. How to view the contents of a binary file
Vim
:%!xxd
Restore:%!xxd-r

9. What does the vsz in PS aux mean? What does RSS represent?

10, Detect and Repair/dev/hda5

11. Linux Boot Sequence
Bios-mbr-kernel-rc.d-kernel MODULE-RC*.D
12. The difference between symbolic links and hard links
ln
Ln-s
Symbolic connections are equivalent to shortcuts
A hard connection is equivalent to a map
13. Save the partition table of the current disk partition
P
15. Install Grub Manually

16, change the kernel parameters

17. Take a random number within 1-39
#!/bin/bash
#author: Ligths
Declare-i number= $RANDOM%39+1
Echo $number
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 to add 20 users in bulk, user name user1-20, password is user followed by 5 random characters
#!/bin/bash
#author: ligths
pd= $RANDOM
If [${# PD} \> 4];then
for ((i=1;i<=20;i++));
Do
Useradd/adduser user$i
passwd user$pd
Done
Else
echo "error"
Fi
24, write a script to achieve judgment 192.168.1.0/ 24 network, the current online IP has what, can ping general think online
#!/bin/bash
#author: Ligths
for ((i=1;i<=254;i++));
Do
Ping-c5 192.168.1. $i
Sleep
Done
25, write a script that determines whether a specified script is a syntax error, or if there is an error, Then remind the user to type Q or Q to ignore the error and exit any other keys to open the specified script via vim;
$? = = 2
Error
26, write a script:
1, create a function, can accept two parameters:
1) The first parameter is a URL, The second parameter is the directory, which is the location saved after download,
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, 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;
#!/bin/bash
#author: ligths
#methods 1
directory=$ 2
url=$1
Function A ()
{
If [!-D "$directory"];
Then

CD $directory
wget $url
Else
echo "Directory not find ISY create? (y/n) "
Read iy
Case $iy in
Y
mkdir $directory
;;
N
Echo 51
;;
Esac
Fi
}
A

#methods 2
Function B ()
{

if [!-D "$"];
Then

CD $
Wget $
Else
echo "Directory not find ISY create? (y/n) "
Read iy
Case $iy in
Y
mkdir
;;
N
Echo 51
;;
Esac
Fi
}

B $

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

Not debugged
#!/bin/bash
#author: Ligths
Fucnction FD ()
{
Fdisk $
echo "The following is making changes to the disk, please careful operation (y/n)"
Read-p $isy
Case $isy in
Y

;;
N

;;
Esac
}

FD $

Linux face question 002

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.