Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-29-2007, 08:03 AM   #1
Registered: Sep 2005
Distribution: Ubuntu
Posts: 249

Rep: Reputation: 30
Script to run "CTRL+ALT+BACKSPACE"

What command exactly is run when you press the keys "CTRL+ALT+BACKSPACE"? I have some times where I need to have a script restart my X-session. As a user I can press CTRL+ALT+BACKSPACE any time I want and restart my graphic session, but I do know how to do this from a script. Can anyone tell me how?
Old 04-29-2007, 08:08 AM   #2
General Failure
Registered: Jan 2007
Location: Germany
Distribution: Slackware 13.37
Posts: 387

Rep: Reputation: 35
killall X|kdm|gdm|xdm ?
Old 04-29-2007, 04:08 PM   #3
Senior Member
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,062

Rep: Reputation: 200Reputation: 200Reputation: 200
it is built into X itself
I'm not sure but a killall X then maybe you would need to run KDM , GDM or XDM
then what ever started started X or it may respwan on it's owen
try a " killall X "from an xterm and what happens
Old 04-29-2007, 05:05 PM   #4
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,756

Rep: Reputation: 459Reputation: 459Reputation: 459Reputation: 459Reputation: 459
Here is a small C program that does the real Control-Alt-Backspace thing:
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>

int main(int argc, char **argv)
  Display *display;
  int foo;

  if((display=XOpenDisplay(NULL)) == NULL)
      fprintf(stderr, "%s: can't open %s\n", argv[0], XDisplayName(NULL));

  if(XTestQueryExtension(display, &foo, &foo, &foo, &foo) == False)
      fprintf(stderr,"XTEST extension missing\n");

  XTestFakeKeyEvent(display, XKeysymToKeycode(display, XK_Control_L), True, CurrentTime);
  XTestFakeKeyEvent(display, XKeysymToKeycode(display, XK_Alt_L), True, CurrentTime);
  XTestFakeKeyEvent(display, XKeysymToKeycode(display, XK_BackSpace), True, CurrentTime);
  return 0;
Exercise it with caution !


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"GRUB _" when booting, nothing but "ctrl+alt+del" functions rabidpencil Linux - Newbie 15 08-08-2006 11:20 AM
"Alt GR" produces Keycode for "CTRL" as well Bigpet Linux - Software 5 04-09-2006 05:31 AM
dark screen when pressing Ctrl + Alt + Backspace or Ctrl + Alt F1-F6 in Gnome or KDE trinoo Slackware 5 01-28-2005 09:13 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:18 PM.

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