RAID 0:
将两个或以上相同信号,容量的硬盘组合,磁盘阵列的总容量是多个硬盘的总和,数据依次写
入物理磁盘,理想状态下,硬盘读写性能会翻倍。但只要坏一块磁盘,所有数据都会损坏
优点:速度快
缺点:冗余差
RAID 1:
RAID 1 技术,是将两块以上硬盘绑定,数据写入时,同时写入多个硬盘,因此即使有硬盘故障,也有数据备份。
优点:冗余性好
缺点:浪费资源
[root@vm-main luffty]# cat test.txt
I am oldboy teacher
I teach linux.
#I like python.
My qq is 877348180.
My name is chaoge.
#My website is http://pythonav.cn
[root@vm-main luffty]# cat test.txt | sed '/^$/d' | sed '/^#/d'
I am oldboy teacher
I teach linux.
My qq is 877348180.
My name is chaoge.
[root@vm-main luffty]# sed -e '/^$/d' -e '/^#/d' test.txt
I am oldboy teacher
I teach linux.
My qq is 877348180.
My name is chaoge.
[root@vm-main luffty]# cat test.txt | awk '!/^$/{print $0}'
I am oldboy teacher
I teach linux.
#I like python.
My qq is 877348180.
My name is chaoge.
#My website is http://pythonav.cn
echo "I am oldboy" > /dev/null 2>&1
[root@vm-main luffty]# cp /etc/hosts{,.bak}
[root@vm-main luffty]# ll /etc/ | grep hosts
-rw-r--r--. 1 root root 158 Jun 7 2013 hosts
-rw-r--r--. 1 root root 370 Jun 7 2013 hosts.allow
-rw-r--r-- 1 root root 158 Sep 28 04:26 hosts.bak
-rw-r--r--. 1 root root 460 Jun 7 2013 hosts.deny
[root@vm-main luffty]#
[root@vm-main luffty]# cat test.txt | grep -Ev '(^$|^#)'
I am oldboy teacher
I teach linux.
My qq is 877348180.
My name is chaoge.
[root@vm-main luffty]# cat test.txt | grep -v '^$' | grep -v '^#'
I am oldboy teacher
I teach linux.
My qq is 877348180.
My name is chaoge.
I am oldboy teacher
I teach linux.
I like python.
My qq is 877348180.
My name is chaoge.
My website is http://pythonav.cn
[root@huahua-centos7-aliyun luffy]# cat a.txt | sed 's/[a-z]//g'
I
I .
I .
M 877348180.
M .
M ://.
[root@huahua-centos7-aliyun luffy]# cat a.txt | grep -Eo '[^a-z]'
[root@vm-main luffty]# cat -n chaoge.txt | sed -n '2,5p'
2 I teach linux.
3 I like python.
4 My qq is 877348180.
5 My name is chaoge.
[root@vm-main luffty]# cat chaoge.txt
I am oldboy teacher
I teach linux.
I like python.
My qq is 877348180.
My name is chaoge.
My website is http://pythonav.cn
I like play game
[root@vm-main luffty]# cat chaoge.txt | sed '/game/d'
I am oldboy teacher
I teach linux.
I like python.
My qq is 877348180.
My name is chaoge.
My website is http://pythonav.cn
My name is chaoge.
I teach linux.
I like play computer game.
My qq is 877348180.
My website is http://pythonav.cn.
[root@vm-main luffty]# cat chaoge.txt2 | sed -e 's/My/His/g' -e 's/877348180/8888888/'
His name is chaoge.
I teach linux.
I like play computer game.
His qq is 8888888.
His website is http://pythonav.cn.
[root@vm-main luffty]#
[root@vm-main luffty]# ifconfig ens33 | sed -n '2p' | sed -n 's/^.*inet//p' | sed -n 's/netmask.*$//p'
192.168.58.130
[root@vm-main luffty]# cat /etc/passwd | awk -F ":" '{print $1":"$(NF-1)}'
root:/root
bin:/bin
daemon:/sbin
adm:/var/adm
lp:/var/spool/lpd
sync:/sbin
shutdown:/sbin
halt:/sbin
mail:/var/spool/mail
operator:/root
games:/usr/games
ftp:/var/ftp
nobody:/
systemd-network:/
dbus:/
polkitd:/
postfix:/var/spool/postfix
sshd:/var/empty/sshd
test:/home/test
abrt:/etc/abrt
saslauth:/run/saslauthd
pcp:/var/lib/pcp
mailnull:/var/spool/mqueue
smmsp:/var/spool/mqueue
apache:/usr/share/httpd
tss:/dev/null
mailman:/usr/lib/mailman
[root@vm-main luffty]# cat /etc/passwd | awk -v OFS=":" -F ":" '{print $1,$(NF-1)}'
root:/root
bin:/bin
daemon:/sbin
adm:/var/adm
lp:/var/spool/lpd
sync:/sbin
shutdown:/sbin
halt:/sbin
mail:/var/spool/mail
operator:/root
games:/usr/games
ftp:/var/ftp
nobody:/
systemd-network:/
dbus:/
polkitd:/
postfix:/var/spool/postfix
sshd:/var/empty/sshd
test:/home/test
abrt:/etc/abrt
saslauth:/run/saslauthd
pcp:/var/lib/pcp
mailnull:/var/spool/mqueue
smmsp:/var/spool/mqueue
apache:/usr/share/httpd
tss:/dev/null
mailman:/usr/lib/mailman
[root@vm-main luffty]# ifconfig ens33 | awk 'NR==2 {print $2}'
192.168.58.130
[root@vm-main luffty]# cat /etc/passwd | awk -F ":" '$NF=="/sbin/nologin"{print $1}'
bin
daemon
adm
lp
mail
operator
games
ftp
nobody
systemd-network
dbus
polkitd
postfix
sshd
abrt
saslauth
pcp
mailnull
smmsp
apache
tss
mailman
参与评论
手机查看
返回顶部