LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-12-2007, 08:40 AM   #1
rtaft
Member
 
Registered: Aug 2003
Posts: 85

Rep: Reputation: 15
What is 2> ?


Google and other search engines are useless when I search for something so simple like 2>. But I see this being used in init scripts, and was cusrious what it meant, ie:

someprocess > /dev/null 2> /dev/null

I am guessing it's for error output, but I'm not 100% sure.
 
Old 03-12-2007, 08:45 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Your right, that redirects both stdout and stderr to /dev/null so it doesn't show up on screen during the boot process.
 
Old 03-12-2007, 10:12 AM   #3
MOS JEFF-INITELY
Member
 
Registered: Sep 2006
Distribution: Windows .. MUAHAHAHA
Posts: 66

Rep: Reputation: 15
you can do this several ways .. if you want to append to a file possibly a log file that would contain STDOUT and STDERR

someprocess >> somelogfile 2>&1
or of course the same command you have written a different way
someprocess > /dev/null 2>&1
someprocess &> /dev/null

2>&1 redirects STDERR to STDOUT

2> STDERR
1> STDOUT

Edit** for google try searching for 'STDOUT redirect' 'linux redirect' or something along those lines

Last edited by MOS JEFF-INITELY; 03-12-2007 at 03:34 PM.
 
Old 03-12-2007, 11:10 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Moved: This thread is more suitable in Linux General and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 03-12-2007, 02:50 PM   #5
iamnothere
Member
 
Registered: Feb 2007
Location: UK
Distribution: Slamd 64, Slackware
Posts: 46

Rep: Reputation: 16
Quote:
someprocess 2>&1 >/dev/null
Actually, this last one is not the same. Redirections occur in strictly left to right order, so first stderr is redirectly to stdout (i.e. the terminal), then stdout is redirected to /dev/null, but this does NOT affect stderr, which is still directed to the terminal.

Standard Streams.
 
  


Reply



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 On
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:55 AM.

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
Open Source Consulting | Domain Registration