6.7 Viewing and editing files

cat filename | more

View the content of a text file called "filename", one page a time. The "|" is the "pipe" symbol (on many American keyboards it shares the key with "\"). more makes the output stop after each screen-full. For long files, it is sometimes convenient to use the commands head and tail that display just the beginning and the end of the file, or less that enables scrolling up and down. If you happened to use cat a binary file and your terminal displays funny characters afterwards, you can restore it with the command reset.


cat filename | less

less filename

(two commands, use either) Scroll a content of a text file. Press q when done. "less" is roughly an equivalent to "more" , the command you know from DOS, but often "less" is more convenient than "more" because it lets me scroll both up and down.


head filename

Print first 10 lines of the (long) text file.


tail filename

Print last 10 lines of a long or growing text file. Use tail -f filename for tail to follow the file as it grows--really handy for continuing inspection of log files.


pico filename

Edit a text file using the simple and standard text editor called pico. Use <Ctrl>x to exit. There are many text editors for Linux, including several GUI-based. A brand new clone of pico (GPLed) is nano.


pico -w filename

Edit a text file, while disabling the long line wrap. Handy for editing configuration files, e.g. /etc/fstab.


kwrite

(in X terminal) Very nice, "advanced text editor". Supports vertical text selection!


kate

kedit

gedit

(in X terminal). Simple yet nice text editors (GUI based).


gxedit

(in X terminal) Another multi-purpose, feature packed text editor. This one even has timed backup.


latte

(in X terminal) "Code" editor, i.e., plain text editor meant for writing programs.


nedit

(in X terminal) Another programmer editor. Very nice and loaded.


bluefish

(in X terminal) html editor (source with syntax highlighting and maaaany tools and options).


ispell filename

Spell check an ASCII text file. AbiWord, WordPerfect, StarOffice and other word processors come with "as-you-type" spell-checking, so you really don't have to worry about the simple ispell unless you need it. Newer Linux distributions (e.g., RH7.0) contain an improved spell-checking module called aspell, yet the above command will still work.


look thermo

Look up the dictionary on your system (/usr/share/dict/words) for words which start with "thermo".


wvHtml ms_word_document.doc > filename.html

Convert a MS Word document to the html file format.



UNIXguide.net
Suggest a Site