4

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?

1
  • 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, 2013 at 18:36

2 Answers 2

5

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.

1
  • 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, 2013 at 18:35
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .