Is it safe to close shell just by clicking "X" or using "ctrl+d" while logged in as root with su or is it safer to close it by typing "exit"? Is there any difference (security-wise) at all or is it the same and it does not matter which way you use?
If you using the "X", the window manager sends a terminate signal to the shell.
Which has at the end the same result. If the shell does not react, the user usually gets a warning and can then force the shell to end (equal to
There is one small difference between the "X"- and exit-method if you are using
Closing the terminal emulator is not the same as pressing
So ultimately if your goal is to make sure there's nothing running in the background, its safter to click "X".
The info provided by jofel in his comment is incorrect (sorry jofel). The terminal emulator has no clue what jobs are running under the shell, thus it cant terminate them.
There is no difference. So much that, when you press ^D, you are doing the same thing as typing 'exit':