Linux Tips: Modify ctrl-alt-del behavior
If you are migrating over from Windows you know the Ctrl-Alt-Del three finger salute brings up a ulitity that can help you stop out of control or frozen applications. And then, of course, a second three-finger salute might find your machine rebooting (for when those apps just don't want to unfreeze.) The default behavior for this in Linux to to immediately reboot your machine. That is fine if you're not used to hitting that combination every time an application goes postal on your machine. But if that is what you are accustomed to doing, you might have a hard time adjusting to the difference in behavior.
Think about it, Firefox freezes and you instantly go for Ctrl-Alt-Del only to have your machine instantly reboot. What kind of work could you lose? Fortunately you can prevent or even alter this behavior in Linux. And doing so only requires you to open up a flat text file in your favorite editor, make a change, and save the file.
Distribution specifics
Some distributions handle this task differently. And some distributions have changed the way the do this. So I will show you how to alter this behavior in two different ways which should cover all of the basics. We'll start with the older method first.
The original method
Distributions used to handle this even through the /etc/inittab file. The inittab file is primarily used to handle the run level of your system. Older distributions also used this file to determine behaviors such as key bindings like Ctrl-alt-del. If you open up this file and see a line that includes a string like:
ctrlaltdel:/sbin/shutdown -t1 -a -r now
you know your system uses this file to control this behavior.
The new method
If you do not find an entry like the above in your /etc/inittab file then you will want to take a look at the more modern method of handling this task. Take a look in the /etc/event.d directory. In this directory you should see a file called control-alt-delete. In this file you will see a line that looks like:
exec /sbin/shutdown -r now "Control-Alt-Delete pressed"
That is the line you will alter to change the behavior. And now, let's make some changes.
Making the change
Changing this behavior is simple. What you will do is replace the executable command for reboot with the command you want to use. Either that or you will comment the command out (by placing a "#" character at the beginning of the line) to dis
able the funcationality all together.
Let's say you want to replace the reboot behavior so that the Gnome System Monitor opens. This behavior would be more in line with the behavior of Windows. To make this change the inittab line would look like this:
ctrlaltdel:/usr/bin/gnome-system-monitor
and the control-alt-delete entry would look like:
exec /usr/bin/gnome-system-monitor
Make your changes and save your file. To make this change take effect.
What about when using GNOME?
You might find this doesn't work in GNOME. If you are using Metacity as the window manager you will want to issue two commands:
gconftool-2 -t str --set /apps/metacity/global_keybindings/run_command_9 "<Control><Alt>Delete"
and
gconftool-2 -t str --set /apps/metacity/keybinding_commands/command_9 "gnome-system-monitor"
If you are using Compiz as your window manager you will issue the following commands:
gconftool-2 -t str --set /apps/compiz/general/allscreens/options/command9 "<Control><Alt>Delete"
and
gconftool-2 -t str --set /apps/compiz/general/allscreens/options/command9 "gnome-system-monitor"
Other Window managers
There might be instances where an alternative window manager may not bind to this combination. Most window managers use their own key mappings for binding. If you find your window manager won't bind Control-Alt-Del look up your particular window manager key mapping process and map from there.
Final thoughts
There are instances where you will want to make sure your users have the same experience as they do in Windows. Take care of this particular behavior and your users will have one less issue to complain about when migrating to Linux.
Advertisement
To make the inittab changes become effective immediately without rebooting Linux, execute this command:
kill -HUP 1
will hang up and restart the Linux master process (init) immediately to re-read inittab settings!
You are setting the same key twice in the compiz section – must be a typo in there….