Is it true that there is tmux daemon or server running on a Unix / Linux system? If so, what is its name and how can we use
ps ax | grep -i <the_name>
to be able to see it running?
Is it true that there is tmux daemon or server running on a Unix / Linux system? If so, what is its name and how can we use
ps ax | grep -i <the_name>
to be able to see it running?
If you have a tmux session running (attached or detached), then yes, there’s a tmux server running, and you can see it by looking for a tmux process with no tty. Its “comm” entry will be changed to “tmux: server”:
$ ps -t- | grep tmux
2109406 ? 00:00:00 tmux: server
or
$ pgrep -l tmux
2109406 tmux: server
ps -t-... it works well on Ubuntu but not on macOS
– nonopolarity
Apr 08 '20 at 14:48
ps | grep. Usepgrep. And if you're using Linux (where bothpgrepandpsare buggy), use grep directly:grep -H . $(grep -li tmux /proc/[0-9]*/comm)– Apr 08 '20 at 14:10pgrep -l tmuxfor it to work. Without the-lit won't show the name – nonopolarity Apr 08 '20 at 14:51pgrep -a tmuxwill show even more info. Both the process name (comm) and the arguments (cmdline) can be faked by a process. If you want to find all the processes which are running a binary, uselsof. Orgrep -H '.*' $(find /proc/[0-9]*/exe -lname /usr/bin/tmux 2>/dev/null -printf '%h/comm\n')– Apr 08 '20 at 14:55pgrep. Should there be only one perspective in the world? I am wondering whyps ax | grep tmuxwon't be able to show it, and if I dopgrep -l tmuxit showed 14975 for the tmux server, and if I dops 14975it showed the process fortmux new, not the server – nonopolarity Apr 08 '20 at 15:07ps | grepwon't show it because the tmux server changes it's process name totmux: server(/proc/PID/comm) NOT its command line arguments (/proc/PID/cmdline) which ps is showing by default. Also, if you read the manpages and test the commands, you will change your perspective to someone's familiar with them ;-) – Apr 08 '20 at 15:09pgrepwill not find the command due to its name having been changed. For example, on my Mint system,pgrep firefoxreturns nothing, whereaspgrep -f firefox(more or less equivalent tops -ef | grep firefox) finds all the firefox PIDs. So, depending on the specific command and system, you may have to usepgrep,pgrep -f(orps -ef | grep), or some more complicated command such as @mosvy suggests above. – jrw32982 Aug 16 '20 at 23:23