What happens when Linux logsout from command line?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
What happens when Linux logsout from command line?
Hi I was wondering if someone can explain to me what steps linux goes through when you logout or exit the command line (init 3). I know the login process works as I've put echo statements within the relevant files. Logout works to a point:
~/.bash_logout clears my screen when I exit, and shows the echo statement I put in there. Then it hangs.
I was wondering what happens after you type exit and hit enter. What files does linux call before displaying the login prompt screen? Could file permissions have been altered? If that could be the reason for hanging - that is why I need to know what files are accessed?
I'm still learning all this linux stuff (using RHL9.0) - probably never stop learning.
No I don't want to clear my history - I use it too. Question: if there are background processes - does it kill those too. Could it be that there are background processes running?
Also, it hung prior to me putting in the echo statement - I put that echo statement in there to see if logout was actually being called properly.
This is for a uni assignment that I have submitted already - we had to download 'system emergencies' which did something to our linux system, then we had to find what was wrong and fix it. I have found what was wrong - but had no idea how to fix it, so I submitted my assignment explaining that.
Now I am interested in finding out what they could have done to my system to cause it to hang. My first emegency was simply an incorrect slash used in the boot process command: \ instead of /. So my first emergency was fine - but this second one had me stumped.
Like I said - I can see that it is hanging once I type exit or logout from within the command line, but don't know what is wrong with the system once I hit enter - hence me wanting to know what files it calls, what actually happens once I hit enter. I take it the bash_logout file is called which clears the screen - but then what happens prior to displaying the login prompt? Could altered file permissions have caused this?
My ideas was that it could be something as simple as a 'space' being inserted in a file, where it shouldn't have one. It could be that something has been commented out by #. Or that file permissions have been altered for some file. But I don't know what files it uses once the ~/.bash_logout clears the screen.
They also supplied us with an emergency fix - that fixes the system. So my system is now back to how it should be, but I would like to execute the emergency again and actually learn how to solve it, and find out what they did to cause it to hang?
No - like I said I have already submitted my assignment - you will just have to have faith in me that I'm telling the truth. It was due yesterday so I submitted it saying that I knew what the emergency had caused my system to do, but didn't know how to fix it. I'm just very curious to find out what they did. I'm finding Linux very interesting and will continue using it and stuyding it once uni has finished. My bash_logout file, prior to me putting in the echo statement was just:
From this I took it that this file just cleared my screen. Something else then takes over to bring up the login prompt screen. What happens after this file clears the screen?
NB: Even if my assignment was still due, we were allowed to search the internet to find out if other people had experienced similar problems, and I took it that if I did have a systems admin position, and couldn't fix a problem, that I could post to a forum to see if anyone else had any ideas. There are numerous ways to find a solution to a problem, I am just using one of those ways: a forum.
But trust me - I have already submitted my assignment anyway - okay :-) I don't like the fact that some uni students have others do their assignments (e.g. someone I spoke to had a mate of his do his programming assignments, and this guy did his mate's hardware related assignments). I don't think that's fair, because you are not showing what you know - and I have stressed myself out and put myself under lots of pressure, because I want to learn - not have someone else do it for me. I study externally, so I don't even have other internal students to talk to - I have done it all on my own and have only a computing project to do and one other subject and I will have a degree. All my own work - and proud of it.
Thanks again, for your prompt reply - it is much appreciated.
so - I take it there is something happening when it is trying to read the files that then make the login screen reappear?
If there is a background process running - does logout shut it down too?
Do you have any other idea about what might be causing it to hang?
I've read numerous man pages, and I just can't seem to come up with what would be causing it to hang. I know I came across the file that contains the message that displays after boot process and waiting for you to login:
RedHat Linux 9.0
(can't think now what file it was).
If the login prompt displays when you first boot into the system - I take it this should mean that there is nothing wrong with the scripts that make that appear, all permissions would be correct, so when I exit there should be no reason why they don't appear again - Correct?.
And if the bash_logout file is clearing this screen just like it should - obviously no problem there either - Correct?.
See why I am at a total loss? I'm sure it is something so simple, that I am overlooking. It can't be too big a problem, because we are expected to be able to load our emergency disk and fix the problem from within our safe state. Just wish I knew what the problem was <Grin>