Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Starting firefox from terminal

  1. #1
    Join Date
    May 2009
    Beans
    192
    Distro
    Ubuntu 18.04 Bionic Beaver

    Starting firefox from terminal

    I have a bash script to start Firefox in different profile.

    Code:
    $ cat ~/bin/ff22 
    #!/bin/bash
    
    
    firefox -P ff22 &
    $
    This works fine.

    But problem is the terminal i run this program keep showing error message from firefox.

    How i hide error messages from firefox showing in terminal ?

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Starting firefox from terminal

    Redirect stdout/sterr to /dev/null:

    Code:
    firefox -P ff22 > /dev/null 2>&1 &
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  3. #3
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Starting firefox from terminal

    Why not simply write another firefoxff22.desktop file to use as a launcher for that other profile?

    Use command
    Code:
    gedit /usr/share/applications/firefox.desktop
    to open the original, look for the line
    Exec=firefox %u
    and edit that to
    Exec=firefox -P ff22
    then save the edited file to your /home as firefoxff22.desktop.

    You could then move that new launcher to /usr/share/applications if you want to and you should then have the two versions of firefox showing in your menu or dash.

  4. #4
    Join Date
    May 2009
    Beans
    192
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Starting firefox from terminal

    Thanks for the help. Got it working.

  5. #5
    Join Date
    May 2009
    Beans
    192
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Starting firefox from terminal

    Quote Originally Posted by ofnuts View Post
    Redirect stdout/sterr to /dev/null:
    Quote Originally Posted by ofnuts View Post

    Code:
    firefox -P ff22 > /dev/null 2>&1 &


    Thanks, this is what i was looking for

    Edit: sorry for double post, i don't see option to delete/merge posts.
    Last edited by bizhat; August 21st, 2014 at 12:45 PM.

  6. #6
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Starting firefox from terminal

    Quote Originally Posted by ofnuts View Post
    Redirect stdout/sterr to /dev/null:

    Code:
    firefox -P ff22 > /dev/null 2>&1 &
    I use just 2>/dev/null
    @ofnuts, please explain why you have > /dev/null 2>&1 &? And, why is there & at the end in this specific case?
    Last edited by vasa1; August 22nd, 2014 at 12:46 PM.

  7. #7
    Join Date
    May 2009
    Beans
    192
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Starting firefox from terminal

    & at the end because we need firefox run in background. If not, firefox won't release command prompt.

    > /dev/null 2>&1

    This, @ofnuts will explain

  8. #8
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Starting firefox from terminal

    It's bash magical shorthand for pushing Error Output (channel 2) into Standard Output (channel 1) and sending both of those into the bit bucket (/dev/null). It's used in a lot of bootup scripts to hide things when starting up services.

    Code:
    grep null /etc/init.d/*
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  9. #9
    Join Date
    May 2009
    Beans
    192
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Starting firefox from terminal

    Quote Originally Posted by tgalati4 View Post
    It's bash magical shorthand for pushing Error Output (channel 2) into Standard Output (channel 1) and sending both of those into the bit bucket (/dev/null). It's used in a lot of bootup scripts to hide things when starting up services.

    Code:
    grep null /etc/init.d/*
    Thanks,

    Code:
    firefox -P PROFILE_NAME 2>/dev/null &
    Also worked with out any error message in terminal.

  10. #10
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Starting firefox from terminal

    Quote Originally Posted by bizhat View Post
    & at the end because we need firefox run in background. If not, firefox won't release command prompt.

    > /dev/null 2>&1

    This, @ofnuts will explain
    Got it. But you are running a script aren't you? From your original post:
    Code:
    $ cat ~/bin/ff22 
    #!/bin/bash
    
    
    firefox -P ff22 &
    $
    So just assign a keyboard shortcut to ~/bin/ff22 and you won't even need the terminal and & at the end won't be an issue. That's why I haven't found the need for & in my script.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •