LINUX03_磁盘情况查询、ps -ef、centos7查看服务、netstat查看网络、grep、重定向、管道、yum、用户权限(三)

简介: LINUX03_磁盘情况查询、ps -ef、centos7查看服务、netstat查看网络、grep、重定向、管道、yum、用户权限(三)

④. centos7服务查看


  • ①. 有方便统一的管理方式(常用的方法)


systemctl start 服务名(xxxx.service)
systemctl restart 服务名(xxxx.service)
systemctl stop 服务名(xxxx.service)
systemctl reload 服务名(xxxx.service)
systemctl status 服务名(xxxx.service)


  • ②. 查看服务的方法 /usr/lib/systemd/system


  • ③. 查看服务的命令
    systemctl list-unit-files
    systemctl --type service


# 关闭防火墙
[root@TANG2021 opt]# systemctl list-unit-files | grep firewalld
firewalld.service                             enabled 
[root@TANG2021 opt]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
[root@TANG2021 opt]# systemctl list-unit-files | grep firewalld
firewalld.service                             disabled
[root@TANG2021 opt]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
7月 23 15:58:07 TANG2021.ybc systemd[1]: Starting firewalld - dynamic firewall daemon...
7月 23 15:58:07 TANG2021.ybc systemd[1]: Started firewalld - dynamic firewall daemon.
7月 23 17:06:20 TANG2021.ybc systemd[1]: Stopping firewalld - dynamic firewall daemon...
7月 23 17:06:21 TANG2021.ybc systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@TANG2021 opt]# 


  #systemctl stop | start | status firewalld # 临时 (关闭|开启|状态) 防火墙
  #systemctl disable firewalld # 禁止开机启动


⑤. netstat 查看系统的网络情况


⑤. netstat:查看系统的网络情况(netstat –anp|grep 8080 查看占用8080端口的进程)


-an 按一定顺序排列输出


-p 显示哪个进程在调用


⑥. grep命令


  • ①. 查找文件里符合条件的字符串
    用法:grep [选项]… PATTERN[FILE]…


grep lang anacondaks.cfg 在文件中查找lang
grep lang anacondaks.cfg --color 高亮显示


②. 高亮显示(grep debug yum.conf --color)


③. 这里是往后再显示5个(grep debug yum.conf --color -A5)


④. 这里后面显示5个,往前显示5个(grep debug yum.conf --color -A5 -B5)


⑦. 重定向输出>和>>


  • 重定向输出,覆盖原有内容; >>重定向输出,有追加功能


cat /etc/passwd > a.txt  将输出定向到a.txt
cat /etc/passwd >> a.txt 输出并且追加
ifconfig > ifconfig.txt
相关文章
|
监控 Linux 应用服务中间件
探索Linux中的`ps`命令:进程监控与分析的利器
探索Linux中的`ps`命令:进程监控与分析的利器
506 13
|
运维 监控 网络协议
|
Linux 数据安全/隐私保护
Linux中用户权限问题
【10月更文挑战第4天】
218 1
|
监控 Linux
性能分析之 Linux 系统中 ps&top 中 CPU 百分比不一致?
【8月更文挑战第18天】性能分析之 Linux 系统中 ps&top 中 CPU 百分比不一致?
638 5
在Linux中,ps aux 中的 VSZ 代表什么意思?RSS 代表什么意思?
在Linux中,ps aux 中的 VSZ 代表什么意思?RSS 代表什么意思?
成功解决:CentOS7中无法连接网络
这篇文章介绍了如何解决CentOS 7虚拟机无法连接网络的问题。作者猜测问题可能是由于虚拟机软件的网关和CentOS 7系统的网关不一致导致的。文章提供了两种解决方案:修改虚拟网络编辑器的网关或修改CentOS系统的网关和IP地址。作者选择了后者,并演示了如何在CentOS终端中以root用户身份修改IP和网关。
成功解决:CentOS7中无法连接网络
|
运维 算法 Java
开发与运维命令问题之ss命令和netstat命令区别如何解决
开发与运维命令问题之ss命令和netstat命令区别如何解决
158 4
|
缓存 NoSQL Redis
redis管道操作(节省网络IO开销)
pipeline中发送的每个command都会被server立即执行,如果执行失败,将会在此后的响应中得到信息;也就是pipeline并不是表达“所有command都一起成功”的语义,管道中前面命令失败,后面命令不会有影响,继续执行。
225 1
|
安全 Linux 数据安全/隐私保护
在Linux中,如何管理用户权限?
在Linux中,如何管理用户权限?