Breaking News

Transcend's New ESD420 Portable SSD Offers MagSafe Compatibility and Pro-Level Performance G.SKILL Trident Z5 DDR5 Memory and WigiDash Receives European Hardware Awards 2025 Silicon Power Launches WP10 Magnetic Wireless Power Bank Razer Unveils the Ultra-Lightweight DeathAdder V4 Pro Sony launches a high-resolution shotgun microphone with superior sound quality and compact design.

logo

  • Share Us
    • Facebook
    • Twitter
  • Home
  • Home
  • News
  • Reviews
  • Essays
  • Forum
  • Legacy
  • About
    • Submit News

    • Contact Us
    • Privacy

    • Promotion
    • Advertise

    • RSS Feed
    • Site Map

Search form

Linux tips and tricks

Feb 7,2007 0

Key combinations to impress your friends

You probably know key combinations like Ctrl-C or Ctrl-Z. You'd be surprised to learn that there are quite a few more useful key combinations that you probably haven't heard of. Here are a few to keep in mind when working at the console (note: most of these should also work under Konsole or other GUI console applications):

  1. Ctrl-C (usually) sends the kill signal, which terminates a process abruptly.

  2. Ctrl-Z sends the stop signal, which stops process execution immediately, without terminating. Use “fg” or “bg” after that to restart the process of send it to the background. Ctrl-Y is an interesting variant, which stops process execution only when the process tries to read user input from the console.

  3. Ctrl-S is the scroll lock: when you have too much output scrolling quickly, you can use Ctrl-S to stop process output. You can then use Shift-PageUp/PageDown to scroll up and down and read it. Ctrl-Q resumes. Technically speaking, Ctrl-S and Ctrl-Q send the XON/XOFF terminal commands, that may be ignored in some cases. The Bash shell translates Ctrl-S to “search”, so it depends on where you are working.

  4. Ctrl-L clears the screen and positions the prompt at the top left corner. Use this if your screen has become garbled.

  5. Ctrl-A and Ctrl-E take you to the beginning and the end of the line, respectively. Home and End also work, but not always.

  6. Alt-F and Alt-B take you to the next or previous word, very useful if you're typing a long sequence of commands or a command with many arguments.

  7. Tab is probably the most useful key when using the shell. Tab will do filename completion, but also hostname completion, variable name completion and other useful things.

The X-Windows environment

There are a few key combinations that work under the X-windows server, regardless of whether you are under KDE or Gnome (or any other environment, for that matter):

  1. Ctrl-Alt-F1/F2... : switch to the corresponding character virtual console. This is meaningful only if you are running under the appropriate init level, otherwise you won't find a login prompt. You will need Alt-F7 to get back to X-windows (this depends on the kernel settings for the number of virtual consoles, could also be Alt-F9 or Alt-F11, for example).

  2. Ctrl-Alt-Backspace : Kill the X-server

  3. Ctrl-Alt- + or - : Cycle between resolutions, according to the xf86config file. You need to have multiple resolutions defined in your config file for this to work.

The Magic SysRq key

You need to enable the magic SysRq key during compilation of the kernel. Some distributions enable it by default. Otherwise you can simply compile the kernel yourself (easier than it seems, trust me) after enabling it under “Kernel Hacking”.

Once you have the SysRq key enabled, the following keystrokes will work (more can be found in the kernel documentation) :

  1. Alt-SysRq-S: emergency sync, tries to write all unsaved buffers

  2. Alt-SysRq-U: emergency remount read only for all file systems

  3. Alt-SysRq-E: send the terminate (15) signal to all processes except init

  4. Alt-SysRq-I: send the kill (9) signal to all processes except init

  5. Alt-SysRq-B: emergency IMMEDIATE reboot (unsafe, like pressing the reset button!)

  6. Alt-SysRq-K: emergency kill of all programs under the virtual console

When the system crashes, emergency sync, remount and reboot are a convenient way to ensure a relatively safe system reboot. The following sequence best emulates a normal software reboot : Alt-SysRq-S, 5 sec pause, Alt-SysRq-E, 5 sec pause, Alt-SysRq-S, 5 sec pause, Alt-SysRq-I, Alt-SysRq-S, 5 sec pause, Alt-SysRq-U, Alt-SysRq-B (the pauses and multiple syncs are a bit excessive, but better safe than sorry). If a console crashes really bad, emergency kill may remedy the situation and get you back to a login prompt.

Note that these commands are immediate and potentially unsafe, so only use as a last resort before doing a real hardware reset or something equally drastic. Also, bear in mind that the magic sysrq key can be used as a denial-of-service attack by malicious hackers/crackers, so don't enable it in servers that are particularly vulnerable and exposed to such threats.

Quitting Vim/Vi

I remember playing with various linux commands and applications back in the days when I was beginning to use linux. One of the most annoying ways to get stuck was inside the Vi/Vim editor, that captures the Ctrl-C and Ctrl-Z keystrokes. Although I'm sure there are several readers who think that Vi is the best thing since sliced bread, most people should just know how to exit, in case they accidentally get trapped inside it. Simply type “:q!”, without the quotation marks, of course.

Conclusion

So many things, so little time. Although the examples given above may at first seem to be daunting, I think that every linux user should at least try to use them. After a while, these make life seem so much easier that it will be definitely worth it. That being said, if you only had to know ONE key, Tab would be it. Trust me on this...

PKT

Linux

Tags: Linux
Previous Post
LG GBW-H10N
Next Post
LITE-ON LH-20A1P

Related Posts

  • NVIDIA Accelerates Open Data Center Innovation

  • System76's Lemur Pro Linux Laptop Now Available

  • System76 Is Designing Its Own Keyboard

  • Microsoft Brings Microsoft Defender ATP to Linux, iOS and Android

  • Tuxedo Computers and Manjaro Team Up on New Linux Laptops

  • Huawei Unveils The openEuler CentOS-based Linux Distribution

  • Lazarus Group Targets Linux With New Malware

  • Microsoft Teams Available on Linux

Latest Reviews

Akaso 360 Action camera
Cameras

Akaso 360 Action camera

Crucial T710 2TB NVME SSD
PC components

Crucial T710 2TB NVME SSD

be quiet! Pure power 13M 750W
PC components

be quiet! Pure power 13M 750W

JSAUX 65Wh Rog Ally Battery
Gaming

JSAUX 65Wh Rog Ally Battery

Introducing PriceHub
Enterprise & IT

Introducing PriceHub

Popular News

COLORFUL Announces the Launch of the CVN Z790D5 ARK FROZEN Motherboard

COLORFUL Announces the Launch of the CVN Z790D5 ARK FROZEN Motherboard

AsRock, NZXT, Biostar and Gigabyte announces X870 motherboards

AsRock, NZXT, Biostar and Gigabyte announces X870 motherboards

COLORFUL Introduces CVN B850I GAMING FROZEN Motherboard

COLORFUL Introduces CVN B850I GAMING FROZEN Motherboard

COLORFUL Presents CVN X870 ARK FROZEN Motherboard for AMD Ryzen 9000 CPUs

COLORFUL Presents CVN X870 ARK FROZEN Motherboard for AMD Ryzen 9000 CPUs

COLORFUL Presents the B860 Series Motherboards

COLORFUL Presents the B860 Series Motherboards

COLORFUL, AsRock, NZXT, MSI announce Intel Z890 Motherboards

COLORFUL, AsRock, NZXT, MSI announce Intel Z890 Motherboards

Intel-AMD new motherboards announced

Intel-AMD new motherboards announced

COLORFUL Presents the COLORFIRE B650M-MEOW WIFI Motherboard, Supports AMD Ryzen 9000 Series CPUs

COLORFUL Presents the COLORFIRE B650M-MEOW WIFI Motherboard, Supports AMD Ryzen 9000 Series CPUs

Main menu

  • Home
  • News
  • Reviews
  • Essays
  • Forum
  • Legacy
  • About
    • Submit News

    • Contact Us
    • Privacy

    • Promotion
    • Advertise

    • RSS Feed
    • Site Map
  • About
  • Privacy
  • Contact Us
  • Promotional Opportunities @ CdrInfo.com
  • Advertise on out site
  • Submit your News to our site
  • RSS Feed