3

Basically, I want to open the current folder I'm in from terminal. I do gnome-open . from terminal and this opens the current folder I'm in.

In my .bashrc, I have a simple function called open that does this for me.

function open() { gnome-open . }

So I just call open, and it works. The only issue is that I get a bunch of warning messages when I do this?

(nautilus:414): GLib-GIO-CRITICAL **: g_dbus_interface_skeleton_unexport: assertion 'interface_->priv->connections != NULL' failed

(nautilus:414): GLib-GIO-CRITICAL **: g_dbus_interface_skeleton_unexport: assertion 'interface_->priv->connections != NULL' failed

(nautilus:414): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(nautilus:414): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(nautilus:414): GLib-GObject-CRITICAL **: g_signal_connect_object: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

I don't really care about the warning messages, I just don't want to see them in the terminal. How can I hide warning messages that come from calling open?

function open() { gnome-open . [ignore all warnings, just do what your asked] }

  • Try adding 2>/dev/null to the function. I don't know if it will work since I don't have gnome, but that is the universal "don't give me your sass" modifier. – Munir Jun 23 '17 at 1:14
  • You could redirect the standard error to /dev/null. – Thomas Dickey Jun 23 '17 at 1:14
  • @Munir where did the 2 come from? – K Split X Jun 23 '17 at 1:16
  • 2 is the file descriptor for standard error. en.wikipedia.org/wiki/File_descriptor – Munir Jun 23 '17 at 1:21
2

In case anyone wanted to know, I simply changed my function to redirect the error stuff.

Now it becomes

function open() {

   gnome-open . &>/dev/null
}
| improve this answer | |
  • Just to clarify, &> redirects both stdout and stderr – Jeff Schaller Jun 23 '17 at 2:54
  • Yes. Well really there was no stdout, just stderr in this case – K Split X Jun 23 '17 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.