Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8849995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:47:47+00:00 2026-06-14T12:47:47+00:00

Every once in a while I have to fire up a GUI program from

  • 0

Every once in a while I have to fire up a GUI program from my terminal session to do something. It usually is Chrome to display some HTML file are some task alike.
These programs however throw warnings all over the place and it can actually become ridiculous to write anything so I always wanted to redirect stderr/stdout to /dev/null.

While ($PROGRAM &) &>/dev/null seems okay I decided to create a simple Bash function for it so I don’t have to repeat myself everytime.

So for now my solution is something like this:

#
# silly little function
#
gui ()
{
  if [ $# -gt 0 ] ; then
    ($@ &) &>/dev/null
  else
    echo "missing argument"
  fi
}

#
# silly little example
#
alias google-chrome='gui google-chrome'

So what I’m wondering about is:

  • Is there a way without an endless list of aliases that’s still snappy?
  • Are there different strategies to accomplish this?
  • Do other shells offer different solutions?

In asking these questions I want to point out that your strategies and solutions might deviate substantially form mine. Redirecting output to /dev/null and aliasing it was the only way I know but there might be entirely different ways that are more efficient.

Hence this question 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:47:48+00:00Added an answer on June 14, 2026 at 12:47 pm

    As others have pointed in the comments, I think the real problem is a way to distinguish between gui vs. non-gui apps on the commandline. As such, the cleanest way I could think of is to put this part of your script:

      #!/bin/bash
    
      if [ $# -gt 0 ] ; then
        ($@ &) &>/dev/null
      else
        echo "missing argument"
      fi
    

    into a file called gui, then chmod +x it and put it in your ~/bin/ (make sure ~/bin is in your $PATH). Now you can launch gui apps with:

    `gui google-chrome`
    

    on the prompt.

    Alternatively, you can do the above, then make use of bind:

    bind 'RETURN: "\e[1~gui \e[4~\n"'
    

    This will allow you to just do:

    google-chrome
    

    on the prompt and it would automatically append gui before google-chrome

    Or, you can bind the above action to F12 instead of RETURN with

    bind '"\e[24~": "\e[1~gui \e[4~\n"'
    

    To separate what you want launched with gui vs. non-gui.

    More discussion on binding here and here.

    These alternatives offer you a way out of endless aliases; a mix of:

    • Putting gui in your ~/bin/, and
    • Binding use of gui to F12 as shown above

    seems the most ideal (albeit hacky) solution.


    Update – @Enno Weichert’s Resultant Solution:

    Rounding this solution out …

    This would take care of aliases (in a somewhat whacky way though) and different escape encodings (in a more pragmatic rather than exhaustive way).

    Put this in $(HOME)/bin/quiet

    #!/bin/bash -i
    
    if [ $# -gt 0 ] ; then
      # Expand if $1 is an alias
      if [ $(alias -p | awk -F "[ =]" '{print $2}' | grep -x $1) > 0 ] ; then
        set -- $(alias $1 | awk -F "['']" '{print $2}') "${@:2}"
      fi
      ($@ &) &>/dev/null
    else
      echo "missing argument"
    fi
    

    And this in $(HOME)/.inputrc

    #
    # Bind prepend `quiet ` to [ALT][RETURN]
    #
    # The condition is of limited use actually but serves to seperate
    # TTY instances from Gnome Terminal instances for me.
    # There might very well be other VT emulators that ID as `xterm`
    # but use totally different escape codes!
    #
    $if $term=xterm
      "\e\C-j": "\eOHquiet \eOF\n"
    $else
      "\e\C-m": "\e[1~quiet \e[4~\n"
    $endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this command to go to every directory and once there run some
Hey folks, every once in a while I have the need to automate data
I have a cron job that runs every minute. Every once in a while
I have a MySQL database that is continually growing. Every once in a while
I have Rails app, and every once in a while, when I bring new
I have a PHP script running as a daemon. Every once in a while,
I run across this problem every once in a while. For some reason I
I see code on StackOverflow every once in a while, asking about some overload
Every once and a while I have a scenario like this, and can never
Every once in a while I'm editing some long pair of if-then-else statements (or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.