Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Users and Permissions Creating Users

Emerson Gutierrez
Emerson Gutierrez
5,780 Points

Question about the "exit" command

In the video, the "exit" command it's use for exits from the current session. My question is: the "exit" command only works after I have used the "su" command or it's for exits of any other process?

Thanks.

3 Answers

Steven Parker
Steven Parker
230,995 Points

:point_right: There are several commands that start a new session.

It's not just su that will open another session, but it's a common one and the first to be introduced in the course.

Another handy use for exit is inside script files. A script file contains a list of console commands and is executed in a separate session, but creating these may be outside the scope of this particular course.

Mircea Ungureanu
Mircea Ungureanu
7,483 Points

Hello, below is a comparison between various "exit" commands:

break Exit from a loop

return Exit a shell function

logout Exit a login shell

exit Exit the shell/terminate session

If you're stuck with shell commands just google "linux commands" and you'll find detailed lists. That's what I do, because it's impossible to remember every command if you're not constantly working in the terminal. Good luck.