Table of Contents

Cool Linux Commands

script

Log my current session in the text terminal into a text file typescript (the default filename). The log finishes when I type exit or press <Ctrl>d.

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.

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.

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.

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).

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 PGP and does not use any patented algorithms. gpg is mostly used for signing your e-mail messages and checking signatures of others. You can also use it to encrypt/decrypt messages. http://www.gnupg.org/ contains all the details, including a legible, detailed manual

Resources

http://ss64.com/bash/

http://www.pixelbeat.org/cmdline.html