|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
|
|
RHEL Tips | ||||
| Linux netwoking tips | Filesystems tips | Shell Tips | Screen tips | MC tips | |
| Grub | Linux Start up and Run Levels | VIM Tips | Humor | Etc |
There are several large collection of Linux Tips on the Internet. Those are mixture of obsolete and useful tips so some work need to be done selecting valuable info from junk. Among them:
The Linux Tips HOWTO v3.6, June 1998 by Paul Anderson
Tips, Tricks, How-To from Fermilab.
Linux Tips Think of this as the LSADP (LinuxSA Documentation Project).
Linux Tips collection from Mike Chirico
For YUM tips one can look at Yum - Linux@Duke Project Wiki
Linux Gazette regularly publishes tips column. See for example More 2 Cent Tips! LG #106
Some references from Linux Today also might be useful, for example
5 Excellent Downloadable eBooks To Teach Yourself Linux(Aug 05, 2009)
How to have a lightweight, beautiful, functional terminal(Jul 30, 2009)
Speaking UNIX: Man oh man(Jul 29, 2009)
What's Bogging Down Your Linux PC? Tracking Down Resource Hogs(Jul 21, 2009)
Useful Tricks With Screen(Jul 08, 2009)
Down With tHE CAPS LOCK KEy(Jul 07, 2009)
Names Pipes... or how to get two separate applications to interact(Jun 30, 2009)
10 mistakes new Linux administrators make(Jun 30, 2009)
20 Linux System Monitoring Tools Every SysAdmin Should Know (Jun 28, 2009)
Linux has become so idiot proof nowadays that there is less and less need to use the command line. However, the commands and shell scripts have remained powerful for advanced users to utilize to help them do complicated tasks quickly and efficiently.
To those of you who are aspiring to become a UNIX/Linux guru, you have to know loads of commands and learn how to effectively use them. But there is really no need to memorize everything since there are plenty of cheat sheets available on the web and on books. To spare you from the hassles of searching, I have here a collection of 10 essential UNIX/Linux cheat sheets that can greatly help you on your quest for mastery...
I've been using this grep invocation for years to trim comments out of config files. Comments are great but can get in your way if you just want to see the currently running configuration. I've found files hundreds of lines long which had fewer than ten active configuration lines, it's really hard to get an overview of what's going on when you have to wade through hundreds of lines of comments.
$ grep ^[^#] /etc/ntp.confThe regex ^[^#] matches the first character of any line, as long as that character that is not a #. Because blank lines don't have a first character they're not matched either, resulting in a nice compact output of just the active configuration lines.
1. Run top in batch mode
2. Write to more than one file at once with tee
3. Unleash the accounting power with pacct
4. Dump utmp and wtmp logs
5. Monitor CPU and disk usage with iostat
6. Monitor memory usage with vmstat
7. Combine the power of iostat and vmstat with dstat
8. Collect, report or save system activity information with sar
9. Create UDP server-client - version 1
10. Configure UDP server-client - version 2
Remap Caps Lock key for virtual console windows
My last blog entry explains how to use xmodmap to remap the Caps Lock key to the Escape key in X. That takes care of the keyboard mapping when you are in X. What about when you are in a virtual console window? You need to follow the steps below. Make sure that you sudo root before you execute the following commands.To make the new key mapping permanent, you need to put the loadkeys command in a bootup script.
- Find out the keycode of the key that you want remapped.
Execute the showkey command as root in a virtual consolde:$ showkey kb mode was UNICODE press any key (program terminates after 10s of last keypress)... 0x9cHit the Caps Lock key, wait 10 seconds (default timeout), and the showkey command will exit on its own.$ showkey kb mode was UNICODE press any key (program terminates after 10s of last keypress)... 0x9c 0x3a 0xbaThe keycode for the Caps Lock key is 0x3a in hex, or 58 in decimal.
- Find out the symbolic name (key symbol) of the key that you want to map to.
You can list all the supported symbolic names by dumpkeys -l and grep for esc:$ dumpkeys -l |grep -i esc 0x001b Escape 0x081b Meta_Escape
- Remap the keycode 58 to the Escape key symbol.
$ (echo `dumpkeys |grep -i keymaps`; \ echo keycode 58 = Escape) \ | loadkeys -Thanks to cjwatson who pointed me to prepending the keymaps statement from dumpkeys. The keymaps statement is a shorthand notation defining what key modifiers you are defining with the key. See man keymaps(5) for more info.
For my Debian Etch system, I put the
(echo `dumpkeys |grep -i keymaps`; echo keycode 58 = Escape) |loadkeys - command in /etc/rc.local.
To swap caps lock and control:
# Make the Caps Lock key be a Control key: xmodmap -e "remove lock = Caps_Lock" xmodmap -e "add control = Caps_Lock" # Make the Left Control key be a Caps Lock key: xmodmap -e "remove control = Control_L" xmodmap -e "add lock = Control_L"Questions Answered Below
- How do you remap your keyboard to, say, turn the caps lock key into a control key?
- How about remapping other keys?
- What are the underlying concepts that
man xmodmapfails to explain?The instructions in this page apply only to Linux in an X environment (like KDE).
Terminology
- Keycode
A keycode represents a key. Each key on the keyboard has a unique keycode.
- Keysym
A keysym represents an action (I use the terms "action" and "keysym" synonymously below). Examples include "print the letter
c" and "start behaving like theleft shiftkey has been pressed".- Modifiers
The modifiers include shift, control, (caps) lock, and others (mod1 through mod5). Modifiers add another level of indirection and are managed with their own set of commands in
xmodmap.How These Relate To One Another
Keycodes, keysyms, and modifiers relate in the following way:
keycode → keysym → modifier (optional) So for example, on my keyboard:
keycode 38 (the 'a' key) → keysym 0x61 (the symbol 'a')
keycode 50 (the left 'shift' key) → keysym 0xffe1 (the action 'the left shift key is down') → the shift modifier Note that technically, each keycode can be mapped to more than one keysym. The first mapping applies when no modifier is pressed; the second applies when the shift key is pressed. (I haven't figured out how to use the third and fourth yet.) So for example, the second mapping on my 'a' key is:
keycode 38 (the 'a' key) → keysym 0x61 (the symbol 'A') In other words, when modifier 'shift' is active, my 'a' key generates an 'A' instead of an 'a'.
Viewing Your Settings
xmodmap -pkedisplays the mapping between and keysyms. For example (key on the left, action on the right):... keycode 37 = Control_L keycode 38 = a A agrave agrave acircumflex adiaeresis acircumflex adiaeresis ... keycode 66 = Caps_Lock ...This tells me that keycode 37 (which happens to be my left control key) is mapped to the Control_L action. Keycode 38 (my 'a') key is mapped to the action 'a' (with no modifieres pressed), the action 'A' (with shift pressed) or a variety of other actions when I'm pressing other modifiers. The last line says that keycode 66 (which happens to be my Caps Lock key) is mapped to the Caps_Lock action.
xmodmap -pmdisplays the mapping between modifiers and keysyms. For example (modifiers on the left, keysyms on the right):shift Shift_L (0x32), Shift_R (0x3e) lock control Caps_Lock (0x42), Control_R (0x6d), Control_L (0x25) ...The first line says that the "left shift" action and the "right shift" action both invoke the "shift". The second line says that no keysym invokes the "caps lock" modifier. The third says that the Caps_Lock action and the two Control actions invoke the control modifier.
xevAllows you to view keycodes and keysyms by pressing the key. For example, when I press the left 'shift' key:
KeyPress event, serial 25, synthetic NO, window 0x3200001, root 0xc8, subw 0x0, time 126222719, (-659,738), root:(1087,758), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: ""Line 3 tells me that the left shift key has keycode 50, and that it's currently mapped to keysym 0xffe1 (Shift_L).
Changing Your Settings
Say you want to map the caps lock key to be the control modifier. You have two sensible choices for how to do this:
Caps Lock Key → Caps Lock action → Control Modifier
Caps Lock Key → Control_L action → Control Modifier To do the first, you need to change the action → modifier mapping. Do this as follows:
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "add control = Caps_Lock"To do the second, you need to change the keycode → action mapping, so you'll need to know the keycode of your caps lock key. To find the keycode for your caps lock key use
xev,as described above. Mine is 66. So:
xmodmap -e "keycode 66 = Control_L"Help!
If you mess things up, the simplest way to fix things is to log out of the window manager and log back in.
For More Information
/usr/include/X11/keysymdef.hThis file will show you what keysyms exist. Note that you need to omit the
XK_prefix when specifying the keysym.Notes
- This is all determined from experimenting, so it may be wrong. But I think it's right!
- I did this on an x86 under (Red Hat) Linux in KDE, with a basic-looking HP keyboard -- your results may vary.
By David Vespe, April 2006
The Caps Lock key on most PC keyboards is in the position where the Control key is on many other keyboards, and vice versa. This can make it difficult for programmers to use the "wrong" kind of keyboard.This page describes how to RemapCapsLock on different keys in different OperatingSystems.
One really stupid thing about PeeCee keyboards is that manufacturers even realized that putting caps-lock on home row was a bad idea because people kept hitting it with the 'a' key. Did they move it? No, that would be too sensible. They carved a little piece of it off to leave a bigger gap. So now if I re-map a standard PC-10* keyboard so that left-control is in a sensible place, it is still harder to use than it should be. :(Many people (the majority, clearly) feel that the placement of CTRL below the SHIFT key is a better location for it. However, the backspace key is way out of the way -- it would be better if the CAPSLOCK and backspace keys were swapped.
Unix, ConsoleIf you have loadkeys (as you would under Linux), this should do the trick:
loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gzTo reset to the defaults (you may have to switch to another tty and back to undo ctrl-lock):loadkeys -dUnix, XUnder Redhat 8.0, just enable the following line in /etc/X11/XF86Config
Option "XkbOptions" "ctrl:swapcaps"Replace "swapcaps" with "nocaps" to turn both keys into "Control."With X, there are at least 2 different ways to remap the keys. One is using xmodmap. For example, man xmodmap shows how to swap the left control key and the CapsLock key:
! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_LMany people don't want a CapsLock key at all. They can change the CapsLock key to a ControlKey? by using the following lines in xmodmap:clear Lock keycode 0x7e = Control_R add Control = Control_RMaybe you have to change the keycode 0x7e. You can find the keycodes with xev. I Furthermore, this only works if you don't have a right control key. I hope somebody has a solution which does not have this restriction.This solution might be the easiest one. If you do not have a problem owning a dead key in your keyboard you might disable CapsLock at all:
"remove lock = Caps_Lock" (or just: "clear lock")A better solution might be this sequence, which is keycode independent and does not remove existing control keys:remove Lock = Caps_Lock remove Control = Control_L keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_LNow, you can use another solution which uses xkb. For that, you will have to find the sybols directory on your unix system. There, you add a file which might be called 'ctrl' containing the following:// eliminate the caps lock key completely (replace with control) partial modifier_keys xkb_symbols "nocaps" { key <CAPS> { symbols[Group1]= [ Control_L ] }; modifier_map Control { <CAPS>, <LCTL> }; };This eliminates the caps lock key if included in a keymap. We can do this by changing the file en_US:xkb_symbols "pc101" { include "ctrl(nocaps)" key <RALT> { [ Mode_switch, Multi_key ] };augment "us(pc101)" include "iso9995-3(basic101)"modifier_map Mod3 { Mode_switch }; };
You can then add the keyboard using a line like:/usr/X11R6/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11R6/lib/X11/xkb -xkm -m en_US keymap/xfree86 0:0Now, unfortunately there are probably errors in the text above. Please correct and make it working for other systems than RedHat Linux.
The dmidecode command can be used to display information from the systems' BIOS that includes the maximum memory that the BIOS will support. This information is displayed by dmidecode as type 16 (Physical Memory Array) which can be filtered with the command dmidecode -t 16.
For instance, the following output shows a system that can support a maximum of 16GB of RAM.
Handle 0x0032, DMI type 16, 15 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 16 GB Error Information Handle: Not Provided Number Of Devices: 4
Jan 26, 2009 | Linux Today
"Alt + SysR + K
Kill all processes (including X), which are running on the currently active virtual console."Alt + SysRq + E
Send the TERM signal to all running processes except init, asking them to exit."Magic Tricks With the Sysreq Key(Dec 10, 2008)
Sounds of Crashing Hard Drives(Nov 24, 2008)
Fix Unresponsive or Frozen Linux Computers Using Shortcuts(Nov 11, 2008)
Linux Kernel Magic SysRq Keys in openSUSE for Crash Recovery(Sep 29, 2008)
Rebooting the Magic Way(Aug 22, 2008)
Fix a Frozen System with the Magic SysRq Keys(Sep 17, 2007)
less Surprises One of the major benefits to using Red Hat Enterprise Linux is that once the operating system is up and running, it tends to stay that way. This also holds true when it comes to reconfiguring a system; mostly. One Achilles heel for Linux, until the past couple of years, has been the fact that the Linux kernel only reads partition table information at system initialization, necessitating a reboot any time you wish to add new disk partitions to a running system.The good news, however, is that disk re-partitioning can now also be handled 'on-the-fly' thanks to the 'partprobe' command, which is part of the 'parted' package.
Using 'partprobe' couldn't be more simple. Any time you use 'fdisk', 'parted' or any other favorite partitioning utility you may have to modify the partition table for a drive, run 'partprobe' after you exit the partitioning utility and 'partprobe' will let the kernel know about the modified partition table information. If you have several disk drives and want to specify a specific drive for 'partprobe' to scan, you can run 'partprobe <device_node>'
Of course, given a particular hardware configuration, shutting down your system to add hardware may be unavoidable, it's still nice to be given the option of not having to do so and 'partprobe' fills that niche quite nicely.
partprobe [-d] [-s] [devices...]
DESCRIPTION
This manual page documents briefly the partprobe command.partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.
OPTIONS
This program uses short UNIX style options.
- -d
- Don't update the kernel.
- -s
- Show a summary of devices and their partitions.
- -h
- Show summary of options.
- -v
- Show version of program.
Yum & Repositories
I noticed this issue with both CentOS 4 and 5 - Yum will often choose bad mirrors from the mirrorlist file - for example, choosing overseas servers, when an official NZ server exists. And in some cases, the servers it has chosen are horribly slow.
You will probably find that you get better download speeds by editing /etc/yum.repos.d/CentOS-Base.repo and commenting out the mirrorlist lines and setting the baseurl line to point to your preferred local mirror.
Yum-updatesd
CentOS 5 has a new daemon called yum-updatesd, which replaces the old cron job yum update scripts. This script will check frequently for updates, and can be configured to download and/or install them.
However, this daemon is bad for a server, since it doesn't run at a fixed time - I really don't want my server downloading and updating software during the busiest time of day thank-you-very-much!
So, it's bad for a server. Let's disable it with:
service yum-updatesd stop chkconfig --level 2345 yum-updatesd off
Plus I don't like the idea of having a full blown daemon where a simple cronjob will do the trick perfectly fine - seems like overkill. (although it appears yum-updatesd has some useful features like dbus integration for desktop users)
So, I replace it with my favorite cronjob script approach, by running the following (as root of course):
cat << "EOF" > /etc/cron.daily/yumupdate #!/bin/sh # install any yum updates /usr/bin/yum -R 10 -e 0 -d 1 -y update yum > /var/log/yum.cron.log 2>&1 /usr/bin/yum -R 120 -e 0 -d 1 -y update >> /var/log/yum.cron.log 2>&1 if [ -s /var/log/yum.cron.log ]; then /bin/cat /var/log/yum.cron.log | mail root -s "Yum update information" 2>&1 fi EOF
and if you want to clear up the package cache every week:
cat << "EOF" > /etc/cron.weekly/yumclean #!/bin/sh # remove downloaded packages /usr/bin/yum -e 0 -d 0 clean packages EOF
(please excuse the leading space infront of the comments ( #) - it is to work around a limitation in my site, which I will fix shortly. Just copy the lines into a text editor and remove the space, before pasting into the terminal)
This will install 2 scripts that get run around 4:00am (as set in /etc/crontab) which will check for updates and download and install any automatically. If there were any updates, it will send out an email, if there were none, it doesn't send anything.
(of course, you need sendmail/whatever_fucking_email_server_you_like configured correctly to get the alerts!)
You can change yum to just download and not install the updates (just RTFM), but I've never had a update break anything - update compatibility and quality is always very high - so I use automatic updates.
CentOS 4 had something very similar to this, with the addition of a bootscript to turn the cronjobs on and off.
* Please check out the update at the bottom of this page for futher information on this.
Apache Quirks
If you are using indexing in apache (indexing is when you can browse folders/files), you may find that the browsing page looks small and nasty.
The fix is to edit /etc/httpd/conf/httpd.conf and change the following line:
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTableto
IndexOptions FancyIndexing VersionSort NameWidth=*
This should make the index full screen again. I'm not sure if this is an apache bug, a distro bug or some other weird issue, because I'm sure HTMLTable isn't supposed to be all small like that.
(FYI: CentOS 4 did not have the HTMLTable option active)
SSL Certificates
Redhat have moved things around with SSL certificates a lot. What it seems like happened (I have only had a quick look into this), is that they were going to provide a new tool to generate SSL certificates called "genkey" but pulled it out before release.
To make things more fun, they also removed the good old Makefile that was in /etc/httpd/conf/ that allowed you to generate SSL certificates & keys.
However, I found the same Makefile again in /etc/pki/tls/certs/
Vi vs. Vim
If you use vi/vim, you should check this posting out.
That's all the issues that I've come across for now - if I find any more things to note, I'll update this page with the information and put a note on my blog.
Note the NETMASK should be defined in /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/networkThe /etc/sysconfig/network file is used to specify information about the desired network configuration. The following values may be used:
- NETWORKING=<value>, where <value> is one of the following boolean values:
- yes — Networking should be configured.
- no — Networking should not be configured.
- HOSTNAME=<value>, where <value> should be the Fully Qualified Domain Name (FQDN), such as hostname.expample.com, but can be whatever hostname is necessary.
Note
For compatibility with older software that some users may need to install, such as trn, the /etc/HOSTNAME file should contain the same value as set here.
- GATEWAY=<value>, where <value> is the IP address of the network's gateway.
- GATEWAYDEV=<value>, where <value> is the gateway device, such as eth0.
- NISDOMAIN=<value>, where <value> is the NIS domain name.
# tune2fs -l /dev/mapper/vg00-lv06
tune2fs 1.38 (30-Jun-2005)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: c0615eba-5bb6-443d-81c7-7f3c1eb829b2
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal filetype needs_recovery sparse_super
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 1310720
Block count: 2621440
Reserved block count: 131072
Free blocks: 2365370
Free inodes: 1309130
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16384
Inode blocks per group: 512
Filesystem created: Mon May 21 11:16:17 2007
Last mount time: Tue May 6 17:40:40 2008
Last write time: Tue May 6 17:40:40 2008
Mount count: 3
Maximum mount count: 500
Last checked: Thu Apr 3 11:51:39 2008
Check interval: 5184000 (2 months)
Next check after: Mon Jun 2 11:51:39 2008
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
Default directory hash: tea
Directory Hash Seed: 36a54cdf-3f8e-482b-9e2c-a48b6ac1d27e
Journal backup: inode blocks
About:
Expect-lite is a wrapper for expect, created to make expect programming even easier. The wrapper permits the creation of expect script command files by using special character(s) at the beginning of each line to indicate the expect-lite action. Basic expect-lite scripts can be created by simply cutting and pasting text from a terminal window into a script, and adding '>' 'Release focus: Major feature enhancements
Changes:
The entire command script read subsystem has changed. The previous system read directly from the script file. The new system reads the script file into a buffer, which can be randomly accessed. This permits looping (realistically only repeat loops). Infinite loop protection has been added. Variable increment and decrement have been added to support looping.Author:
Craig Miller [contact developer]
September 21, 2007 | Linux.com
Nowadays, many machines are running with 2-4 gigabytes of RAM, and their owners are discovering a problem: When they run 32-bit GNU/Linux distributions, their extra RAM is not being used. Fortunately, correcting the problem is only a matter of installing or building a kernel with a few specific parameters enabled or disabled.The problem exists because 32-bit Linux kernels are designed to access only 1GB of RAM by default. The workaround for this limitation is vaguely reminiscent of the virtual memory solution once used by DOS, with a high memory area of virtual memory being constantly mapped to physical addresses. This high memory can be enabled for up to 4GB by one kernel parameter, or up to 64GB on a Pentium Pro or higher processor with another parameter. However, since these parameters have not been needed on most machines until recently, the standard kernels in many distributions have not enabled them.Increasingly, many distributions are enabling high memory for 4GB. Ubuntu default kernels have been enabling this process at least since version 6.10, and so have Fedora 7's. By contrast, Debian's default 486 kernels do not. Few distros, if any, enable 64GB by default.
To check whether your kernel is configured to use all your RAM, enter the command
free -m. This command gives you the total amount of unused RAM on your system, as well as the size of your swap file, in megabytes. If the total memory is 885, then no high memory is enabled on your system (the rest of the first gigabyte is reserved by the kernel for its own purposes). Similarly, if the result shows over 1 gigabyte but less than 4GB when you know you have more, then the 4GB parameter is enabled, but not the 64GB one. In either case, you will need to add a new kernel to take full advantage of your RAM.
eval `dircolors ~/.dir_colors`
alias ls="ls --color=auto"
The command 'dircolors' takes its data from the file ~/.dir_colors and
creates an environment variable LS_COLORS. The command 'ls --color' takes
its colors from the environmental variable LS_COLORS.
So, write a suitable ~/.dir_colors file, and execute the command
'dircolors'. To get a starting file for editing, do this:
dircolors -p > ~/.dir_colors
The ~/.dir_colors file so created includes directions on coding the colors
for different kinds of files.
See man dircolors.
You need to unclick:
/apps/panel/applets/windows_list_screen/pref/display_in_all_workspaces
... Have you heard of the magic SysRq key?
No?
Well, it’s magic. It’s directly shunted to the Linux kernel. You press ALT, press the PrintScreen (SysRq) key, and while holding them both down, press one of the letters (each letter has a different function assigned to it).
It’s not normally enabled, but you can enable it by putting
kernel.sysrq = 1in your machine’s
/etc/sysctl.conffile. Oh, and then rebooting.Here’s why it’s useful.
So, what does SysRq do, really?
Hit Alt+SysRq+K — the windowing system will restart. More effective than Ctrl+Alt+Backspace.Suppose a GUI application you just opened is starting to swallow massive amounts of RAM. Like, one gigabyte, perhaps? Your machine is locking up, and you feel the mouse start to stutter at first, then freeze completely — while the hard disk light in your computer’s front panel is lighting up frantically, gasping for
airmemory.You now have three choices:
- Sit it out and let the Linux kernel detect this situation and kill the abusive application. This can take way more than 15 minutes.
- Press the computer’s power off button for 5 seconds. This shuts your machine down uncleanly and leads to data loss.
- Hit the magic SysRq combo: Alt+SysRq+K.
Should you choose option 3, the graphical subsystem dies immediately. That’s because Alt+SysRq+K kills any application that holds the keyboard open — and, you guessed it, the graphical subsystem is holding it open. This premature death of the GUI causes all GUI applications to die in a cascade, including the abusive application.
Two to ten seconds later, you will be presented with a login prompt.
Sure, you lost changes to all files you haven’t saved, and all the tabs in your Web browser… but at least you didn’t have to reboot uncleanly, did you?
But, Ctrl+Alt+Backspace?
Once the machine is in a critically heavy memory crunch, Ctrl+Alt+Backspace will take too much time to work, because the windowing system will be pressed for memory to even execute. The magic SysRq key has the luxury of not having that problem
— if Ctrl+Alt+Backspace were an IV drip, SysRq would be like a central line.
Why this key combination exists
The reason this key combo exists is simple. Alt+SysRq+K is called SAK (System Attention Key). It was designed back in the days of, um, yore, to kill all applications snooping on the keyboard — so administrators wishing to log in could safely do so without anyone sniffing their passwords.
As a preventative security measure, it sure works against keyloggers and other malware that may be snooping on your keyboard, may I say. And it most definitely works against your run-of-the-mill temporary memory shortage ;-).
Advantages/disadvantages
Well, the major disadvantages are:
- Anyone with keyboard access can reboot or hang your machine using a SysRq key combination.
- Once you hit it, since the GUI dies, all of your open applications close, forcibly.
But, on a memory crunch, this beats rebooting hands-down. And that’s the biggest advantage.
The Linux Tips HOWTO v3.6, June 1998 by Paul Anderson
Tips, Tricks, How-To from Fermilab.
Linux Tips Think of this as the LSADP (LinuxSA Documentation Project).
Linux Tips collection from Mike Chirico
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Last updated: August 15, 2009