LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-06-2013, 05:47 AM   #16
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886

If you are using Lubuntu it is no wonder that this doesn't work, this advice is meant for systems that run Gnome 3.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-11-2013, 09:59 AM   #17
Doogie256
LQ Newbie
 
Registered: May 2013
Distribution: Debian, Mint, Arch
Posts: 1

Rep: Reputation: Disabled
works eveywhere

# pkill -KILL -u username
 
Old 06-30-2017, 11:50 PM   #18
Telo
LQ Newbie
 
Registered: Jun 2017
Distribution: Debian
Posts: 11

Rep: Reputation: Disabled
Quote:
Originally Posted by andrew.comly View Post

sudo pkill -u username
sudo service lightdm restart
Thanks! Works w/ Debian 9.0 Cinnamon 3.2 also, but note: these will not save any work in any windows you have open, i.e. Firefox won't get shutdown properly.
 
Old 12-05-2019, 11:12 AM   #19
PsychotriaViridis
LQ Newbie
 
Registered: Dec 2019
Posts: 1

Rep: Reputation: Disabled
Of course, there is still the option to kill the X-server: ctrl + alt + backspace.
This brings you right to the login screen.
 
Old 04-29-2022, 01:51 PM   #20
cameronlanders
LQ Newbie
 
Registered: Apr 2022
Location: Texas
Distribution: Arch Linux
Posts: 1

Rep: Reputation: 0
Bash script to create a logout command

Quote:
Originally Posted by LAPIII View Post
I know how to sudo reboot & sudo shutdown -h now, but not logout!
This answer is for implementing a logout command that you can use from within a terminal, that will logout completely, returning you to the login prompt. Since there is no "built-in" logout command, the best thing to do for a permanent solution that works for all users on your linux machine is to write a simple bash script. Here's how:

1. Create a new file called "logout". In it, place the following:

!# /usr/bin/bash
loginctl terminate-user $(whoami)

2. Save the file to your hoke directory for now.

3. Mark the file as executable:
sudo chmod +X logout

If all went well, when you do an ls -l you should see that the file now has execute permissions.

4. The final step is to move the file to the /usr/bin folder:
sudo mv ~/logout /usr/bin/logout

You should now be able to simply type logout from any terminal to completely logout.

How this works:
The command in the bash script simply calls the loginctl command and feeds it the name of the currently-logged-in user. This creates a single-word command to logout without having to specify your user name.It just works, no matter which terminal, window manager or linux distro you use.

Cheers,
-=Cameron
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to log terminal sessions? bostonantifan Ubuntu 2 10-26-2007 04:30 PM
Deleting Terminal log!! A.S.A.P! itz2000 Linux - Newbie 4 06-24-2006 04:18 PM
Log in terminal as Root ron126 Linux - Newbie 3 03-22-2005 10:45 AM
terminal log? iLLuSionZ Linux - General 8 11-24-2003 08:06 PM
how to log off x-window from terminal ? johnyy Linux - Software 1 10-25-2003 08:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 10:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration