Find the answer to your Linux question:
Results 1 to 6 of 6
Now another one my silly doubt when I press cnrtl+d on mu console the logout command is executed, but when i start a bash and press cnrtl+d the exit command ...
  1. #1
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    logout vs exit

    Now another one my silly doubt
    when I press cnrtl+d on mu console the logout command is executed, but when i start a bash and press cnrtl+d the exit command is executed. Also it is possible to logout using the exit command directly. so are both logout and exit command the same as in are they symlink to each other.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  2. #2
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    Exit will exit from the shell you are in.
    if you are in your login shell you will logout.
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  3. #3
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    so does that mean that both commands can be used interchangeably.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  4. #4
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    sort of, but those are different...
    Logout will not work on non login shells, like gnome-terminal/x-term or anyother shell you get on telnet,ftp,etc

    Exit is for any shell, login shell or non-login shell
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Also, when you exit the login shell (assuming the shell is bash), the script ~/.bash_logout is executed, giving you the opportunity to clean up anything you need before exiting. For example, in my .bash_login, I mount some CIFS remote drives (Windows shares, NAS directories, etc), so when I logout, those mounts are terminated properly.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    ok when you press cntrl+d the file .bash_logout in the home directory of the user is executed, but is there a file that gets executed for exit as well???
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...