Saturday, October 17, 2009

Control Characters in Linux and shell script

Control characters are used to change the behavior of the terminal or text display. A control character is the key combination of CTRL+ KEY.
The following is the list of control characters are used in linux and shell script. Along with the control characters it is also listed their function.

1)CTRL+A: On the command line CTRL+A moves cursor to beginning of line of text.

2)CTRL+B: On the command line CTRL+B moves cursor backward by one place. Just like backspace work but does not delete any letter.

3)CTRL+C: CTRL+C terminate a foreground job. Works as break operation.

4)CTRL+D: CRTL+D from command line is just log out from a shell. CTRL+D also acts as EOF (End of File.) For example if we type cat >test.txt then we can type something in the file, whenever finish typing pressing CTRL+D terminates input from stdin and save the file and exit from the writing.

5)CTRL+E: Pressing CTRL+E on the command line moves cursor to end of line of text.

6)CTRL+F: Pressing CTRL+F on the command line moves cursor forward one character position.

7)CTRL+G: Preesing CTRL+G is for BEL. On some old-time teletype terminals, this would actually ring a bell.

8)CTRL+H: CTRL+H is destructive backspace. It erases characters the cursor backs over while backspacing.

9)CTRL+I: Horizontal tab.

10)CTRL+J: Newline (line feed). In a script, it may also be expressed in octal notation -- '\012' or in hexadecimal -- '\x0a'.

11)CTRL+K: Vertical tab. It behaves differently in command line and within script.

12)CTRL+L: Formfeed (clear the terminal screen). In a terminal, this has the same effect as the clear command.

13)CTRL+M: Carriage return.

14)CTRL+N: On the command line CTRL+N erases a line of text recalled from history buffer.

15)CTRL+O: Issues a newline on the command-line.

16)CTRL+P: Recalls last command from history buffer on the command-line.

17)CTRL+Q: CTRL+Q do resume job. This resumes stdin in a terminal.

18)CTRL+R: Backwards search for text in history buffer on the command-line.

19)CTRL+S: Suspend. This freezes stdin in a terminal. (Use Ctl-Q to resume job.)

20)CTRL+T: Reverses the position of the character the cursor is on with the previous character on the command-line.

21)CTRL+U: Erase a line of input, from the cursor backward to beginning of line. In some settings, CTRL+U erases the entire line of input, regardless of cursor position.

22)CTRL+V: When inputting text, CTRL+V permits inserting control characters. CTRL+V is primarily useful from within a text editor.

23)CTRL+W: When typing text on the console or in an xterm window, CTRL+W erases from the character under the cursor backwards to the first instance of whitespace. In some settings, CTRL+W erases backwards to first non-alphanumeric character.

24)CTRL+X: In certain word processing programs, Cuts highlighted text and copies to clipboard.

25)CTRL+Y: Pastes back text previously erased (with Ctl-K or Ctl-U).

26)CTRL+Z: Pauses a foreground job. Substitute operation in certain word processing applications. This behaves EOF (end-of-file) character in the MSDOS filesystem.

No comments:

Post a Comment