1 / 16

Running Linux on Windows via CYGWIN

Running Linux on Windows via CYGWIN. Why Linux and Not Windows? http://www.devx.com/opensource/Article/16969 http://www.computerhope.com/issues/ch000575.htm Comfort in the Linux Environment Learning Linux commands – Hands On Linux Exercise – File Manipulation Testing your knowledge

Download Presentation

Running Linux on Windows via CYGWIN

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Running Linux on Windows via CYGWIN • Why Linux and Not Windows?http://www.devx.com/opensource/Article/16969http://www.computerhope.com/issues/ch000575.htm • Comfort in the Linux Environment • Learning Linux commands – Hands On • Linux Exercise – File ManipulationTesting your knowledge • Things to Remember • Know: • Keep Challenged – While U Wait Try:

  2. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentStart Cygwin By double clicking the Cygwin Icon Cygwin TerminalYou can right click the icon above, select properties, and change the window appearance prior to start up  Know : Linux is case sensitive. Hello is not the same as HELLo

  3. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentThings you take for granted within a GUI:opening/closing/saving files deleting/creating/copying/moving filessearching for files or inside starting applications/adding parametersThings that can create bigger challengesopening extremely large files searching for occurrences viewing only portions of a file

  4. Running Linux on Windows via CYGWIN • Comfort in the Linux EnvironmentLinux Commands • pwd print working directory: where are you now? Response: /cydrive/c/Documents and Settings…man manual: see what’s out there • manpwd • Know : ‘q’ = quit: ‘b ‘ = back: hit spacebar = forward • Know : The terminal • is also called StandardOutput

  5. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux CommandsListing, Previewing, Manipulating files in Windows Know : GUI: Graphical User Interface (graphical environment for the user)

  6. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: ls, cd, mkdir ls list contents: take a look inside ls –a view everything even hidden filesls –l view ownership of filesls –1 list 1 (one) file per linels –nt* list all file names starting with nt  Try Now that you know some ls commands view “man ls” cd changes directory to a different location cd c:/ go to the c directory ( Try: pwd then ls to see what’s there)cd / go to your root directory ( Try: pwd then ls) mkdir will make a directorymkdirBioinfoHCS_Storagecreate 2 directories ( Try: ls to view) cd /Bioinfogo inside the Bioinfo directory just created above cd .. go backwards 1 level of directory (in this case, back to root /)

  7. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: cat (> & >>) cat create, join, append, view: You can do it all with cat and text files cat Cygwin.bat display contents of Cygwin.bat on the terminal windowCreate 2 files using ‘cat’ in FASTA format as shown below (CTRL D to save and quit)  Know : >> used to append to an already existing file. No example shown

  8. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: cat (concatenation, sort ) cat file1 display and confirm that file1 has the correct output cat file2 display and confirm that file2 has the correct outputcat file1 file2 combine and display both file1 and file2  Try: redirect output of file1 and file2 to file3 Now let’s take a look at sortsort file1 display sorted output of file1 sort file1 file2 display sorted output of file1 and file2 OUTPUT: Sequence names first, followed by sequences  Try: redirect sorted output to a file called mysort  Try: change a command’s name using ‘alias’:alias dog = “cat” remove dog command using ‘unalias’: unalias dog

  9. Running Linux on Windows via CYGWIN • Comfort in the Linux EnvironmentLinux Commands: cat (| pipe, sort, head) • cat file1 file2 | sort (combine then sort) • Output after sort • ‘>’ is considered a character before ‘A’ • ’|’ known as the pipe operator. Takes the output of one • command and feeds it into another. • Try: send sorted output to file called mysort • Create a file called name_only and write only the 6 seq names to it.First take a look at head…head -n 4 mysort: displays the head of a file. -n 4 means: show only 4 lineshead is most useful when viewing extremely large files

  10. Running Linux on Windows via CYGWIN • Comfort in the Linux EnvironmentLinux Commands: tail, head • Can you write only the sequences to a file called seq_only? • tail -n 4 mysort: displays from the end of a file. -n 4 means: show last 4 lines • Try: Visit the man pages, man sort and “reverse” the direction of a sort •  Know : Notice above –n 4: That’s adding “parameters” to the tail command. • Know : Want to learn more about cat? http://www.linfo.org/cat.html •                                • Remember that large sequence file, you will need it now. • Use …cat my_large_seq_file (see what happens) • head my_large_seq_file (how many lines do you see?) • tailmy_large_seq_file(how many lines do you see?) • Perhaps you need to see more of the file • HINT: Use head and the –n parameter. Choose how many lines you need to see

  11. Running Linux on Windows via CYGWIN • Comfort in the Linux EnvironmentLinux Commands: less • Try: Send 200 lines of my large sequence file to a file called lines_200 • less: the ability to see more • less my_large_seq_filebest way to controls viewing of large files • Navigation after the less command is similar to the man pages: • ‘q’ = quit: Page Up = up 1 page ‘b ‘ = back: Page Dn = down 1 page hit spacebar = forward Home = top & End = bottom • Know : Linux/Unix provides powerful commands that allow you to manipulate files of any size much easier than in the Windows environment. I can’t believe I said that •                              

  12. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: cpMake sure you are NOT in the Bioinfo directory cp file1 cp_file1: make a copy of file1 and call it cp_file1 WARNING! cp_file1 will be created and overwritten without warning Let’s visit the man pages, man cp and look at the “interactive” option cp file1 /Bioinfo: make a copy of file1 and place it in the Bioinfo directory  Try: list (ls) the contents of the Bioinfo directory without using cd cp file1 /Bioinfo/cp_test: copy file1 into the Bioinfo directory & call it cp_test

  13. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: mv, rm, rmdirmv /Bioinfo/cp_test /HCS_Storage: move cp_test from Bioinfo to HCS_Storage  Try: Move cp_test to HCS_Storage and give the file a new name: cp_test2 Know : Moving does NOT retain a copy of the file in its original location Know : The PATH refers to the location of the file, for example: /Bioinfo/cp_test means that cp_test is located in the Bioinfo directory Go to the HCS_Storage directory (cd ???). Remove the file cp_test rmcp_testremove the file cp_test from the hard drive Check to make sure the file cp_test is gone (ls) BEFORE YOU LEAVE THE HCS_Storage DIRECTORY MAKE SURE THERE IS A FILE IN IT. CREATE A FILE IF NEEDED.

  14. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: rm, rmdir1: Go to your root directory (cd ???). 2: Use pwd to make sure you are at the root level. Note: Response to pwd if at root level: /3: Make a duplicate of HCS_Storage (cp –r ??? ???). Call it HCS_Storage2 rmHCS_Storageremove the HCS_Storage directory (Error: HCS_Storage is a directory)rmdirHCS_Storageremove the HCS_Storage directory (Error: Failed to remove HCS_Storage)rm –r HCS_Storageremove directory and its contentsrm –ri HCS_Storage2 remove directory and its contents interactively Know : ‘/’ indicates the root or “top” level of the Linux file systemKnow : rmdir only removes directories that are empty. HCS_Storage has 1 file Know : rm only removes empty directories, unless the –r option is used

  15. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: grep grep finds text within a file 1: IMPORTANT: Copy of your seq file (cp) and add “cp_” to the beginning of the file name 2: Confirm the new file has some content (head) Using file1 and file2: Does the sequence TATA appear in file1?grep “TATA” file1 How about in file1 or file2?grep “TATA” file1 file2 What if you do not know whether the bases are upper or lower case grep -i “TatA” file1 file2How many matches I have but I am still concerned about the basesgrep -ic “TatA” file1 file2  Try: Can you find out how many sequences (entries) are in your file?

  16. Running Linux on Windows via CYGWIN Comfort in the Linux EnvironmentLinux Commands: Putting it all together1: Create 2 directories called Temp1 and Temp2. (mkdir) 2: In Temp2 directory and create a file called tempFile1 (cd, cat, ls)3: Make a duplicate of tempFile1 and call it tempFile2 (cat or cp)4: Move tempFile1 into directory Temp1 (mv) 5: Move tempFile2 into directory Temp1 but rename to new_tempfile2 (mv) 6: Confirm that Temp1 has 2 files and Temp2 has 0 files (cd, ls) 7: Remove the Temp2 directory (rmdir) 8: Remove the remove Temp1 directory (rm) 9: Write the first 30 lines of your large sequence file to sampleSeq (head, >) 10: Append the last 60 lines to sampleSeq (tail, >>)11: In sampleSeq, find a match any sequence string of your choice (grep) 12: Find the same sequence in both your large seq file and sampleSeq (grep) 13: Display only the total number of sequences you found in #12 (grep)

More Related