Saturday, May 18, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 893  / 3 Years ago, mon, june 28, 2021, 9:48:54

I run "Videos" software from the Dash in Ubuntu. After some minutes the software freezes.



I've tried searching for the PID of the software to kill it, but I can't find any result with these commands:



pgrep Videos

ps -eo cmd,pid,stime


I don't know the stime of the process.



I have to restart my computer and after login, I see the software is executed by totem command.



How can I find the PID for software where the name of the software is different from that of the executable file?


More From » command-line

 Answers
7

If you run a command from terminal then the command will always show up in the process table being a process.



Your case is different as you have run a Desktop entry (declared in a .desktop file), whose name and the command it executes can be totally different.



The .desktop files use an INI format to express metadata.



Here is the Desktop entry for htop:



[Desktop Entry]
Version=1.0
Name=Htop
Type=Application
Comment=Show System Processes
Terminal=true
Exec=htop
Icon=htop
Categories=ConsoleOnly;System;
GenericName=Process Viewer


In you case, the Name is Videos and the Exec line will indicate the actual command executed.






You should track down the .desktop file and check the entry to get the command actually being executed.



So lets find the .desktop file that contains Name=Videos:



% grep -RH '^Name=Videos$' ~/.local/share/applications /usr/share/applications
/usr/share/applications/totem.desktop:Name=Videos


Got it !!



It's declared in /usr/share/applications/totem.desktop.



Now let's check what command it actually runs:



% cat /usr/share/applications/totem.desktop
[Desktop Entry]
Name=Videos
Comment=Play movies
Keywords=Video;Movie;Film;Clip;Series;Player;DVD;TV;Disc;
Exec=totem %U
Icon=totem
Terminal=false
Type=Application
.
.
<truncated>


As you can see, the Exec key says totem %U. %U indicates a list of URIs.






Now, if you do:



pgrep totem


you would get the PID of the totem instance.


[#14940] Tuesday, June 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eeperant

Total Points: 39
Total Questions: 106
Total Answers: 117

Location: Finland
Member since Sat, Dec 5, 2020
4 Years ago
;