Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6859

A process is an instance of a computer program that is being executed.

36 votes
3 answers
9k views

How can I see the exact command line being executed inside some bash instance?

Now, I know the bash process ID, and I have root access - how can I see the exact command line being executed inside that bash? …
ttsiodras's user avatar
  • 2,371
50 votes
Accepted

How can I see the exact command line being executed inside some bash instance?

(gdb) call write_history("/tmp/foo") $1 = 0 I then detach from the process. (gdb) detach Detaching from program: /bin/bash, process 8909 And quit gdb. (gdb) q And sure enough... … bash$ tail -1 /tmp/foo while true ; do echo 1 ; echo 2>/dev/null ; sleep 30 ; done For easy future re-use, I wrote a bash script, automating the process. …
ttsiodras's user avatar
  • 2,371