Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-09-2010, 09:19 AM   #1
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?

Old 04-09-2010, 09:28 AM   #2
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...

strace -f -p pid_no -o trace.txt

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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:03 PM
cat onelinefile.txt >> newfile.txt; cat twofile.txt >> newfile.txt keep newline? tmcguinness Programming 4 02-12-2009 07: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 10:41 AM
How do I give jsmith r & w permissions for myfile.txt? lumix Linux - Newbie 2 04-25-2008 07:47 PM
trace & memory arunachalam Linux - General 1 01-17-2006 03:00 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration