Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

From the terminal, I like launching my standard working applications ... gedit with my todo-list, firefox and chromium.

To save time, I (1) chain this command into one line, (2) silence all error messages from stderr and stdout with 2&>1 >/dev/null and (3) background the processes with & to regain a clean terminal:

gedit ~/Desktop/todo.txt 2&>1 > /dev/null & firefox 2&>1 > /dev/null & chromium-browser 2&>1 > /dev/null &

It seems to work fine except for one small detail. Gedit opens the todo file as well as a new textfile with the name 2. Are the pipes misplaced?

share|improve this question
    
The correct code is: gedit ~/Desktop/todo.txt > /dev/null 2>&1 & firefox > /dev/null 2>&1 & chromium-browser > /dev/null 2>&1 & –  somethis Jan 8 '13 at 18:36
add comment

2 Answers

up vote 5 down vote accepted

I tend to see >/dev/null 2>&1 and not 2>&1 >/dev/null

Then > is probably key here since the next options for gedit is (a) filename(s).

Man page for gedit states for filename(s):

Specifies the file to open when gedit starts - if this is not specified, gedit will load a blank file with an Untitled label. Multiple files can be loaded if they are separated by spaces. gedit also supports handling of remote files. For example, you can pass the location of a webpage to gedit, like "http://www.gnome.org", or load a file from a FTP server, like "ftp://ftp.gnome.org/robots.txt".

If I read this correctly: the 2 is seen as a filename since a space preceeds it. That would suggest you need the > to tell gedit that it is not a filename that comes next.


I myself would create a script and have the commands on separate lines.

share|improve this answer
    
I chose this one as the accepted answer because it helped me see that I mistyped 2&>1 instead of 2>&1 as supplied by you. Duh! :) The correct code is: gedit ~/Desktop/todo.txt > /dev/null 2>&1 & firefox > /dev/null 2>&1 & chromium-browser > /dev/null 2>&1 & –  somethis Jan 8 '13 at 18:35
add comment

Quick answer:

gedit -b wallet.pem > /dev/null 2>&1

The -b option put gedit in background.

Longer answer:

For a task like this one I'd put these applications in the startuo of your Desktop Environment.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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