Linux Shell脚本攻略 -- 命令之乐
cat
cat -s // remove null line
cat -T // display Tab as ^I
cat -n // display line number
script,scriptreplay
script -t 2>timing.log -a output.session // start record
execute some commands
exit
scriptreplay timing.log output.session // replay
find
# find命令工作方式:沿着文件层次结构向下遍历,匹配符合条件的文件,执行相应的操作。默认操作是打印出文件和目录名,即-print选项。
# 可以通过-exec指定你要执行...
Linux Shell脚本攻略 -- 小试牛刀
echo
# 不换行
bogon:_posts liliang$ echo -n hello
hellobogon:_posts liliang$
# 支持转义字符
bogon:_posts liliang$
bogon:_posts liliang$ echo -e "1\t2\t"
1 2
# 打印彩色输出
bogon:_posts liliang$ echo -e "\e[1;31m This is a red text \e[0m"
\e[1;31m This is a red text \e[0m
#\e[1;31是代表红色的转义字符,\e[0m代表重置。
#对于文本颜色:重置=0,黑色=30,红色=31,绿色=32,黄色=33,蓝色=34,洋红=35,青色=36,白...
PXE
PXE is “Preboot eXecution Environment”.
To construct PXE, you need construct tftp-server dhcp-server first.
If you have no bare metal system, you can use virt-install to install a vm through pxe, and you don’t need a dhcp server if do this.
# install tftp,dhcp,syslinux
yum install -y tftp-server dhcp-server syslinux
# setup dhcp-server
# if ...
Dracut
问题
Linux启动过程中,kernel先被加载到内存中,然后再挂载根文件系统(硬盘),挂载根文件系统就需要用到该文件系统的驱动。
我们知道Linux采用模块化的设计,大部分模块都是被安装到根文件系统上的,当需要使用它们的时候才被加载到内存当中,这样可以避免kernel过于庞大。那么既然内存中的kernel中并不包含根文件系统的驱动(模块),如何挂载它呢?
Linux系统可以被安装到各种设备上,比如硬盘(不通厂家的硬盘驱动也不同),NFS,LVM,RAID volume等等。如果把所有根文件系统的驱动都放到kernel中,那么Kernel势必会很大。
Initramfs
initramfs就是一个临时的根文件系统,创建initramfs的时候,可以把当前主机的真实根文件...
MarkDown Styles
This is a success alert.
This is a info alert.
This is a warning alert.
This is a error alert.
This is a success tag.
This is a info tag.
This is a warning tag.
This is a error tag.
graph TB;
A[Do you happy?]
B[Because you are lazy?]
C[It's good.]
D[So you should keep industrious.]
E[Keep relax.]
A--no-->B;
...
共计 109 篇文章,14 页。