简体   繁体   中英

How do I determine the commands being issued when I use a GUI?

I am working on a Linux machine (running openSUSE 13.1 w/ KDE, specifically) and I would like to determine what commands are actually being issued in the background when I do something with an application's GUI.

My question is very similar to the following one which has received no answer: https://stackoverflow.com/questions/20930239/how-can-i-see-the-commands-being-passed-in-backend-of-a-gui-application

If it helps at all, the specific task I am trying to accomplish is figuring out what the command line-equivalent is for sending a file to the Trash in KDE's Dolphin utility. I would like to make an alias for this functionality in my .bashrc so that I have a "gentler" alternative to rm. But I would rather know the answer to my more general question so that I can do similar things in the future.

My naive guess was that a log file might exist somewhere. Then I could do a task with a GUI and just tail that log file afterward to see what the underlying commands were for what I just did in the GUI. As far as I can tell, however, no such log exists.

To move a file foo to your trash bin, try

 mv foo $HOME/Trash/

so you could make that a shell function in your .bashrc

 function movetotrash() {
   mv $* $HOME/Trash/
 }

AFAIK, most GUI applications don't have log files. They are generally free software (and using free software libraries), so you could study their source code and improve it. Try to interact with their communities (and use strace as I commented)

BTW, not every GUI application is using commands. Some are (eg IDE are indeed forking commands like gcc ) but others just do directly syscalls (probably a file manager won't fork an mv but just would copy contents or call the rename(2) syscall).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM