I ran the command to show the status of rsyslog
service. but I don't know the executable path

- 4,756
2 Answers
I am assuming the command you ran to see the status for rsyslog service is systemctl status rsyslog
( since you haven't mentioned anything specific)
systemctl status
should also show you the PID and executable called under CGroup:
Also systemctl cat rsyslog
is a quick way to show the rsyslog systemd service file. Check what's called in via "ExecStart="

- 21
There are various ways to find the path to executables. I believe you are looking for number three below but I thought I should mention more information.
1.You can use the find
command to search the system. I personally like to run
find / -name *COMMAND* 2> /dev/null
(replace COMMAND with actual command name) . This will search the entire system for the command and pass any errors to /dev/null so you do not see them. This usually gives too much information so I recommend one of the next options
2.You can use the which
command to find the executable of almost any command. For example
testUser@testMachine:~$ which cat
/bin/cat
testUser@testMachine:~$ which ls
/bin/ls
testUser@testMachine:~$ which rsyslogd
/usr/sbin/rsyslogd
3.If you want to see a running command/process and the options that were passed to it, then you can use ps -ef | grep COMMAND
in order to see the process running and the options passed to it.
testUser@testMachine:~$ ps -ef | grep rsyslogd
syslog 1091 1 0 Mar03 ? 00:00:25 /usr/sbin/rsyslogd -n
testUser 11359 31985 0 00:05 pts/0 00:00:00 grep --color=auto rsyslogd

- 392
-
1See https://unix.stackexchange.com/q/85249/5132 and https://mywiki.wooledge.org/BashPitfalls#ps_ax_.7C_grep_gedit . Also note that
grep
catches the pattern anywhere in an entire line, even when one uses the "do not match my pattern" trick. – JdeBP Mar 16 '20 at 09:45
which command
, orwhatis command
, in extreme caseslocate command
, desperate cases make me reach forfind
. – vonbrand Mar 17 '20 at 02:10