Linux

  1. Home
  2. Computing & Technology
  3. Linux

From Authors, for About.com

59 3B ; 91 5B [ 123 7B {

28 1C FS 60 3C < 92 5C \ '\\' 124 7C |

29 1D GS 61 3D = 93 5D ] 125 7D }

30 1E RS 62 3E > 94 5E ^ 126 7E ~

31 1F US 63 3F ? 95 5F _ 127 7F DEL

If you wondered about the control characters, here is the meaning of some of them on the console (Source: man console_codes). Each line below gives the code mnemonics, its ASCII decimal number, the key combination to produce the code on the console, and a short description:

BEL (7, <Ctrl>G) bell (=alarm, beep).

BS (8, <Ctrl>H) backspaces one column (but not past the beginning of the line).

HT (9, <Ctrl>I) horizonal tab, goes to the next tab stop or to the end of the line if there is no earlier tab stop.

LF (10, <Ctrl>J), VT (11, <Ctrl>K) and FF (12, <Ctrl>L) all three give a linefeed.

CR (13, <Ctrl>M) gives a carriage return.

SO (14, <Ctrl>N) activates the G1 character set, and if LF/NL (new line mode) is set also a carriage return.

SI (15, <Ctrl>O) activates the G0 character set.

CAN (24, <Ctrl>X) and SUB (26, <Ctrl>Z) interrupt escape sequences.

ESC (27, <Ctrl>[) starts an escape sequence.

DEL (127) is ignored.

CSI (155) control sequence introducer.


uniq

(=unique) Eliminate duplicate lines in sorted input. Example: sort myfile | uniq


fold -w 30 -s my_file.txt > new_file.txt

Wrap the lines in the text file my_file.txt so that there is 30 characters per line. Break the lines on spaces. Output goes to new_file.txt.


fmt -w 75 my_file.txt > new_file.txt

Format the lines in the text file to the width of 75 characters. Break long lines and join short lines as required, but don't remove empty lines.


nl myfile > myfile_lines_numbered

Number the lines in the file myfile. Put the output to the file myfiles_lines_numbered.


indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl "$@" *.c

Change the appearance of "C" source code by inserting or deleting white space. The formatting options in the above example conform to the style used in the Linux kernel source code (script /usr/src/linux/scripts/Lindent). See man indent for the description of the meaning of the options. The existing files are backed up and then replaced with the formatted ones.


rev filename > filename1

Print the file filename, each line in reversed order. In the example above, the output is directed to the file filename1.


shred filename

Repeatedly overwrite the contents of the file filename with garbage, so that nobody will ever be able to read its original contents again.


paste file1 file2 > file3

Merge two or more text files on lines using <Tab> as delimiter (use option "d=" to specify your own delimiter(s).

Example. If the content of file1 was:

1

2

3

and file2 was:

a

b

c

d

the resulting file3 would be:

1 a

2 b

3 c

d


join file1 file2 > file3

Join lines of two files on a common field. join parallels the database operation "join tables", but works on text tables. The default is to join on the first field of the first table, and the default delimiter is white space. To adjust the defauls, I use options which I find using man join).

Example. if the content of file1 was:

1 Barbara

2 Peter

3 Stan

4 Marie

and file2 was:

2 Dog

4 Car

7 Cat

the resulting file3 would be:

2 Peter Dog

4 Marie Car


des -e plain_file encrypted_file

(="Data Encryption Standard") Encrypt plain_file. You will be ask for a key that the program will use for encryption. Output goes to encrypted_file. To decrypt use

des -d encrypted_file decrypted_file.


gpg

"Gnu Privacy Guard"--a free equivalent of PGP ("Pretty Good Privacy"). gpg is more secure than

Explore Linux

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Linux

  1. Home
  2. Computing & Technology
  3. Linux

©2009 About.com, a part of The New York Times Company.

All rights reserved.