{"id":817,"date":"2019-01-25T20:46:51","date_gmt":"2019-01-25T20:46:51","guid":{"rendered":"https:\/\/www.science.smith.edu\/sawlab\/?page_id=817"},"modified":"2019-01-28T17:33:35","modified_gmt":"2019-01-28T17:33:35","slug":"command-line-tutorial_4","status":"publish","type":"page","link":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/","title":{"rendered":"Command Line Tutorial"},"content":{"rendered":"<p>Let&#8217;s go back to the files that include sequences from Brugia. If you don&#8217;t remember which these were, use <strong>grep<\/strong> and the wildcard <strong>*<\/strong> to get that information.<\/p>\n<p>We have them now in three separate files, but maybe we want to look at them all together, or have a single file to give to a program like SeaView or Blast.  The fasta format can hold multiple sequences, as long as they each start with a line that has a &gt; plus the sequence identifier, followed by a carriage return and the sequence data.  For example:<\/p>\n<p>&gt;seq_1<br \/>\nCAGCTAGTCGATGCTAGCTAGCTAGTCGAGC<br \/>\n&gt;seq_2<br \/>\nGCTAGCTAGCTAGCTAGCTAGCTGATCGATG<\/p>\n<p>Let&#8217;s make a single fasta file that contains the three Brugia sequences.  The <strong>cat<\/strong> command will concatenate multiple files into one.  It&#8217;s syntax is <\/p>\n<p>cat (list of files separated by a space) &gt; (name of output file)<\/p>\n<p>The parentheses are for clarity &#8211; don&#8217;t type them!<\/p>\n<p>So try&#8230;<\/p>\n<p><code>cat KP760414.fasta KP760415.fasta KP760416.fasta &gt; brugia.fasta<\/code><\/p>\n<p>This should make a new file called brugia.fasta with the three sequences in it.  <\/p>\n<blockquote><p><ins datetime=\"2019-01-25T21:32:41+00:00\">Use the <strong>more<\/strong> command we learned to look at all the sequences in the new file!<\/ins><\/p><\/blockquote>\n<p>One last important Unix command is <strong>rm<\/strong> for remove. Now that you have concatenated the three Brugia sequences, you don&#8217;t need the individual fastas anymore, and you want to avoid cluttering up your computer.  If you do bioinformatics, sooner or later you will run out of space on your computer, even if you have one with tons of storage.  The <strong>rm<\/strong> command is here to help!  Remember, the files we concatenated are KP760414.fasta, KP760415.fasta, and KP760416.fasta.  Type this into your terminal<\/p>\n<p><code>ls KP760414.fasta<\/code><\/p>\n<p>If you are pointing to the correct folder, the computer should print the file name back. That means it exists.  Now type<\/p>\n<p><code>rm KP760414.fasta<\/code><\/p>\n<p>and try the <strong>ls KP760414.fasta<\/strong> command again.  Here&#8217;s a neat trick &#8211; just hit the up arrow and you can scroll through all your previous commands.  When you find the one you want, hit return and it will run again!  If you run <strong>ls KP760414.fasta<\/strong> again you should see:<\/p>\n<p><code>ls: KP760414.fasta: No such file or directory<\/code><\/p>\n<p>This response means that the file KP760414.fasta no longer exists.  The <strong>rm<\/strong> command removed it.<\/p>\n<blockquote><p><ins datetime=\"2019-01-28T17:31:14+00:00\">Go ahead and remove the other two files that have Brugia sequences.<\/ins><\/p><\/blockquote>\n<p>The <strong>rm <\/strong>command can be a little dangerous, because it immediately removes the file from memory, unlike moving the file to the trash, so it can&#8217;t be recovered.  It is especially dangerous if you use it with the wildcard <strong>*<\/strong>.  Look at all the files in your directory with <strong>ls<\/strong>.  Then try:<\/p>\n<p>rm KP*<\/p>\n<p>Look at all the files in your directory with ls again &#8211; with one command you removed all the files that began with KP.  If you wanted to keep some of them, you would be out of luck!<\/p>\n<p>Now move into the parent directory of the Unix folder.  Do you remember how?<\/p>\n<p>Once you are there, you are in the Bioinformatics folder.  Type <strong>ls<\/strong> and see the Unix folder.  Type <strong>ls *<\/strong> to see all the files inside the Unix folder.   Try removing the Unix folder with:<\/p>\n<p><code>rm Unix<\/code><\/p>\n<p>You should get an message<\/p>\n<p>rm: Unix: is a directory<\/p>\n<p>and if you type ls you see that Unix is still there.  <strong>rm<\/strong> specifically removes files, but leaves directories alone.  This is a good safety measure, since you don&#8217;t want to accidentally remove a folder full of important files!  If you *really* want to remove a folder, there is an option for <strong>rm<\/strong>.  Adding the <strong>-r<\/strong> option (for recursive) will recursively remove all the files inside Unix, and then the Unix folder itself.  As you might imagine, this is dangerous and should only be used if you are quite sure you want to get rid of everything!  Try it now.<\/p>\n<p><code>rm -r Unix<\/code><\/p>\n<p>Try this code and look into your Bioinformatics folder.  Unix and all the files in it are now gone.  Now <strong>cd<\/strong> up one level and remove the Bioinformatics folder, too.<\/p>\n<p>Here is a list of all the commands you have learned:<\/p>\n<li>cd\n<li>mkdir\n<li>mv\n<li>cp\n<li>ls\n<li>man\n<li>unzip\n<li>more\n<li>tail\n<li>grep\n<li>cat\n<li>rm\n<li>and the shortcuts and wildcards \/ ~ . .. *\n<p>Now go find your own files to play with and have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s go back to the files that include sequences from Brugia. If you don&#8217;t remember which these were, use grep and the wildcard * to get that information. We have them now in three separate files, but maybe we want &hellip; <a href=\"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":73,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"class_list":["post-817","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Command Line Tutorial - The Williams Lab<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Command Line Tutorial - The Williams Lab\" \/>\n<meta property=\"og:description\" content=\"Let&#8217;s go back to the files that include sequences from Brugia. If you don&#8217;t remember which these were, use grep and the wildcard * to get that information. We have them now in three separate files, but maybe we want &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/\" \/>\n<meta property=\"og:site_name\" content=\"The Williams Lab\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-28T17:33:35+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/command-line-tutorial_4\\\/\",\"url\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/command-line-tutorial_4\\\/\",\"name\":\"Command Line Tutorial - The Williams Lab\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/#website\"},\"datePublished\":\"2019-01-25T20:46:51+00:00\",\"dateModified\":\"2019-01-28T17:33:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/command-line-tutorial_4\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/command-line-tutorial_4\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/command-line-tutorial_4\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Command Line Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/#website\",\"url\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/\",\"name\":\"The Williams Lab\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.science.smith.edu\\\/sawlab\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Command Line Tutorial - The Williams Lab","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/","og_locale":"en_US","og_type":"article","og_title":"Command Line Tutorial - The Williams Lab","og_description":"Let&#8217;s go back to the files that include sequences from Brugia. If you don&#8217;t remember which these were, use grep and the wildcard * to get that information. We have them now in three separate files, but maybe we want &hellip; Continue reading &rarr;","og_url":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/","og_site_name":"The Williams Lab","article_modified_time":"2019-01-28T17:33:35+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/","url":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/","name":"Command Line Tutorial - The Williams Lab","isPartOf":{"@id":"https:\/\/www.science.smith.edu\/sawlab\/#website"},"datePublished":"2019-01-25T20:46:51+00:00","dateModified":"2019-01-28T17:33:35+00:00","breadcrumb":{"@id":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.science.smith.edu\/sawlab\/command-line-tutorial_4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.science.smith.edu\/sawlab\/"},{"@type":"ListItem","position":2,"name":"Command Line Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.science.smith.edu\/sawlab\/#website","url":"https:\/\/www.science.smith.edu\/sawlab\/","name":"The Williams Lab","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.science.smith.edu\/sawlab\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/pages\/817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/comments?post=817"}],"version-history":[{"count":21,"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/pages\/817\/revisions"}],"predecessor-version":[{"id":849,"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/pages\/817\/revisions\/849"}],"wp:attachment":[{"href":"https:\/\/www.science.smith.edu\/sawlab\/wp-json\/wp\/v2\/media?parent=817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}