The fourth week of operation (Update ...)

The fourth week Homework Solutions

  1. Statistics of the / etc / passwd file shell non-default number of users / sbin / nologin, and users are displayed;
    grep -v '/sbin/nologin' /etc/passwd|egrep -o '^\<[[:alnum:]]+\>'
    !?|wc -l
  2. Identify the user name of the user maximum UID, UID and shell type;
    sort -nrk3 -t':' /etc/passwd|head -1|cut -d':' -f1,3,7
  3. Statistics currently connected connections per remote host IP of the machine, press descending order;
    netstat -nt|egrep '\<[0-9]{1,3}\.'|tr -s ' ' ':'|cut -d':' -f4|sort|uniq -c|sort -nr
  4. Scripting createuser.sh, achieve the following functions: using a user name as a parameter, if the user specifies parameters exists to show its presence, or add it, add the user to display information such as the id;
    待解答
  5. Write basic scripts to generate script formats, including the author, contact information, version, time, and description;
    待解答
  6. What description GPT is how you should use;
    待解答
  7. Create a 10G partition, and format for the ext4 file system. Claim:
    1. block size of 2048, 20% reserve space, the volume label MYDATA;
    2. Mount to / mydata directory, to ban the program to run automatically when the mount, and does not update the file access time stamps;
    3. Bootable automatically mount;
      待解答
  8. Creating a swap partition size for the 1G and enable;
    待解答
  9. Calculation scripting / etc / passwd file 10 and the user 20 and the user id number;
    echo "cat -n /etc/passwd|egrep '^[[:blank:]]+(10|20)'|tr -s ' ' ':'|cut -d':' -f4|paste -sd '+'|bc" > /data/c12.sh
    chmod +x !$
    !$
  10. Save the current hostname to the hostname variable, if the host name is blank, or as localhost.localdomain, then set linux.com;
    待解答
  11. Scripting, the command line parameters into a user name, ID number are determined even or odd;
    待解答
  12. lvm basic applications and extend down to achieve.
    待解答

Guess you like

Origin blog.51cto.com/12541364/2470989