用戶、組管理、grep、重定向及文本處理習題

用戶、組管理、grep、重定向及文本處理習題

1

1.w | cut -d’ ‘ -f1 | uniq

2.grep -E “($(w | cut -d’ ‘ -f1 | tail -1))” /etc/passwd

3.cut -d’:’ -f7 /etc/passwd | uniq -c | sort -n | tail -1

4.grep -E “$(cut -d’:’ -f3 /etc/passwd | sort -n | tail -10)” /etc/passwd > /tmp/test1

tr [a-z] [A-Z] < /tmp/test1

5.ifconfig | grep inet | cut -d’:’ -f2 | cut -d ‘ ‘ -f1 | head -1

6./etc/ | grep -E ‘.*.conf\>$’ | tr [a-z] [A-Z] > /tmp/etc.conf

7.ls /var | wc -w

8.sort -t’:’ -k3 -n /etc/group | tail -10 | cut -d’:’ -f1

9.cat /etc/issue /etc/fstab > /tmp/etc.test

10.[root@localhost ~]# groupadd -g 2016 distro
[root@localhost ~]# useradd -u 1005 -g distro mandriva
[root@localhost ~]# useradd -u 1100 -d /home/linux mageia
[root@localhost ~]# echo ‘magedu’ | passwd –stdin mageia
[root@localhost ~]# userdel mandriva
[root@localhost ~]# groupadd peguin
[root@localhost ~]# useradd -u 2002 -g distro -G peguin slackware
[root@localhost ~]# usermod -s /bin/tcsh slackware
[root@localhost ~]# groupadd admins
[root@localhost ~]# usermod -a -G admins slackware

本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/100860

(0)
radixradix
上一篇 2018-06-11
下一篇 2018-06-11

相關推薦

  • 腳本練習題

    1.使用腳本打印出如下圖形 ************答案一:#!/bin/bash#1.接受一個參數為星星的個數。num=$1 #2.求出總共要打印的行數let lines=num*2 #3.for 循環處理每一行的數據for i in `seq $lines`;do#4.前半個星星處理邏輯if [ $i -le $num ];thenfor j in `s…

    Linux筆記 2018-03-26
  • linux 學習6

    1、簡述osi七層模型和TCP/IP五層模型 1、 osi七層模型 1、應用層:OSI 參考模型中最靠近用戶的一層,為計算機用戶提供應用接口,也為用戶直接提供各種網絡服務。我們常見應用層的網絡服務協議有:HTTP,HTTPS,FTP,POP3、SMTP等。 2、表示層:提供各種用于應用層數據的編碼和轉換功能,確保一個主機的應用層發送的數據能被另一個主機的應用…

    Linux筆記 2018-07-28
  • 初識——Linux文件管理

    一:文件系統結構 文件目錄 Linux文件目錄結構是一個倒樹狀結構,從根(/)開始依次往下,根文件系統為rootfs:root filesystem; 文件名稱區分大小寫是由文件系統決定的,CentOS6.x默認文件系統為ext4,CentOS7.x上默認文件系統是xfs; 以點(.)開頭的文件為隱藏文件,文件路徑以(/)分割; 文件有倆類數據:元數據和數據…

    2018-03-31
  • 1

           

    Linux筆記 2018-04-07
  • shell進階函數及數組

    ①函數
    ②數組
    ③字符串切片
    ④變量高級進階
    ⑤expect工具

    Linux筆記 2018-05-12
  • AWK三劍客之一

    筆記

    2018-05-20
欧美性久久久久