Linux face question with 10k value

Source: Internet
Author: User

1, Linux Mount Winodws shared folder first to install samba-client  mount command for MOUNT -T CIFS //IP/SHAREDIR  /MNT  -O USERNAME=USER,PASSWORD=PASSWD2, viewing the number of concurrent requests for HTTP and their TCP connection status: Number of requests:  ps aux |grep -c  HTTPD Connection Status: netstat -an |grep  ': 80 ' 3, with tcpdump Sniff 80-port access to see who is highest Tcpdump -nn port  80 4, Statistics/var/log/The number of files find /var/log/ -type f |wc -l 5, View current system per IP connection netstat -n | awk  '/^tcp/ {print $5} ' | awk -f:  ' {print  $1} '  | sort | uniq -c | sort -rn6, shell 32-bit random password generation mkpasswd - l 327, statistics of Apache Access.log in the most visited 5 ipawk  ' {print $1} ' access.log|sort -n |uniq -c  |sort -nr |head -58, how to view the contents of a binary file xxd filename9, what does the vsz in ps aux  mean   RSS represents what   vsz represents the virtual memory allocated for a process, RSS represents the physical memory that the process actually uses 10, detects and repairs/dev/hda5fsck -y /dev/hda511, Linux boot sequence BIOS self-test  - mbr boot  -  addLoad kernel  -  Run init -  system initialization  -  set up terminal  -  login system 12, Symbolic link and hard link difference Symbolic links can link files or directories, But hard links can not link directories, symbolic links can cross the file system across partitions, but hard links can not be, symbolic links is a shortcut, hard links are inode information replication; 13. Save the partition table for the current disk partition dd if=/dev/sda1 of=/ mbr.bak  bs=446 count=115, manually install GRUBGRUN-INSTALL /DEV/SDA16, change the kernel parameters vim  /etc/ SYSCTL.CONF17, take random number within 1-39 echo $[$RANDOM%39]18, limit the number of Apache connections per second is 1, peak is 3# iptables -a input  -d 172.16.100.1 -p tcp --dport 80 -m limit --limit 1/second  --LIMIT-BURST 3 -J ACCEPT19, FTP active and passive mode port (Active) connection process is: the client to the server FTP port (default is 21) Send connection request, the server accepts the connection , create a command link. When the data needs to be transferred, the client tells the server with the port  command on the command link: "I opened the XXXX port and you came over to connect me." The server then sends a connection request from Port 20 to the client's  xxxx port, creating a data link to transmit the data. The      PASV (passive) connection process is: The client sends a connection request to the server's FTP port (by default, 21), the server accepts the connection, and establishes a command link. When the data needs to be transferred, the server tells the client on the command link with the pasv  command: "I opened the XXXX port and you came over to connect me." The client then sends a connection request to the server's XXXX Port   and establishes a data link to transmit the data. As can be seen from the above, the two ways of the command link connection method is the same, and the data link to establish the method is complete   different. 20. Display/etC/inittab begins with # and follows one or more whitespace characters followed by a line;grep -e  "^#\ +.*$" with any non-whitespace character  /etc/inittab grep   "^# \{1,\}[^ ]"  /etc/inittab21, display/etc/inittab contains: A number: (that is, two colons in the middle of a number) of the line;grep  ': [0-9]: '  /etc/inittab22, how to add your own script to the service, 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 23, write a script, Implement bulk Add 20 users, username user1-20, password is user followed by 5 random characters #! /bin/bashfor i in  ' seq 1 20 ';  Do    usern= "user$i"     pas1= ' mkpasswd -s 0 -d 1  -l 5 '    &NBsp;pas2=user$pas1    useradd  $usern     echo -e  "$pas 2\n $pas 2\n " |passwd  $userndone 24, write a script to determine the 192.168.1.0/24 network, the current online IP What, can ping general think online #! /bin/bashfor  i in  ' seq 1 255 ';  do    ip= "192.168.1. $i"      echo  $ip     los_pk= ' ping -c 4  $ip  |grep  ' packet  Loss '  |awk  ' {print $6} '  |cut -d% -f1 '     if [  $los _pk -eq 0 ]; then        echo  "$ip   Online "    else        echo " $ip  not  online "    fidone25, write a script that determines whether a specified script is a syntax error, or if there is an error, The user is prompted to type Q or Q to ignore the error and exit any other key to open the specified script via vim; #! /bin/bashscript_f= "./3.sh" sh -n  $script _f >/ Dev/null 2>/dev/nulln= ' echo $? ' IF [  $n  -ne 0 ]; then    read -p  "The script is  a bad file, tap  "q"  or  "Q"  for quit or tap other  key to edit the file. "  key    if [  $key  ==  ' q '  -o  $key  ==  ' q '   ]    then        exit    else         vim  $script _f    fifi26, 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 the directory, that is, the location of the save after downloading, 2) if the user-given directory does not exist, the user is prompted to create, or if the creation continues to execute, otherwise, the function returns a 51 error value to the If the given directory exists, download the file; The test file download succeeds after the download command is executed; If successful, 0 is returned to the calling script, otherwise, 52 is returned to the calling script; #! /bin/bashfunction download ()  {    url=$1    dir=$2    while :;  do    if [  -d  $dir  ]; then        cd  $dir         wget $ Url        n= ' echo $? '          if [  $n  -eq 0 ]; then             return 0        else             return 52         fi    else        read -p  the  directory is not exist, create or not? y/n " k         if [  $k  ==  ' y '  -o  $k  ==  ' y '  ];  then            mkdir -p  $dir             continue        else             return 51         fi    fi    done}download  http:// www.lishiming.net/1forum.php 12327, 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;    and then empty all partitions on this disk device (prompt, use the command dd if=/dev/zero of=/dev/sdb bs=512  Count=1 implementation, note the device path in which do not write wrong    ; if this step fails, return 67 to the main program;    then create two primary partitions on this disk device, one size of 100M, a size of 1G; If this step fails, return 68 to the main program;    format the 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; #! /bin/bashfunction disk ()  {     read -p  "input the device you want to format. "  dev     read -p  "Waring! it will be format the device  $dev,  and the data on   $dev  will be deleted, are you sure to do this? y/n   " k    while :; do        if  [  $k  ==  ' n '  -o  $k  ==  ' n '  ]; then             exit        elif  [  $k  ==  ' y '  -o  $k  ==  ' y '  ]; then             dd if=/dev/zero of= $dev  bs=512 count=1             n1= ' echo $? '              if [  $n 1 -ne 0 ]; then                 return 67             else                 echo -e  "n\np\n1\n1\n+100m\nn\np\n2\n\n+1g\nw\nquit\n"  |fdisk   $dev                 n2= ' echo $? '                  if [  $n 2 -ne 0 ]; then                     return 68                 else                     mkfs.ext3 /dev/sdb1  && mkfs.ext3 /dev/sdb2                     n3= ' echo $? '                      if [  $n 3 == 0 ]; then                          return 0                     else                         return  69                     fi                 fi   &Nbsp;        fi        else             continue         fi    done}diskn4= ' echo $? ' if [  $n 4 == 67  ]; then    echo  "Delete the partition table error." elif [  $n 4 == 68 ]; then    echo  "Reinstall the  partition table error. " elif [  $n 4 == 69 ]; then    echo  "Format the  Patition error. " else    echo  "the whole opration is successful!" Fi


This article is from the "Linux_config" blog, make sure to keep this source http://jialiang1026.blog.51cto.com/10119067/1632292

Linux face question with 10k value

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.