Questions using - someprog > /dev/null 2>&1

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 7348
  • Loc: Seattle, WA
  • Status: Offline

Post January 28th, 2003, 12:20 am

I know in linux you would use that with a command to make any output by that command to be silent but I was just wondeing if anybody could explain the last part of this

someprog > /dev/null 2>&1

It makes sense to me to use the > /dev/null so that the output goes to null and disappears, but what exactly does the 2>&1 do ? Thanks if anybody knows the answer.
Ozzu Hosting - Want your website on a fast server like Ozzu?
Contact US for more information about our plans and rates
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 28th, 2003, 12:20 am

  • vili
  • Born
  • Born
  • User avatar
  • Joined: Jun 29, 2003
  • Posts: 3
  • Status: Offline

Post June 29th, 2003, 11:55 pm

The first part, "> /dev/null" means send standard output to the 'bit
bucket" or in other words, throw it away.

The second part, "2>&1" means "redirect standard error (2) to the same
place as standard outout (1.)
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 7348
  • Loc: Seattle, WA
  • Status: Offline

Post June 30th, 2003, 12:04 am

Thanks for the reply, I was wondering if anybody was ever going to help me out there :)

Also I think you mean standard output, not standard outout :wink:
Ozzu Hosting - Want your website on a fast server like Ozzu?
Contact US for more information about our plans and rates
  • vili
  • Born
  • Born
  • User avatar
  • Joined: Jun 29, 2003
  • Posts: 3
  • Status: Offline

Post June 30th, 2003, 12:10 am

You are correct
  • torkil
  • Born
  • Born
  • No Avatar
  • Joined: Sep 08, 2003
  • Posts: 1
  • Status: Offline

Post September 8th, 2003, 12:45 am

I have a shell script that is running daily - at midnight - on my linux box, and lately it has been returning some strange error messages. At the same time, my disk stats show that my system partition on my harddrive is being loaded with lots of data at midnight every day, and my system stats show that cpu utilization is close to 100% from midnight and for several hours after that.

I am assuming that this process is making life hard on my server... My question is: The data that this process generates - where is it stored? I mean... if it just spits out lots of errors, there has to be a huge error log here somewhere?

(if you hadn't guessed already, I'm a bit of a novice when it comes to linux....)
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 7348
  • Loc: Seattle, WA
  • Status: Offline

Post September 8th, 2003, 2:37 am

Did you check the mail under the root account? or the owner's mail of the acount starting the process?
Ozzu Hosting - Want your website on a fast server like Ozzu?
Contact US for more information about our plans and rates
  • compdude
  • Born
  • Born
  • No Avatar
  • Joined: Oct 03, 2003
  • Posts: 4
  • Status: Offline

Post October 3rd, 2003, 2:06 pm

Why would I not forward stout to ">> /var/adm/messages 2>$1"

This way I still get tracking info and it is automatically flushed via cron.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 127 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.