# unable to logout



## Rohit (Jan 21, 2018)

Hi all, 

Thanks in advance. 

I logged in as usual with my general user account. How ever I was unable to logout. 
I tried the logout command with both 'csh' and 'sh'. sh says sorry, csh says not the logout shell. 

Why is this ? 

thanks


----------



## k.jacker (Jan 21, 2018)

Hei Rohit,

you can only `logout` from a shell where you really logged yourself in with username and password (or key e.g. on ssh).
It won't work in xterm as you allready logged in to the Xorg session via a login manager or from a terminal where you ran `startx` after you logged in via username and password.

Say you are on ttyv0 and enter your username and password, you should be able to logout via `logout` not matter what shell you are using.
But if you start another shell on top of that shell, the new shell isn't a login shell anymore and `logout` will not work.


----------



## phoenix (Jan 22, 2018)

`exit` works more uniformly. It will close a non-login shell, and will logout out of a login shell.

CTRL+D is a handy shortcut for `exit`


----------



## Snurg (Jan 22, 2018)

phoenix said:


> CTRL+D is a handy shortcut for `exit`


Ctrl-D is the EOF (end-of-file) character.
It is useful not only for shells.


----------



## SirDice (Jan 22, 2018)

Snurg said:


> Ctrl-D is the EOF (end-of-file) character.


Actually, it's more than that. At least under csh(1):


```
"^D"           ->  delete-char-or-list-or-eof
```

It will depend on the context whether it's 'delete-char', 'list' (file completion) or 'EOF'.


----------

