Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 07-16-2003, 08:40 AM   #1
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


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, 09:17 AM   #2
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, 09:20 AM   #3
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.



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 12:46 PM
mv c:\WINDOWS /dev/null; mount /dev/hda treehead Member Intro 5 10-19-2004 08:53 AM
Creating a printer, but sending to a script & /dev/null, how to? cougar694u Linux - Software 1 09-24-2004 01:38 PM
> /dev/null 2>&1 blackzone Linux - Newbie 2 09-20-2004 04:10 AM
2>/dev/null && {...} need explanation G-Fox Linux - Networking 2 08-16-2003 12:31 PM

All times are GMT -5. The time now is 09:03 PM.

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