+ All Categories
Home > Technology > Unix Lec2

Unix Lec2

Date post: 21-May-2015
Category:
Upload: drravi
View: 811 times
Download: 0 times
Share this document with a friend
Popular Tags:
26
Unix Text Editing, Printing, and File Transfers
Transcript
Page 1: Unix Lec2

Unix Text Editing, Printing,

and File Transfers

Page 2: Unix Lec2

Text Files

• Most bioinformatics work involves messing around with text files.

• DNA and protein sequences, databases, results of similarity searches and multiple alignments are all stored on the computer as ordinary ASCII text files.

• To read, write, and edit these text files you must get familiar with a Text Editor program

Page 3: Unix Lec2

What is a Text Editor?

• A text editor is like a word processor on a personal computer, except that it does not apply formatting styles (bold, italics, different fonts etc.).

• Unix has line editors (view and edit one line at a time) and full screen editors.

• A screen editor loads an entire document into a buffer - allows you to jump to any point in the document.

Page 4: Unix Lec2

Unix Text Editors

• There are many different text editors available for Unix computers.– You can have multiple editors on one system

• vi - old, reliable, present on every Unix machine, completely and utterly user hostile

• jed - fairly simple, identical to eve on the old VMS system

• pico - extremely simple, perhaps too simple

• emacs - a good compromise between features and ease of use

Page 5: Unix Lec2

Emacs

• The full name of the Emacs program is: "GNU emacs, the Extensible, Customizable, Self-Documenting, Real-time Display Editor.”

• Emacs is free software produced by the Free Software Foundation (Boston, MA) and distributed under the GNU General Public License.– Open source software - Linux– GNU is an acronym for: “GNU is Not Unix”

Page 6: Unix Lec2

Starting emacs

• To start Emacs, at the > command prompt, just type: emacs

• To use Emacs to edit a file, type: emacs filename

(where filename is the name of your file)

• When Emacs is launched, it opens either a blank text window or a window containing the text of an existing file.

Page 7: Unix Lec2
Page 8: Unix Lec2

The Emacs Display• The display in Emacs is divided into three

basic areas. • The top area is called the text window. The text

window takes up most of the screen, and is where the document being edited appears.

• Below the text window, there is a single mode line (in reverse type). The mode line gives information about the document, and about the Emacs session.

• The bottom line of the Emacs display is called the minibuffer. The minibuffer holds space for commands that you give to Emacs, and displays status information.

Page 9: Unix Lec2

Emacs Commands

• Emacs uses Control and Escape characters to distinguish editor commands from text to be inserted in the buffer.

Control-x means to hold down the control key, and type the letter x.

(You don't need to capitalize the x, or any other control character)

[ESCAPE] x means to press the escape key down, release it, and then type x.

Page 10: Unix Lec2

Save & Exit• To save a file as you are working on it, type:

Control-x » Control-s• To exit emacs and return to the Unix shell,

type: Control-x » Control-cIf you have made any changes to the file, Emacs will ask you if you want to save:

Save file /u/browns02/nrdc.msf? (y,n,!,.,q,C-r or C-h)

• Type “y” to save your changes and exit

• If you type “n”, then it will ask again:

Modified buffers exist; exit anyway? (yes or no)

• If you answer “no”, then it will return you to the file, you must answer “yes” to exit without saving changes

Page 11: Unix Lec2

Moving Around• The arrow keys on the keyboard work for

moving around one line or one character at a time.

• Some navigation commands:• Move to the Top of the file: [Esc] <

• Move to the End of the file: [Esc] >

• Next screen (page down): Ctrl-v

• Previous screen (page up): [Esc] v

• Start of the current line: Ctrl-a

• End of the current line: Ctrl-e

• Forward one word: [Esc] f

• Backward one word: [Esc] b

Page 12: Unix Lec2

Type Text

• Once you move the cursor to the location in the file where you want to do some editing, you can just start typing - just like in an ordinary word processor.

• The delete key should work to remove characters and inserted text will push existing text over.

Page 13: Unix Lec2

Cut, Copy, and Paste• You can delete or move blocks of text.

– First move the cursor to the beginning (or end) of the block of text.

– Then set a mark with: Ctrl-spacebar– Now move to the other end of the block of text

and Delete or Copy the block:• Delete: Ctrl-w• Copy: [Esc] w

– To Paste a copied block, move to the new location and insert with : Ctrl-y

Page 14: Unix Lec2

Getting Help in Emacs

• Emacs has a built in help feature– Just type: Ctrl-h– To get help with a specific command,

type: Ctrl-h k keys(where “keys” are the command keys that you type for

that command)

• Emacs has a built in tutorial: Ctrl-h t• this will be the primary exercise for this week’s

computer lab.

Page 15: Unix Lec2

Emacs Help on the Web• Getting Started with Emacs

http://www.cs.ucl.ac.uk/teaching/supportdocs/emacs.htm– by Johnathon Poole,University College London, Dept. of Computer

Science

• LinuxCentral: Emacs Beginner's HOWTO http://linuxcentral.com/linux/LDP/HOWTO/Emacs-Beginner-HOWTO.html

• The official GNU Emacs Manual http://www.gnu.org/manual/emacs/html_chapter/emacs_toc.html

• Getting Started With the Emacs Screen Editorhttp://www.leeds.ac.uk/iss/documentation/beg/beg6.pdf

Page 16: Unix Lec2

Printing from Ranger• The Unix print command on Ranger is lpr -P filename

– lpr stands for “line printer”

– The -P option specifies the name of the printer• There are lots of printers on the network; you need to tell the computer

where to send your print job

• The command printers will give you a list of the currently available printers.

• This works fine for any text file. Printing graphics is a bit more complicated.– Many GCG programs produce graphical output: MapPlot,

PlasmidMap, DrawTree, PepPlot, PlotStructure, etc.

– GCG can produce graphics in many different formats.

– Postscript generally works best on our system

Page 17: Unix Lec2

GCG Figure Files

• Rather than directly printing graphical output from a GCG program, you should create a graphic file in a format known as GCG Figure format - a .fig file.

• For any program that creates graphic output, use the -fig command option:

plotstructure -fig mygene.pep

• Then transform the .fig file into a Postscript file with the figure program.

• Finally, print the postscript file with the lpr -P command.• You can also transfer the .fig file to a Macintosh computer

by FTP and then use the Mac program GCGFigure to view and print the image.

Page 18: Unix Lec2

Using the Batch Queue• GCG has a feature known as the Batch Queue that allows

large computing jobs to be completed more efficiently.– you don't have to wait for a batch program to finish in order to

continue with your work– it allows the system to better balance the workload of multiple users

• To run a GCG program in batch mode, type the program name followed by the -bat modifier like this:

> fasta -bat• When your batch job is finished, the system will notify you• Here is a list of the programs that can be run in batch mode

fasta framesearch paupsearch

tfasta framealign pileupfastx profilesearch comparetfastx stringsearch mfoldblast findpatterns primessearch coilscan wordsearch

Page 19: Unix Lec2

FTP• You will occasionally need to move files

between your RCR account and a desktop computer – put sequences in, get output files and graphics off

• Use FTP (File Transfer Protocol) to do this.

• On the Macintosh, Fetch is the best FTP program.

• On Windows machines, WS_FTP works well.

Page 20: Unix Lec2

FTP Login• When you open an FTP program, you connect

to mcrcr0 just as you would with a telnet client.

• Your username and password are the same.

Page 21: Unix Lec2

• You will automatically end up in your home directory.

• Put files from you PC to the server, Get files from the server to your desktop machine.

Page 22: Unix Lec2

Access to e-mail

• Many people receive DNA sequences by e-mail. – It would be convenient to access those e-mail messages

directly from a telnet session on Ranger and save them as text files in your account.

• We have set up the pine program to do this– pine is set up to connect to the popmail server– If you have a popmail account, just type pine and

then your password to connect– If you use an e-mail server other than

popmail.med.nyu.edu, you will need to get in touch with us to modify your PINE settings.

Page 23: Unix Lec2
Page 24: Unix Lec2

View Your Mail• Make sure to set your usual e-mail program

to “leave mail on server”

• Your recent mail messages will end up in your “Inbox”– connect to the mail server with pine and hit the

Return key a few times– Use the arrow keys to move to each message

and find the ones that you want to copy into your RCR account

Page 25: Unix Lec2
Page 26: Unix Lec2

Saving Mail Messages as Files• Hit the "E" key to "Export" a message and

save it as a file.

• When you get the message:

EXPORT: Copy message to file in home directory:

you should type in a name for the new file, then hit Return. – Repeat this for each mail message that you want

to copy to your RCR account

• Quit Pine by typing "Q"


Recommended