LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-09-2010, 08:19 AM   #1
threezerous
Member
 
Registered: Jul 2009
Posts: 96

Rep: Reputation: 16
Question strace -f -p pid_no > trace.txt 2>&1


I was given the above command to trace one of the java processes which was failing with an outofmemory exception.

Based on man I under stand what -f and -p stand for. I also understand redirect output to trace.txt. But I am not clear on what '2>&1' is for. This has successfully run and helped me debug some issues. Can somebody explain what is the significance of '2>&1' is?

Thanks
 
Old 04-09-2010, 08:28 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
2 is stderr, 1 is stdout

you are effectively saying send/redirect stderr (2) to the same location as stdout (1)

All About Redirection


you might also be interested in the use of strace's output to a file option...

Code:
strace -f -p pid_no -o trace.txt

 
1 members found this post helpful.
Old 04-09-2010, 09:47 AM   #3
threezerous
Member
 
Registered: Jul 2009
Posts: 96

Original Poster
Rep: Reputation: 16
Thanks for helping understand redirection. Also the second command is easier to remember
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] strace kdesu konqueror & > ./strace_kdesu (diagnosing failing kdesu) GrapefruiTgirl Linux - Desktop 23 11-02-2009 05:03 PM
cat onelinefile.txt >> newfile.txt; cat twofile.txt >> newfile.txt keep newline? tmcguinness Programming 4 02-12-2009 06:38 AM
How to trace and disable the HTTP TRACE method in Apache 1.3.33 with FreeBSD? SomnathG Linux - Security 1 11-11-2008 09:41 AM
How do I give jsmith r & w permissions for myfile.txt? lumix Linux - Newbie 2 04-25-2008 06:47 PM
trace & memory arunachalam Linux - General 1 01-17-2006 02:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:40 PM.

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