KDE, launch file manager from console

In KDE and Gnome, how do I launch file manager from the console?

You mean in a terminal emulator in your desktop, like konsole in KDE?

dolphin

For a bash script, I need to launch dolphin to a specific directory from terminal superuser or normal mode. Firefox will launch.

#dolphin
QStandardPaths: wrong ownership on runtime directory /run/user/0, -2 instead of 0
“Session bus not found
To circumvent this problem try the following command (with Linux and bash)
export $(dbus-launch)”

Doesn’t seem to be obviously possible (launching super-user dolphin), the closest I can make it happen is to use the command string in the KDE menu, but trying to open a specific location opens two panes, the User’s home directory plus the target directory.

On the other hand, PCManFM is the file manager installed by LXDE and XFCE, and works as expected… You can launch from both a normal and a root console with only warnings and no errors or unexpected behavior.

If you’re doing this as part of an effort to create a graphical frontend to the script-based app you’ve been building, this is the wrong approach. If you choose your coding language wisely, most modern languages will contain an object/control that pops up and allows a User to browse to, and select a file and automatically receives input from the User selection.

TSU

Satisfying my own curiosity,
I decided to take a look around to see if there are any recommended graphical frontends for BASH scripting,

And, it seems there are a few.

Zenity seems to be the most recommended (based on some discussions I read plus published code examples)
https://help.gnome.org/users/zenity/stable/

EasyBASHgui is mentioned a few times
https://sites.google.com/site/easybashgui/

Both of the above are supposed to automatically detect the graphical environment (typically Qt/KDE and Gnome), and use the appropriate libraries to display the UI correctly.

And, “Dialog” is probably something you’ve often seen, it’s a kind of modified ncurses but is a full framework of controls…
http://invisible-island.net/dialog/#screenshot

All or any of the above would for example provide the desired “file selection” UI instead of launching an entire File Manager with all its unnecessary functionality for file selection plus not automatically passing inputs and outputs to your BASH backend.

HTH,
TSU

Which file manager? Which console?

If you mean a virtual console, such as results from CTRL-ALT-F2, then there probably isn’t an easy way to do that. So perhaps you mean from a “konsole” window.

So I tried:

dolphin +file:`pwd` 2>/dev/null &

and dolphin started up using the current directory. I got the idea of trying that from the output of

dolphin --help

For super user mode, you can probably put a “kdesu” in front.

Personally, from the command line, I consider the unix shell to be my file manager. Some folk prefer “mc” (or Midnight Commander).

Thanks that worked. :slight_smile:

kdesu dolphin ${filedirectory}

I have to close the window to return to the command line. So, this should work better.

kdesu dolphin ${filedirectory} &

This sends the window open command to the background. So, it goes back to the console right away. (not tested)

How do I that same command in the gnome desktop?

If you’re doing this as part of an effort to create a graphical frontend to the script-based app you’ve been building, this is the wrong approach. If you choose your coding language wisely, most modern languages will contain an object/control that pops up and allows a User to browse to, and select a file and automatically receives input from the User selection.

As part of the scanvirus script (clamscan engine), it has it’s own logs. The script doesn’t need any gui to run, like clamscan. However, I found I needed to simplify opening a GUI window to view the logs directory: ‘scanvirus -viewlogs’. This is a shortcut to long menu->filemanager superuser mode -> enter admin password –> branch down tree to find logs. :stuck_out_tongue:

Wrong approach? What do mean?

I have the KDE openwindow working. Thanks for the help. :slight_smile:

I’ll see if I find any info on how to do the same in Gnome.

Also, the scanvirus is suppose to run with any libraries or other scripts. This KDE and Gnome - openwindow is a extra that will be disabled. However, if you want to use it, you can remove the comment #.

Thanks for the info. I’ll keep these mind for later. Giving the user a few more choice is good. :slight_smile:

This works for KDE. FYI all… Still need look up the command for Gnome. These commands will be disabled in scanvirus. You have to remove the hash tag to use it. That is all for this top. Thanks for the help to all

kdesu dolphin /var/log/VirusVault/