Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Unix Lec2


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Unix Lec2

  1. 1. Unix Text Editing, Printing, and File Transfers
  2. 2. Text Files <ul><li>Most bioinformatics work involves messing around with text files. </li></ul><ul><li>DNA and protein sequences, databases, results of similarity searches and multiple alignments are all stored on the computer as ordinary ASCII text files. </li></ul><ul><li>To read, write, and edit these text files you must get familiar with a Text Editor program </li></ul>
  3. 3. What is a Text Editor? <ul><li>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.). </li></ul><ul><li>Unix has line editors (view and edit one line at a time) and full screen editors. </li></ul><ul><li>A screen editor loads an entire document into a buffer - allows you to jump to any point in the document. </li></ul>
  4. 4. Unix Text Editors <ul><li>There are many different text editors available for Unix computers. </li></ul><ul><ul><li>You can have multiple editors on one system </li></ul></ul><ul><ul><ul><li>vi - old, reliable, present on every Unix machine, completely and utterly user hostile </li></ul></ul></ul><ul><ul><ul><li>jed - fairly simple, identical to eve on the old VMS system </li></ul></ul></ul><ul><ul><ul><li>pico - extremely simple, perhaps too simple </li></ul></ul></ul><ul><ul><ul><li>emacs - a good compromise between features and ease of use </li></ul></ul></ul>
  5. 5. Emacs <ul><li>The full name of the Emacs program is: &quot; GNU emacs, the Extensible, Customizable, Self-Documenting, Real-time Display Editor .” </li></ul><ul><li>Emacs is free software produced by the Free Software Foundation (Boston, MA) and distributed under the GNU General Public License. </li></ul><ul><ul><li>Open source software - Linux </li></ul></ul><ul><ul><li>GNU is an acronym for: “GNU is Not Unix” </li></ul></ul>
  6. 6. Starting emacs <ul><li>To start Emacs , at the > command prompt, just type: emacs </li></ul><ul><li>To use Emacs to edit a file, type: </li></ul><ul><ul><li> emacs filename </li></ul></ul><ul><ul><li>(where filename is the name of your file) </li></ul></ul><ul><li>When Emacs is launched, it opens either a blank text window or a window containing the text of an existing file. </li></ul>
  7. 8. The Emacs Display <ul><li>The display in Emacs is divided into three basic areas. </li></ul><ul><ul><ul><li>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. </li></ul></ul></ul><ul><ul><ul><li>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. </li></ul></ul></ul><ul><ul><ul><li>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. </li></ul></ul></ul>
  8. 9. Emacs Commands <ul><li>Emacs uses Control and Escape characters to distinguish editor commands from text to be inserted in the buffer. </li></ul><ul><ul><li>Control-x means to hold down the control key, and type the letter x . </li></ul></ul><ul><ul><li>(You don't need to capitalize the x , or any other control character) </li></ul></ul><ul><ul><li>[ESCAPE] x means to press the escape key down, release it, and then type x . </li></ul></ul>
  9. 10. Save & Exit <ul><li>To save a file as you are working on it, type: </li></ul><ul><li>Control-x » Control-s </li></ul><ul><li>To exit emacs and return to the Unix shell, type: Control-x » Control-c </li></ul><ul><ul><li>If you have made any changes to the file, Emacs will ask you if you want to save: </li></ul></ul><ul><li>Save file /u/browns02/nrdc.msf? (y,n,!,.,q,C-r or C-h) </li></ul><ul><ul><ul><li>Type “ y ” to save your changes and exit </li></ul></ul></ul><ul><ul><ul><li>If you type “ n ”, then it will ask again: </li></ul></ul></ul><ul><li>Modified buffers exist; exit anyway? (yes or no) </li></ul><ul><ul><ul><li>If you answer “ no ”, then it will return you to the file, you must answer “ yes ” to exit without saving changes </li></ul></ul></ul>
  10. 11. Moving Around <ul><li>The arrow keys on the keyboard work for moving around one line or one character at a time. </li></ul><ul><li>Some navigation commands: </li></ul><ul><ul><ul><li>Move to the Top of the file: [Esc] < </li></ul></ul></ul><ul><ul><ul><li>Move to the End of the file: [Esc] > </li></ul></ul></ul><ul><ul><ul><li>Next screen (page down): Ctrl-v </li></ul></ul></ul><ul><ul><ul><li>Previous screen (page up): [Esc] v </li></ul></ul></ul><ul><ul><ul><li>Start of the current line: Ctrl-a </li></ul></ul></ul><ul><ul><ul><li>End of the current line: Ctrl-e </li></ul></ul></ul><ul><ul><ul><li>Forward one word: [Esc] f </li></ul></ul></ul><ul><ul><ul><li>Backward one word: [Esc] b </li></ul></ul></ul>
  11. 12. Type Text <ul><li>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. </li></ul><ul><li>The delete key should work to remove characters and inserted text will push existing text over. </li></ul>
  12. 13. Cut, Copy, and Paste <ul><li>You can delete or move blocks of text. </li></ul><ul><ul><li>First move the cursor to the beginning (or end) of the block of text. </li></ul></ul><ul><ul><li>Then set a mark with: Ctrl-spacebar </li></ul></ul><ul><ul><li>Now move to the other end of the block of text and Delete or Copy the block: </li></ul></ul><ul><ul><ul><li>Delete: Ctrl-w </li></ul></ul></ul><ul><ul><ul><li>Copy: [Esc] w </li></ul></ul></ul><ul><ul><li>To Paste a copied block, move to the new location and insert with : Ctrl-y </li></ul></ul>
  13. 14. Getting Help in Emacs <ul><li>Emacs has a built in help feature </li></ul><ul><ul><li>Just type: Ctrl-h </li></ul></ul><ul><ul><li>To get help with a specific command, type: Ctrl-h k keys </li></ul></ul><ul><ul><ul><li>(where “keys” are the command keys that you type for that command) </li></ul></ul></ul><ul><li>Emacs has a built in tutorial: Ctrl-h t </li></ul><ul><ul><ul><li>this will be the primary exercise for this week’s computer lab. </li></ul></ul></ul>
  14. 15. Emacs Help on the Web <ul><li>Getting Started with Emacs </li></ul><ul><ul><li> </li></ul></ul><ul><ul><ul><ul><li>by Johnathon Poole,University College London, Dept. of Computer Science </li></ul></ul></ul></ul><ul><li>LinuxCentral: Emacs Beginner's HOWTO </li></ul><ul><li>http ://linuxcentral .com/linux/LDP/HOWTO/Emacs-Beginner-HOWTO.html </li></ul><ul><li>The official GNU Emacs Manual </li></ul><ul><li> </li></ul><ul><li>Getting Started With the Emacs Screen Editor </li></ul><ul><li> </li></ul>
  15. 16. Printing from Ranger <ul><li>The Unix print command on Ranger is lpr -P filename </li></ul><ul><ul><li>lpr stands for “line printer” </li></ul></ul><ul><ul><li>The -P option specifies the name of the printer </li></ul></ul><ul><ul><ul><li>There are lots of printers on the network; you need to tell the computer where to send your print job </li></ul></ul></ul><ul><li>The command printers will give you a list of the currently available printers. </li></ul><ul><li>This works fine for any text file. Printing graphics is a bit more complicated. </li></ul><ul><ul><li>Many GCG programs produce graphical output: MapPlot , PlasmidMap, DrawTree, PepPlot, PlotStructure , etc. </li></ul></ul><ul><ul><li>GCG can produce graphics in many different formats. </li></ul></ul><ul><ul><li>Postscript generally works best on our system </li></ul></ul>
  16. 17. GCG Figure Files <ul><li>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. </li></ul><ul><li>For any program that creates graphic output, use the -fig command option: </li></ul><ul><ul><ul><li>plotstructure -fig mygene.pep </li></ul></ul></ul><ul><li>Then transform the .fig file into a Postscript file with the figure program. </li></ul><ul><li>Finally, print the postscript file with the lpr -P command. </li></ul><ul><li>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. </li></ul>
  17. 18. Using the Batch Queue <ul><li>GCG has a feature known as the Batch Queue that allows large computing jobs to be completed more efficiently. </li></ul><ul><ul><li>you don't have to wait for a batch program to finish in order to continue with your work </li></ul></ul><ul><ul><li>it allows the system to better balance the workload of multiple users </li></ul></ul><ul><li>To run a GCG program in batch mode, type the program name followed by the -bat modifier like this: </li></ul><ul><li>> fasta -bat </li></ul><ul><li>When your batch job is finished, the system will notify you </li></ul><ul><li>Here is a list of the programs that can be run in batch mode </li></ul><ul><li>fasta framesearch paupsearch </li></ul><ul><li>tfasta framealign pileup </li></ul><ul><li>fastx profilesearch compare </li></ul><ul><li>tfastx stringsearch mfold </li></ul><ul><li>blast findpatterns prime </li></ul><ul><li>ssearch coilscan wordsearch </li></ul>
  18. 19. FTP <ul><li>You will occasionally need to move files between your RCR account and a desktop computer </li></ul><ul><ul><li>put sequences in, get output files and graphics off </li></ul></ul><ul><li>Use FTP ( File Transfer Protocol ) to do this. </li></ul><ul><li>On the Macintosh, Fetch is the best FTP program. </li></ul><ul><li>On Windows machines, WS_FTP works well. </li></ul>
  19. 20. FTP Login <ul><li>When you open an FTP program, you connect to mcrcr0 just as you would with a telnet client. </li></ul><ul><li>Your username and password are the same. </li></ul>
  20. 21. <ul><li>You will automatically end up in your home directory. </li></ul><ul><li>Put files from you PC to the server, Get files from the server to your desktop machine. </li></ul>
  21. 22. Access to e-mail <ul><li>Many people receive DNA sequences by e-mail. </li></ul><ul><ul><li>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. </li></ul></ul><ul><li>We have set up the pine program to do this </li></ul><ul><ul><li>pine is set up to connect to the popmail server </li></ul></ul><ul><ul><li>If you have a popmail account, just type pine and then your password to connect </li></ul></ul><ul><ul><li>If you use an e-mail server other than , you will need to get in touch with us to modify your PINE settings. </li></ul></ul>
  22. 24. View Your Mail <ul><li>Make sure to set your usual e-mail program to “leave mail on server” </li></ul><ul><li>Your recent mail messages will end up in your “Inbox” </li></ul><ul><ul><li>connect to the mail server with pine and hit the Return key a few times </li></ul></ul><ul><ul><li>Use the arrow keys to move to each message and find the ones that you want to copy into your RCR account </li></ul></ul>
  23. 26. Saving Mail Messages as Files <ul><li>Hit the &quot; E &quot; key to &quot;Export&quot; a message and save it as a file. </li></ul><ul><li>When you get the message: </li></ul><ul><li>EXPORT: Copy message to file in home directory: </li></ul><ul><li>you should type in a name for the new file, then hit Return . </li></ul><ul><ul><li>Repeat this for each mail message that you want to copy to your RCR account </li></ul></ul><ul><li>Quit Pine by typing &quot; Q &quot; </li></ul>