Sometimes I run jobs, I lose track of which output files I have redirected the output to. How can I get the full command I ran a job with, including the output redirection part?
For example, when I run
nohup python3 -c $'from time import sleep;\nfor i in range(100): print(i); sleep(1)' > .test.txt &
which should print some stuff to
.test.txt and run for 100 seconds, and then run
ps -fp <PID> or check
/proc/<PID>/cmdline, I only get
python3 -c from time import sleep; for i in range(100): print(i); sleep(1)
I've tried some of the solutions on How to get the command line args passed to a running process on unix/linux systems?, but I don't think my command is being truncated.
I notice if the shell I ran the command in is still open when the job finishes, it shows the full path, e.g.
+ Done nohup python3 -c 'from time import sleep; for i in range(100): print(i); sleep(1)' > .test.txt
Is this info only stored in the shell that ran the job?
Edit: @muru I just realised
history does give me my command after all; thanks.