sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
-n 参数
sed -n '1,3d' /etc/fstab 不会输出任何东西,静默模式
2)、删除所有以#号开头的行:
[root@localhost ~]# sed '/^#/d' /etc/fstab
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=2020ea71-49cf-488e-bd6c-de72a001082b /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
3)、删除所有以/ 开头的行:
[root@localhost ~]# sed '/^\//d' /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Feb 24 02:20:51 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=2020ea71-49cf-488e-bd6c-de72a001082b /boot ext4 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
4)、删除从第2行开始,到第一次以“/”开头的行:
[root@localhost ~]# sed '2,/^\//d' /etc/fstab
UUID=2020ea71-49cf-488e-bd6c-de72a001082b /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0