FG

Trace linux bash call

Fresh3 days ago
Mar 15, 20263886 views
Confidence Score0%
0%

Problem

I was wondering if there is a way to trace where a command was run from in Linux. For example, if I call a script, is there any way to trace where it was called from, like started from a program or another bash script.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Trace linux bash call

Low Risk

If your script is written is bash, there is a built-in variable called $PPID (short for parent's process ID, I guess) that you can use to find out who called your script. Here is an example: Explanation: The $PPID gives the process ID of the parent …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment