Search code examples
unixstatusputty

How to show online offline status on Unix via putty


How can i show online offline status of a network ( such as "ftp" ) on Unix via putty ?

for example in solaris , we can type " svcs -a " command and then use "grep" to see the online & offline status of specific services. How can i see these statuses one by one on Unix ?


Solution

  • You can use netstat to see if some port (used by the service) is open or not.

    ubuntu@ip:~/$ netstat -na --inet | grep LISTEN
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
    ubuntu@ip:~/$
    

    Or for FTP:

    netstat -na --inet | grep 21
    

    I'm not sure what exactly does this command "svcs -a" (I did not use Solaris). But perhaps this command could help

    service --status-all
    

    Works on RedHat-like systems (SystemV init style). It shows all services' current status

    [root@dgdevlin bin]# service --status-all
    acpid (pid 3409) is running...
    adlagent (pid  3738) is running...
    anacron is stopped
    atd (pid  3657) is running...
    

    Also, if your linux is Ubuntu(-based) you can use this command

    initctl list
    

    It shows a list of services. For each service it shows configured state - whether the service should running after system is started, and current status of the service - is it running right now.

    ubuntu@ip:~/$ initctl list
    mountall-net stop/waiting
    passwd stop/waiting
    rc stop/waiting
    rsyslog start/running, process 625
    screen-cleanup stop/waiting
    tty4 start/running, process 694
    udev start/running, process 267