In Windows:
If you have a service that is not responding or showing pending in Windows services that you are unable to stop, use the following directions to force the service to stop.
- Click the Start menu
- Click Run or in the search bar type services.msc
- Press Enter
- Look for the service and check the Properties and identify its service name
- Once found, open a command prompt. Type sc queryex [servicename].
- Press Enter
- Identify the PID
- In the same command prompt type taskkill /pid [pid number] /f
- Press Enter
In Linux (Ubuntu for example)
1. Open the System Monitor app. In the Processes tab, scroll down the list until you find the unresponsive app.
2. Right click on it and select “Kill Process”.
Once confirmed, this will kill the unresponsive application.
Via Command line:
Open terminal
Enter the command to show currently running services. Type ls /etc/init.d into Terminal and press ↵ Enter. This will bring up a list of currently running services and their corresponding command names.
If this command doesn’t work, try ls /etc/rc.d/ instead.
Find the command name of the service that you want to restart. You’ll typically find the name of the service (e.g., "Apache") on the left side of the screen, while the command name (e.g., "httpd" or "apache2", depending on your Linux distribution) will appear on the right side.
Enter the restart command. Type sudo systemctl restart service into Terminal, making sure to replace the service part of the command with the command name of the service, and press ↵ Enter.
For example, to restart Apache on Ubuntu Linux, you would type sudo systemctl restart apache2 into Terminal.
Enter your password when prompted. Type in the password that you use for your superuser account, then press ↵ Enter. This should restart the process.
If the service doesn’t restart after doing this, try typing in sudo systemctl stop service, pressing ↵ Enter, and then entering sudo systemctl start service.
To list running services in the command line:
Use this command:
service –status-all
Here’s an example of what this looks like on an Ubuntu 16.04.2 LTS system:
root> service –status-all Example:
[ + ] apache-htcacheclean
[ + ] apache2
[ + ] apparmor
[ – ] bootmisc.sh
[ – ] checkfs.sh
[ – ] checkroot-bootclean.sh
[ – ] checkroot.sh
[ + ] console-setup
[ + ] cron
[ + ] dbus
[ – ] hostname.sh
[ – ] hwclock.sh
[ + ] irqbalance
[ + ] keyboard-setup
[ – ] killprocs
[ + ] kmod
[ – ] mountall-bootclean.sh
[ – ] mountall.sh
[ – ] mountdevsubfs.sh
[ – ] mountkernfs.sh
[ – ] mountnfs-bootclean.sh
[ – ] mountnfs.sh
[ + ] mysql
[ + ] networking
[ + ] nginx
[ + ] ondemand
[ – ] plymouth
[ – ] plymouth-log
[ + ] procps
[ + ] rc.local
[ + ] resolvconf
[ – ] rsync
[ + ] rsyslog
[ – ] sendsigs
[ + ] ssh
[ + ] sysstat
[ + ] udev
[ + ] ufw
[ – ] umountfs
[ – ] umountnfs.sh
[ – ] umountroot
[ + ] urandom
[ – ] uuidd
The meaning of the Ubuntu service command output
From the Ubuntu Linux service man page:
service –status-all runs all init scripts, in alphabetical order, with the status command. The status is:
[ + ] for running services
[ – ] for stopped services
[ ? ] for services without a ‘status’ command
This option only calls status for sysvinit jobs; upstart jobs can be queried in a similar manner with initctl list.
Some services are managed by Upstart. You can check the status of all Upstart services with sudo initctl list. Any service managed by Upstart will also show in the list provided by service –status-all but will be marked with a ?
[Note: Running with/without sudo can make a difference.
Some services in /var/run/ have read access only to root user. Those services show status [-] without sudo, and [+] with sudo.]