advertisement

Unix Lec2

40 %
60 %
advertisement
Information about Unix Lec2

Published on July 18, 2008

Author: Dr.Ravi

Source: slideshare.net

advertisement

Unix Text Editing, Printing, and File Transfers

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

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

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.

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.

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

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

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”

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”

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.

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.

 

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.

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.

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 .

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 .

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-c If 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

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-c

If 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

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

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

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.

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.

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

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

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.

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.

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 Editor http://www.leeds.ac.uk/iss/documentation/beg/beg6.pdf

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 Editor

http://www.leeds.ac.uk/iss/documentation/beg/beg6.pdf

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

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

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.

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.

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 pileup fastx profilesearch compare tfastx stringsearch mfold blast findpatterns prime ssearch coilscan wordsearch

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 pileup

fastx profilesearch compare

tfastx stringsearch mfold

blast findpatterns prime

ssearch coilscan wordsearch

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.

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.

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.

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.

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.

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.

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.

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.

 

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

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

 

Saving Mail Messages as Files Hit the &quot; E &quot; key to &quot;Export&quot; 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 &quot; Q &quot;

Hit the &quot; E &quot; key to &quot;Export&quot; 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 &quot; Q &quot;

Add a comment

Related pages

COP 3344-01 Introduction to Unix: Learning objectives and ...

COP 3344-01 Introduction to Unix: Lecture 2 Learning objectives. After this class, you should be able to: Use the following Unix command: cd, chmod, cp, ln ...
Read more

www-unix.ecs.umass.edu

&(')+*,).-/)+0,)1*,2435)6287:9;')<3=280;)6>?35@a240,9cb8de9f9c'>gdh4*f-i0,>g9;9;)+dj24kl9 mkl0;>?dlhn9;') Read more

UNIX Commands are Case Sensitive. CD does not mean the ...

Session 2, CSSS 506,Winter 2003, Glynn, page 2 In Class Exercise (we will use pico and modify the defaults for your unix sessions): Type the following ...
Read more

Processes and Threads - George Mason University Department ...

4 7 Process Hierarchies • Parent creates a child process, child processes can create its own process • Forms a hierarchy – UNIX calls this a "process ...
Read more

Operating Systems Engineering xv6 & page tables

15-Jun-14 3 5 OSE 2014 – xv6 & page tables (lec2) Case study: Unix v6 Early Unix OS for DEC PDP11 By Ken Thompson & Dennis Ritchie, 1975
Read more

COP 5570: Advanced Unix Programming - Florida State University

5570: Advanced Unix Programming Lectures Programming assignments. Assignment 1: http://www.cs.fsu.edu/~asriniva/courses/aup02/hws/hw1.html . Last modified ...
Read more

Lecture 2: Unix Overview - Computer Science | College of ...

Lecture 2: Unix Overview Background Material. Unix shell & commands; Reading. Chapter 3 of Silberschatz; Think Unix or Unix Programming Environment if ...
Read more

COS 318: Operating Systems - Computer Science Department ...

COS 318: Operating Systems Lecture 2: ... On Unix, “loader” does the job ... Lec2-IntroAndOverview Author: yunzhang
Read more