- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Redirecting output of the screen to a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО10-26-2006 06:57 AM
тАО10-26-2006 06:57 AM
i want to redirect output of the some of commands and screen to a file. I used the command
$somecommand > outputfile.
it doesn't work for the type of application i am using.
is there some other way to redirect the output on the screen in some file ?
Thanks in advance.
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 06:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:04 AM
тАО10-26-2006 07:04 AM
Re: Redirecting output of the screen to a file
man tee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:04 AM
тАО10-26-2006 07:04 AM
Re: Redirecting output of the screen to a file
xwd -nobdrs -out savewindow
xwud -in savewindow -display $DISPLAY
Do a man on xwd, xwud and xpr for details.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:11 AM
тАО10-26-2006 07:11 AM
Re: Redirecting output of the screen to a file
Your redirection assumes that what you are interested in capturing comes from STDOUT (file descriptor #1). Well-behaved Unix tools produce output to STDOUT, but write *errors* to STDERR (file descripter #2).
Consider:
# cp 1> /dev/null
...still shows the usage of the command on your terminal; but:
# cp 2> /dev/null
...relagates the text to the bit-bucket.
If you want to capture both STDOUT and STDERR in a file, do:
# mycommand > filename 2>&1
That means redirect STDOUT to 'filename' and then redirect STDERR (file descriptor #2) to the same place as file descriptor #1 (STDOUT). The order is very important.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:14 AM
тАО10-26-2006 07:14 AM
Re: Redirecting output of the screen to a file
the reason it is not able to redirect the output to a file. i used $somecommand | tee
but it didn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:25 AM
тАО10-26-2006 07:25 AM
Re: Redirecting output of the screen to a file
Depending on your application, you may find it difficult or impossible to get usuable output redirected to a file. This is especially true of curses/ncurses-based programs or interactive programs.
The 'script' or 'screen' commands may be of some use, but for certain programs, you will need to take screenshots or scrollback buffer dumps. For example, in PuTTY, right-click on the title bar and choose "Copy All To Clipboard". Or drag your cursor over the area of interest to select and copy. Then paste into vim/EditPlus/notepad.
PCS
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 07:47 AM
тАО10-26-2006 07:47 AM
Re: Redirecting output of the screen to a file
To add to my first examples, you can do this, too:
# cp 2>&1 | tee myoutput
Now you see STDERR on both your terminal and in the file "myoutput".
All these examples assume that its file descriptor 1 and 2 that the I/O of interest occurs upon. This is standard and a safe first assumption.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 11:01 AM
тАО10-26-2006 11:01 AM
Re: Redirecting output of the screen to a file
script /tmp/logfile.txt
su shiv
login: shiv
password: xxx
bdf
ll
exit ( exits out of su session)
exit (exits out of script command and saves the file).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 10:22 AM
тАО10-29-2006 10:22 AM
Re: Redirecting output of the screen to a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 11:11 AM
тАО10-29-2006 11:11 AM
Re: Redirecting output of the screen to a file
The syntax '2>&1' means that file descriptor 2 (STDERR) is duplicated to file descriptor 1 (STDOUT). That is, STDERR is treated as a duplicate of STDOUT. Output which is directed to STDERR (FD #2) is written to the same place as STDOUT (FD #1).
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 11:22 AM
тАО10-29-2006 11:22 AM
Re: Redirecting output of the screen to a file
Best Regards,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 11:28 AM
тАО10-29-2006 11:28 AM
Re: Redirecting output of the screen to a file
The ampersand ('&') is the shell syntax that means to duplicate. We are duplicating a file descriptor using the underlying system call 'dup(2)'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 11:40 AM
тАО10-29-2006 11:40 AM
Re: Redirecting output of the screen to a file
Warm Regards as always.
Shiv