打印配置文件
1.nl nginx.conf
2.cat -n nginx.conf <=======这个最常用
3.less -N nginx.conf
4.vi 文件 然后执行:set nu, :set nonu 为取消行号
5.grep -n ./etc/services
开机启动软件设置(设置sshd开机不启动)
第一种方式:
1. chkconfig --list sshd
2. chkconfig --level 245 sshd off
3.操作完执行chkconfig --list sshd 再次查看结果
第二种方式:
1.添加注释
echo "#sshd start by wj at 201709" >> /etc/rc.local 先添加注释
2.echo "/etc/init.d/sshd start" >>/etc/rc.local 将sshd服务启动命令加入到/etc/rc.local文件中,切记使用>>追加不是>
sed -i '/$/d' /etc/rc.local清除最后一行内容
查看文件行数
wc -l /etc/services 查出文件总行数
cat -n /etc/services|tail -1
sed -n '$=' /etc/services
awk '{print NR}' /etc/services|tail -1
grep