LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 07-16-2003, 09:40 AM   #1
Sammy2ooo
Member
 
Registered: Jan 2003
Location: nearby switzerland
Distribution: Suse 8.0 / Suse 9.0 / Slackware 9.1 / Debian Sarge testing / Gentoo 1.4.10
Posts: 165

Rep: Reputation: 30
> /dev/null 2>&1


Hi

Can someone tell me what this does?

>/dev/null 2>&1

i know what /dev/null and zero are for but what the hack does 2>&1 ??

Greets Sam
 
Old 07-16-2003, 10:17 AM   #2
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
1> means redirect stdout and 2> means redirect stderr. This is a guess now but 2>&1 probably indicates direct stderr to stdout, and then flush the lot down /dev/null.
 
Old 07-16-2003, 10:20 AM   #3
cnjohnson
Member
 
Registered: Nov 2002
Location: Nashville
Distribution: FreeBSD, Linux, OS-X
Posts: 544

Rep: Reputation: 30
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.)

Standard input, standard output, and standard error all are give special "file handles" by the operating system: 0, 1, 2. If you know a little C (or C++) programming, this will make more sense.

Cheers--
Charles
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What would happen if I where to cat /dev/mem > /dev/null Joey.Dale Linux - General 11 07-26-2009 01:46 PM
mv c:\WINDOWS /dev/null; mount /dev/hda treehead LinuxQuestions.org Member Intro 5 10-19-2004 09:53 AM
Creating a printer, but sending to a script & /dev/null, how to? cougar694u Linux - Software 1 09-24-2004 02:38 PM
> /dev/null 2>&1 blackzone Linux - Newbie 2 09-20-2004 05:10 AM
2>/dev/null && {...} need explanation G-Fox Linux - Networking 2 08-16-2003 01:31 PM


All times are GMT -5. The time now is 11:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration