0

Let's suppose I run the terminal as <username>. Then I switch to root:

su - root

and then back to the <username>.

So I was wondering if there's some option (or some other command) for exit to close the console for all these sessions, 'cause when i run exit at that point, it takes me back to root and then to my <username> again.

1 Answers1

1

Instead of running, su - root, you could use the exec shell builtin:

exec su - root

This replaces the shell being run by <username> with the root login shell so that the parent process of root shell is the terminal emulator – not the original shell run by username. This means that when you exit the root shell, the terminal emulator should close the window or tab.