2019-10-31
用户操作练习
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| groupadd -g 3003 distro groupadd linux useradd -u 2002 -g distro -G linux mandriva
useradd -c "Fedora Community" -s /bin/tcsh fedora
usermod -u 4004 -g linux -G distro,fedora mandriva
passwd -n 2 -x 50 fedora
usermod -s /bin/bash mandriva
useradd -r -s /sbin/nologin hbase
useradd -M openstack
|
权限练习
1 2 3 4 5 6 7 8
| cp -r /etc/skel /home/openstack
chown -R openstack.openstack /home/openstack
chmod -R go= /home/openstack
|
统计
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| ls /usr/bin |wc -l
cat /etc/passwd |cut -d: -f7 |sort -u
file /var/log/* file $(ls /var/log)
head -n6 |tail -n1
tail -n9 |head -n1 |cut -d: -f1,7 >/tmp/users
ls -d /etc/pa* |wc -l
printf "alias cls=clear">>~/.bashrc
|
grep/sed/awk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| grep -E '(\<([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\>\.){3}\<([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\>' A: 1-127 B: 128-191 C: 192-223 grep -E '\<[1-9]|1[1-9]{2}|2[01][0-9]|22[0-3]\>(\.\<([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])\>){2}\.\<([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])\>'
sed 's/[[:space:]]+//g' /etc/grub.conf
sed 's@\(id:\)[0-9]\(:initdefault:\)@\15\2@g' /etc/inittab
sed '/^$/d' /etc/inittab
sed 's/^#//g' /etc/inittab
sed -r 's@^#[[:space:]]+@@' /etc/inittab
sed 's/^[[:space:]+#//g' /etc/inittab
echo '/etc/rc.d' |sed -r 's@^(/.*/)[^/]+/?@\1@g' /etc/ echo '/etc/rc.d' |sed -r 's@^/.*/([^/]+)/?@\1@g' rc.d
|
find
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| find /var -user root -a -group mail
find /usr -not \( -user root -o -user bin -o -user student \) find /usr -not -user root -a -not -user bin -not -user student
find /etc -mtime -7 -not \( -user root -o -user student \) find /etc -mtime -7 -not -user root -a -not -user student
find / \( -nouser -o -nogroup \) -a -atime -1 -exec chown root.root {} \;
find /etc -size +1M -exec echo {} >>/tmp/etc.largefiles \; find /etc -size +1M >>/tmp/etc.largefiles
find /etc -size +1M |xargs echo >>/tmp/etc.largefiles
find /etc -not -perm /222 -ls
|
磁盘
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| mke2fs -t ext3 -L MYDATA -b 1024 -m 3 /dev/sda2 blkid tune2fs dumpe2fs fsck / e2fsck
/etc/fstab LABEL='MYDATA' /data ext3 defaults,acl 0 0
mkdir /var/swaptmp dd if=/dev/zero of=/var/swaptmp/swapfile bs=1M count=512 mkswap LABLE=SWAP-FILE /var/swaptmp/swapfile
/var/swaptmp/swapfile swap swap defaults 0 0
|
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
微信支付
支付宝