All it is doing is looking for all processes where thing1 and dtsession can be identified when running "ps" and exclude the "grep" command itself.
If true (i.e. processes found matching criteria) then pass all of the process IDs to "kill". The command is expecting to find the process ID in field 2, which is parsed by "awk".
The script is bash compatible so that should not cause you any grief so it depends on where the ps command places the process ID. I'm fairly certain that it's in the second field in Linux distros.
Sorry, I wasn't trying to suggest that dtsession was a compatibility point; only that the scripting constructs were, including the usage of "ps" and "kill". I can't tell you anything about dtsession.
In linux it will be something different, like Xsession or gnome session.
To find out exactly what it is you just need to log in graphially to you linux box and us ps to see what the process is called, and substitute that for dtSession.