Marco 2016 new Linux+python high-end operation third week homework answer

Source: Internet
Author: User
Tags echo command

                      Marco 2016 new Linux+python high-end OPS third week assignment                                           1, lists the user names of all logged-in users on the current system, note that the same user logs on multiple times, only once.     [[email protected] ~]# who | awk  ' {print $1 $ NF} ' | uniq -d    [[email protected] ~]# who     yicx     :0            2016-08-22 20:27  (: 0)     root     pts/0         2016-08-22 20:27  (192.168.102.149) 2, remove information about the user who last logged in to the current system.     [[email protected] ~]# lastlog | grep -v  "Never"      user name              Ports       from                Last Login Time     root              pts/1                       a  8 month  22 20:21:58 +0800 2016    yicx              pts/2                       a  8 month  22 20:21:40 +0800  20163, remove the shell that is the user's default shell on the current system.     [[email protected] ~]# cut -d: -f7 /etc/passwd | uniq -c | sort -n -u -r -k1 | head -1 |      awk  ' {print  $NF} '     /sbin/nologin         [[email protected] ~]# cut -d: -f7 /etc/passwd  | uniq -c | sort -n -u -r -k1 | head -1      35 /sbin/nologin    [[email protected] ~]# 4, will The third field in/etc/passw d  has the largest number of the 10 user's information changed to uppercase and saved to the/tmp/maxusers.txt file.     [[email protected] ~]# sort -t: -k3 -n /etc/passwd  |tail -10 > /tmp/maxusers.txt    [[email protected] ~]#  cat /tmp/maxusers.txt    libstoragemgmt:x:992:990:daemon account for  libstoragemgmt:/var/run/lsm:/sbin/nologin  &nBsp; saslauth:x:993:76:saslauthd user:/run/saslauthd:/sbin/nologin    geoclue:x : 994:991:user for geoclue:/var/lib/geoclue:/sbin/nologin    colord:x:995:993: user for colord:/var/lib/colord:/sbin/nologin    unbound:x:996:994:unbound  dns resolver:/etc/unbound:/sbin/nologin    polkitd:x:997:996:user for  Polkitd:/:/sbin/nologin    systemd-network:x:998:997:systemd network management :/:/sbin/nologin    systemd-bus-proxy:x:999:998:systemd bus proxy:/:/sbin/ Nologin    yicx:x:1000:1000:yicx:/home/yicx:/bin/bash    nfsnobody:x : 65534:65534:anonymous nfs user:/var/lib/nfs:/sbin/nologin5, take out the IP address of the current host, and tip: Slice the results of the ifconfig command.     [[email protected] ~]# ifconfig| grep  ' inet '           inet 192.168.102.183  netmask 255.255.255.0  broadcast 192.168.102.255         inet6 fe80::20c:29ff:fe36:e77f  prefixlen  64  scopeid 0x20<link>        inet 127.0.0.1   netmask 255.0.0.0        inet6 ::1   prefixlen 128  scopeid 0x10


Marco 2016 new Linux+python high-end operation third week homework answer

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.