How can I find what processes are running on my Linode?
I would like to run some queries on my database, but the Linode Dashboard doesn’t seem to have much database related information at all. How can I tell which database I’m using? Or for that matter, how can I find out what's installed and what's running right now?
1 Reply
The first thing to note here, the dashboard of a Linode will not reflect that Linode's internal configuration.
To use an example, you have two Linodes in the US Central datacenter. They are both using Ubuntu and are on the 2GB plan. Linode A is using Apache, and Linode B is using Nginx. From the Dashboard they will look essentially identical, save for their labels and IP Addresses. This is because, as an infrastructure provider we don’t really have any information on the internal configuration of your server to add to that dashboard page.
So if you want to find out what database is running on your Linode you’re going to have to go under the hood. Just for ease of access I would recommend using the Lish Console. If you’re familiar with SSH that’s another great option.
Once you are logged into the Linode itself you can get a sense of what processes are running right now by entering the following command.
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
This will show the top active processes sorted by how much Memory and CPU they are using. A running database is likely to appear in that list. If you are looking for a particular database that you think is running you can grep for it. That command would look something like this.
ps -aux | grep mysql
You can also try the whereis
command. This one is pretty straightforward, and has the advantage of showing you the various directories that something is in. So if you wanted to find MySQL you could run.
whereis mysql
Here is an example of that command from one of my Linodes, just so you can see how it will look formatted.
$ whereis python3.7
python3: /usr/bin/python3.6 /usr/bin/python3 /usr/bin/python3.6m /usr/lib/python3.6 /usr/lib/python3 /usr/lib/python3.7 /etc/python3.6 /etc/python3 /usr/local/lib/python3.6 /usr/share/python3 /usr/share/man/man1/python3.1.gz
Once you know what database is on your Linode I would suggest taking a look at our database guides and those will help you get started.
One of the cool things about Linux is there are a lot of ways to accomplish the same task. What’s your favorite way to find a process from the command line?