Oracle - How can I find the session id of a shell script (Linux)?
In order to find a specific session running a certain script, it is easiest if the scripts makes itself identifiable by using dbms_application_info and dbms_session. See Morgans Library for details. Also see track the parts of my application that are in use for sample code.

Doing so enables you to select on v$session and filter not only on username and machine but also on module, action, client_info and client_id. Username and machine are not mutable but the other columns are controlled by dbms_application_info and dbms_session. Using those makes your script recognizable. This of course, only works when the other session has select privileges on v_$session.

dbms_application_info is also great for finding where your code is running; a way to instrumentate your code to make performance analysis easier.

your code in SQLdeveloper would be as simple as

select sid 
from gv$session
where module = 'what you specified'
order by sid
/


The code added in the script to make this work would be

exec dbms_application_info.set_client_info('some detail'); 
exec dbms_application_info.set_module('what you specified','action'); 
exec dbms_session.set_identifier('DDD');