您的位置:首页 > 运维架构 > Nginx

打印配置文件nginx.conf内容的行号及内容和开机启动软件设置和查看配置文件总行数

2017-09-02 16:10 776 查看
打印配置文件

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: