How to check running services in centos 6 & 7

//to check current configured devices and current running devices

[root@laptop ~]# service --status-all
/etc/sysconfig/network: line 2: HOSTNAME: command not found
netconsole module not loaded
/etc/sysconfig/network: line 2: HOSTNAME: command not found
Configured devices:
lo Boobi_Khan  Redmi
Currently active devices:
lo enp4s0f2 wlp0s26u1u2






//to view currently running services with associate ports

[root@laptop ~]# netstat -antlup
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      892/cupsd          
tcp        0      0 192.168.43.192:51732    216.58.197.78:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:51700    216.58.197.78:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:52040    216.58.199.131:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:49322    54.69.152.122:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:35340    172.217.26.201:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:49324    54.69.152.122:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:41842    172.217.160.132:443     ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:49130    172.217.166.99:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:51720    216.58.197.78:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:54288    23.46.187.170:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:35738    216.58.196.163:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:49898    172.217.163.194:443     ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:41176    172.217.163.35:80       TIME_WAIT   -                  
tcp        0      0 192.168.43.192:41174    172.217.163.35:80       TIME_WAIT   -                  
tcp        0      0 192.168.43.192:49912    172.217.163.194:443     ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:60672    216.58.196.170:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:44098    216.58.197.65:443       ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:35308    216.58.200.142:443      ESTABLISHED 2224/firefox       
tcp        0      0 192.168.43.192:57026    216.58.197.52:443       ESTABLISHED 2224/firefox       
tcp6       0      0 ::1:631                 :::*                    LISTEN      892/cupsd          
udp        0      0 127.0.0.1:323           0.0.0.0:*                           886/chronyd        
udp        0      0 0.0.0.0:40847           0.0.0.0:*                           776/avahi-daemon: r
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1030/dhclient      
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           776/avahi-daemon: r
udp6       0      0 ::1:323                 :::*                                886/chronyd        

//to know centos 6 enabled services

[root@laptop ~]# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

livesys            0:off    1:off    2:off    3:on    4:on    5:on    6:off
livesys-late       0:off    1:off    2:off    3:on    4:on    5:on    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
network            0:off    1:off    2:off    3:off    4:off    5:off    6:off

//centos7

#systemctl enable .service
#systemctl disable .service

[root@laptop ~]# systemctl list-units
//it will show all the systemctl units and services

[root@laptop ~]# systemctl

[root@laptop ~]# systemctl | grep ssh

[root@laptop ~]# systemctl list-unit-files
proc-sys-fs-binfmt_misc.mount                 static 
sys-fs-fuse-connections.mount                 static 
sys-kernel-config.mount                       static 
sys-kernel-debug.mount                        static 
tmp.mount                                     enabled
var-lib-nfs-rpc_pipefs.mount                  static 
brandbot.path                                 enabled
cups.path                                     enabled
systemd-ask-password-console.path             static 
systemd-ask-password-plymouth.path            static 
systemd-ask-password-wall.path                static 
session-1.scope                               static 
session-8.scope                               static 
abrt-ccpp.service                             enabled
abrt-oops.service                             enabled
abrt-pstoreoops.service                       disabled
abrt-vmcore.service                           enabled
abrt-xorg.service                             enabled
abrtd.service                                 enabled
accounts-daemon.service                       enabled
alsa-restore.service                          static 
alsa-state.service                            static 
anaconda-direct.service                       static 
anaconda-nm-config.service                    static 
anaconda-noshell.service                      static 
anaconda-pre.service                          static 
anaconda-shell@.service                       static 
anaconda-sshd.service                         static 
anaconda-tmux@.service                        static 

//it will displays all the server status


[root@laptop ~]# systemd-cgtop

//it will display the running process with associate cpu allocation details

Path                                                                                                           Tasks   %CPU   Memory  Input/s Output/s

/                                                                                                                219   39.4     1.4G        -        -
/system.slice/ModemManager.service                                                                                 1      -        -        -        -
/system.slice/NetworkManager.service                                                                               2      -        -        -        -
/system.slice/abrt-oops.service                                                                                    1      -        -        -        -
/system.slice/abrt-xorg.service                                                                                    1      -        -        -        -
/system.slice/abrtd.service                                                                                        1      -        -        -        -
/system.slice/accounts-daemon.service                                                                              1      -        -        -        -
/system.slice/alsa-state.service                                                                                   1      -        -        -        -
/system.slice/atd.service                                                                                          1      -        -        -        -
/system.slice/auditd.service                                                                                       3      -        -        -        -
/system.slice/avahi-daemon.service                                                                                 2      -        -        -        -
/system.slice/bolt.service                                                                                         1      -        -        -        -
/system.slice/chronyd.service                                                                                      1      -        -        -        -
/system.slice/colord.service                                                                                       1      -        -        -        -
/system.slice/crond.service                                                                                        1      -        -        -        -
/system.slice/cups.service                                                                                         1      -        -        -        -
/system.slice/dbus.service                                                                                         1      -        -        -        -
/system.slice/fwupd.service                                                                                        1      -        -        -        -
/system.slice/gdm.service                                                                                          2      -        -        -        -
/system.slice/gssproxy.service                                                                                     1      -        -        -        -
/system.slice/irqbalance.service                                                                                   1      -        -        -        -
/system.slice/libstoragemgmt.service                                                                               1      -        -        -        -
/system.slice/lvm2-lvmetad.service                                                                                 1      -        -        -        -
/system.slice/packagekit.service                                                                                   1      -        -        -        -
/system.slice/polkit.service                                                                                       1      -        -        -        -
/system.slice/rngd.service                                                                                         1      -        -        -        -
/system.slice/rtkit-daemon.service                                                                                 1      -        -        -        -
/system.slice/smartd.service                                                                                       1      -        -        -        -
/system.slice/systemd-journald.service                                                                             1      -        -        -        -
/system.slice/systemd-logind.service                                                                               1      -        -        -        -
/system.slice/systemd-udevd.service                                                                                1      -        -        -        -

//for check any program running in background

#ps -ef

#ps -aux

#ps -ef | grep -i sh
//it will show if any script are running in backgrond

//check any scheculed job running in background

#crontab -l



Post a Comment

0 Comments