标签:linux basics
1. who | cut -d‘‘ -f1 | sort -u
2.cut -d: -f7 /etc/passwd | uniq -c | sort -rn | head -n -1
3.sort -t: -k3 -n /etc/passwd |tail -n -10 | tr‘a-z‘ ‘A-Z‘ > tmp/maxusers.txt
4.ifconfig | head -n -2 | tail -n -1 | cut -d: -f2 | tr -d "Bcast"
5.ls /var/|wc -w
6.sort -t: -k3n /etc/group | head -n -10 | cut -d: -f1
7.cat /etc/fstab /etc/issue > /tmp/etc.test
8.groupadd -g 2016 disto
useradd -u 1005 -g distro mandriva
useradd -u 1100 -d /home/linux mageia
echo "mageedu" | passwd --stdin mageia
userdel mandriva
useradd -u 2002 -g disrto -G peguin slackware
usermod -s /bin/tcsh slackware
usermod -aG admins slackware
passwd -n 3 -x 183 -w 3 slackware
useradd -u 3003 -g clouds -G peguin,nova openstack
useradd -s /sbin/nologin mysal
echo "passwd" | passwd stdin "openstack"
9.cp -r /etc/skel /home
mv /home/skel /home/tuser1
chmod g-r,o-r /home/tuser1
ll -a /home/tuser1 | grep tuser1
chmod g-r,o-r /home/tuwer1/.*
ll -a /home/tuser1
10.cat /etc/passwd | grep -E ^(s|S)
cat /etc/passwd | grep -E -i ^s
cat /etc/passwd | grep -E ^[sS]
cat /etc/passwd | grep -e "^s" -e "^S"
11.cat /etc/passwd | grep -E -v "/bin/nologin$"
12. cat /etc/passwd | grep -E "/bin/nologin$"
13. cat /etc/passwd | grep "\<[0-9]\{2,3\}\>"
14. grep "^#[[:space:]]\+[^[:space:]]" /etc/rc.d/rc.sysinit
15.netstat -tan | grep "LISTEN[[:space:]]*$"
16.useradd bash
useradd testbash
useradd basher
useradd -s /sbin/nologin nologin
# egrep "^([[:alnum:]]+\>).*\1$" /etc/passwd
标签:linux basics
原文地址:http://11683607.blog.51cto.com/11673607/1880159