- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- 2>&1 (what is the meaning?) <:0 /
Operating System - Linux
1753876
Members
7328
Online
108809
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 06:11 AM
01-06-2006 06:11 AM
Hi, could you tell me what is the meaning of next sintax at the end of a line in a cron?
¿2>&1? --> <:0 / (no idea)
i know that number 2 is to rredirect errors but i don't know for what is used &1
Thanks, Manuales.
¿2>&1? --> <:0 / (no idea)
i know that number 2 is to rredirect errors but i don't know for what is used &1
Thanks, Manuales.
Solved! Go to Solution.
- Tags:
- redirect
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 06:17 AM
01-06-2006 06:17 AM
Solution
2>&1 is used to redirect the output of standard error (file descriptor 2) to standard out (file descriptor 1) so that both output streams go to the same place.
You will sometimes see it like:
command > /dev/null 2>&1
This tells you:
> /dev/null --- This redirects standard out to /dev/null
2>&! -- Redirect standard error to standard out.
The cumulative effect is that std. error is redirected to std. out, which is redirected to /dev/null, so effectively both std. error and std. out go to /dev/null thus throwing away any output that the command generates.
You can also redirect all output to a regular file by:
command > /var/tmp/somefilename 2>&1
This causes std. error and std. out output to be sent to /var/tmp/somefilename for later review.
I hope this clears it up for you.
You will sometimes see it like:
command > /dev/null 2>&1
This tells you:
> /dev/null --- This redirects standard out to /dev/null
2>&! -- Redirect standard error to standard out.
The cumulative effect is that std. error is redirected to std. out, which is redirected to /dev/null, so effectively both std. error and std. out go to /dev/null thus throwing away any output that the command generates.
You can also redirect all output to a regular file by:
command > /var/tmp/somefilename 2>&1
This causes std. error and std. out output to be sent to /var/tmp/somefilename for later review.
I hope this clears it up for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2006 06:35 AM
01-06-2006 06:35 AM
Re: 2>&1 (what is the meaning?) <:0 /
Thanks !!!
<:D Manuales
<:D Manuales
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2006 12:02 PM
01-07-2006 12:02 PM
Re: 2>&1 (what is the meaning?) <:0 /
just a remark, the order of the redirection is important if you reverse the order:
command 2>&1 >/dev/null
the stderr of command will be out on the standard output and stdout to /dev/null
command 2>&1 >/dev/null
the stderr of command will be out on the standard output and stdout to /dev/null
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP