Unix/Linux output

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
complete
Posts: 1
Joined: Thu Aug 18, 2005 7:50 am
Location: St. Louis
Contact:

Unix/Linux output

Post by complete »

I am using CGYWIN, the Unix/Linux emulator program on Windows XP. So my question applies to Linux.

How do I get output to go to a file? For instance, in DOS it is > and in VAX/VMS it is usually /output=filename.

I did a "man grep" to get a description (manual) of all the grep options. I see that there is no option for putting the output to a file.
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

the syntax is :

Code: Select all

$ command > file
This will redirect the standard output (stdout) to file.

If you want to redirect the standard error (stderr), use this :

Code: Select all

$ command > file 2>&1
1 is stdout and 2 is stderr
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest