{"id":341,"date":"2019-01-05T22:58:45","date_gmt":"2019-01-05T22:58:45","guid":{"rendered":"https:\/\/s-oneill.com\/sov02\/?p=341"},"modified":"2019-01-08T21:00:47","modified_gmt":"2019-01-08T21:00:47","slug":"command-line-basics","status":"publish","type":"post","link":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/","title":{"rendered":"Command Line Basics"},"content":{"rendered":"\n<p>Drupal offers an excellent <a href=\"https:\/\/drupalize.me\/series\/command-line-basics-series\">set of videos<\/a> to walk you through cmd or command line basics for Unix\/Mac. Below are some notes from the first 3 videos. For <a href=\"https:\/\/commandwindows.com\/command3.htm\">check here for Dos\/Windows commands<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/drupalize.me\/videos\/moving-around-command-line\"><strong>Moving\nAround the Command Line<\/strong><\/a><\/h4>\n\n\n\n<p>From <a href=\"https:\/\/drupalize.me\/series\/command-line-basics-series\">https:\/\/drupalize.me\/series\/command-line-basics-series<\/a><\/p>\n\n\n\n<p>The cmd command line directory format:<br>    machine: ~ directory username<br><\/p>\n\n\n\n<p><strong>pwd <\/strong><br>Prints the current working directory (shows you where you are)<br>     \/Users\/addi<\/p>\n\n\n\n<p><strong>ls<\/strong><br> Displays a list of what is in the directory<\/p>\n\n\n\n<p><strong>ls -al<\/strong><br> List all (provides more details) does not seem to work on Windows.<br> items beginning with a<strong> d<\/strong> are directories<br> items beginning with a <strong>&#8211;<\/strong> are files<br> in linux, items beginning with a dot are hidden files<br> ls -al shows the hidden items<\/p>\n\n\n\n<p><strong>cd <\/strong><br>Change directory<br>You can type first letter of directory and hit tab for auto compete, if not show, hit tab again it will show list of options &#8211;  this is case sensitive. If you get lots of file results in ls, you can use piping, (|) this passes a command into another command. <br><\/p>\n\n\n\n<p><strong> pipe<\/strong><br> ls <strong>|<\/strong> less<br> pipe less command<br> shows things as pagination<br> space bar moves to next page<br> q quicks out of less<\/p>\n\n\n\n<p><strong>cd ..<\/strong><br>moves you back one to move back up directory<br>    cd drupal\/<br>    ls<br>    cd docs\/<br>    ls<br>    cd ..\/..<br> takes you up two directories\/<\/p>\n\n\n\n<p><strong>~<\/strong><br>or <strong> cd<\/strong><br>gets you back to home directory<br>    cd \/User\/addi\/drupal\/docs<br>can go to specific directory<br>    cd \/Applications<br>Using \/ can get you above the root directory <br>by starting with \/<\/p>\n\n\n\n<p><strong>man <\/strong><br>manual help<br>man pwd tell you help about pwd (not always work)<br>q quit out of man page<\/p>\n\n\n\n<p><strong>clear<\/strong><br>clears entire screen mac<br><strong>cls <\/strong>is clear screen on windows<\/p>\n\n\n\n<p>https:\/\/drupalize.me\/videos\/copy-move-delete-command-line?p=1149<br>Copy Move Delete<\/p>\n\n\n\n<p><strong>cp<\/strong><br>copy<br>cp -r stuff\/ more_stuff<br>Copies folder named stuff, and creates more_stuff folder (sibling of stuff)<br>the -r is necessary for copying folders (directories), <br> cd more_stuff\/<br> ls<\/p>\n\n\n\n<p><strong>mkdir<\/strong><br>make a directory<br>mkdir stats<br>makes a directory called stats in the current more_stuff directory<br>ls -al<br>gives details about items in more_stuff, see details about new stats directory<br>cp Drupal_January.ods stats\/<br>Copies .ods file (in current directory) into stats folder<br>ls shows .ods file still in current more_stuff folder<br> cd stats\/<br> ls<br> shows .ods file also in stats folder (copy)<br>cd ..  (go up one)<\/p>\n\n\n\n<p><strong>rm<\/strong><br> remove delete file from current directory<br> rm Drupal_January.ods <br> ls shows no longer there<br> rm -r garbage\/<br> removes deletes directory from current directory (need -r for directories)<\/p>\n\n\n\n<p><strong>mv<br><\/strong>move command<br>mv drupapal_commands.ods stats\/<br>moves .ods file from current directory to stats folder. Can move to sibling directory w\/ ..\/sibling<\/p>\n\n\n\n<p><strong>*<br> wildcard <\/strong><br> mv 200* junk\/<br> moves all files beginning with 200 to the (child) junk\/ directory<br> mv *jpg  junk\/<br> moves all files ending w jpg<\/p>\n\n\n\n<p>Renaming: use mv for renaming files<br> spaces in names not good<br> Design Eye for the Geek Guy.pdf<br>can rename using mv<br>mv Design\\ Eye \\ Eye\\ for\\ the\\ Geek\\ Guy.pdf design-eye.pdf<br> changes name to  design-eye.pdf<\/p>\n\n\n\n<p><strong>Command Line Permissions<\/strong><br> https:\/\/drupalize.me\/videos\/dealing-command-line-permissions?p=1149<\/p>\n\n\n\n<p><strong>sudo<\/strong> <br>on unix &#8211; allows temporary escelation of own priviledges (not Windows) <br>ls -al shows permissions info of files, <br>If starts with a d = directory<br>If starts with a w &#8211; it is a file<br>     drwxr-xr-x<br>     <strong>-rw-r&#8211;r&#8211;@  1  addi   staff <\/strong> 614 Apr 27 10:26  .DS_Store<\/p>\n\n\n\n<p><strong>Permissions<\/strong><br> first set of characters is for user permissions, &#8211;<strong>rw-<\/strong><br> (user is addi)<br> second set permissions for group<strong> r&#8211;<\/strong><br> (group is staff)<br> third set, permissions for everyone else  <strong>r&#8211;<\/strong><br> @ symbol is not important for now<br>     r = read<br>     w = write<br>     x = execute (for folders x means can go into folder, for files x means can run script)<\/p>\n\n\n\n<p><strong>chmod<\/strong><br>Changing mode, to change permissions<br>    u = user<br>    g = group<br>    o = other<br>    a = all<\/p>\n\n\n\n<p>example: can change group and other together<br> to remove use minus sign (-)<br>     chmod go-rx stuff\/<br>removes read and execute permissions for group and others in the stuff directory<br>     ls -al <br>To see stuff folder premissions have changed<br>      go+rx stuff\/ <br> adds back permissions<br> For directories, if you want to change permissions on all included files  need to add <strong>-r<\/strong> directory\/<\/p>\n\n\n\n<p>Ownership<br> can change ownership<br> root is super user<br> typically not use root, but can temporarily be root user with sudo<\/p>\n\n\n\n<p><strong>chown<\/strong><br> change ownership and group<br> chown root getdrupal.sh<br> may not have authority: Operation not permitted<\/p>\n\n\n\n<p><strong>sudo<\/strong><br> sudo chown root getdrupal.sh<br> need password<br> will let you change ownership of file to root<\/p>\n\n\n\n<p>can change owner and group name together<br>\nsudo chown addi:staff getdrupal.sh<\/p>\n\n\n\n<p>ls -al shows owner and group names changed.<\/p>\n\n\n\n<p><strong>chgrp <\/strong><br> allows change just the group<\/p>\n\n\n\n<p>When you use sudo to copy a file, it creates the file with root as the owner<br>\nif want to change the owner from root to name (addi)<br>\nsudo chown addi settings.php<\/p>\n\n\n\n<p>Do not want everybody to have write access, you can set all to read only with<br>   chmod a=r settings.php<\/p>\n\n\n<p><!--EndFragment--><\/p>\n<p><\/p>\n<p><!--EndFragment--><\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Drupal offers an excellent set of videos to walk you through cmd or command line basics for Unix\/Mac. Below are some notes from the first 3 videos. For check here for Dos\/Windows commands. Moving Around the Command Line From https:\/\/drupalize.me\/series\/command-line-basics-series The cmd command line directory format: machine: ~ directory username pwd Prints the current working [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[35],"tags":[36,37],"class_list":["post-341","post","type-post","status-publish","format-standard","hentry","category-developer","tag-cmd","tag-command-line"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Command Line Basics - s-oneill.com<\/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:\/\/s-oneill.com\/sov02\/command-line-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Command Line Basics - s-oneill.com\" \/>\n<meta property=\"og:description\" content=\"Drupal offers an excellent set of videos to walk you through cmd or command line basics for Unix\/Mac. Below are some notes from the first 3 videos. For check here for Dos\/Windows commands. Moving Around the Command Line From https:\/\/drupalize.me\/series\/command-line-basics-series The cmd command line directory format: machine: ~ directory username pwd Prints the current working [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"s-oneill.com\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-05T22:58:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-08T21:00:47+00:00\" \/>\n<meta name=\"author\" content=\"Me(sean)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Me(sean)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\"},\"author\":{\"name\":\"Me(sean)\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\"},\"headline\":\"Command Line Basics\",\"datePublished\":\"2019-01-05T22:58:45+00:00\",\"dateModified\":\"2019-01-08T21:00:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\"},\"wordCount\":805,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"keywords\":[\"cmd\",\"command line\"],\"articleSection\":[\"Developer\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\",\"url\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\",\"name\":\"Command Line Basics - s-oneill.com\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\"},\"datePublished\":\"2019-01-05T22:58:45+00:00\",\"dateModified\":\"2019-01-08T21:00:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/s-oneill.com\/sov02\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Command Line Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\",\"url\":\"https:\/\/s-oneill.com\/sov02\/\",\"name\":\"s-oneill.com\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\",\"name\":\"sean o\",\"logo\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/\"},\"description\":\"Web dev over 15 years.\",\"sameAs\":[\"http:\/\/s-oneill.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\",\"name\":\"Me(sean)\",\"url\":\"https:\/\/s-oneill.com\/sov02\/author\/user01\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Command Line Basics - s-oneill.com","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:\/\/s-oneill.com\/sov02\/command-line-basics\/","og_locale":"en_US","og_type":"article","og_title":"Command Line Basics - s-oneill.com","og_description":"Drupal offers an excellent set of videos to walk you through cmd or command line basics for Unix\/Mac. Below are some notes from the first 3 videos. For check here for Dos\/Windows commands. Moving Around the Command Line From https:\/\/drupalize.me\/series\/command-line-basics-series The cmd command line directory format: machine: ~ directory username pwd Prints the current working [&hellip;]","og_url":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/","og_site_name":"s-oneill.com","article_published_time":"2019-01-05T22:58:45+00:00","article_modified_time":"2019-01-08T21:00:47+00:00","author":"Me(sean)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Me(sean)","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#article","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/"},"author":{"name":"Me(sean)","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545"},"headline":"Command Line Basics","datePublished":"2019-01-05T22:58:45+00:00","dateModified":"2019-01-08T21:00:47+00:00","mainEntityOfPage":{"@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/"},"wordCount":805,"commentCount":0,"publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"keywords":["cmd","command line"],"articleSection":["Developer"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/s-oneill.com\/sov02\/command-line-basics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/","url":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/","name":"Command Line Basics - s-oneill.com","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/#website"},"datePublished":"2019-01-05T22:58:45+00:00","dateModified":"2019-01-08T21:00:47+00:00","breadcrumb":{"@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/s-oneill.com\/sov02\/command-line-basics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/s-oneill.com\/sov02\/command-line-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/s-oneill.com\/sov02\/"},{"@type":"ListItem","position":2,"name":"Command Line Basics"}]},{"@type":"WebSite","@id":"https:\/\/s-oneill.com\/sov02\/#website","url":"https:\/\/s-oneill.com\/sov02\/","name":"s-oneill.com","description":"","publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a","name":"sean o","logo":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/"},"description":"Web dev over 15 years.","sameAs":["http:\/\/s-oneill.com"]},{"@type":"Person","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545","name":"Me(sean)","url":"https:\/\/s-oneill.com\/sov02\/author\/user01\/"}]}},"_links":{"self":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/comments?post=341"}],"version-history":[{"count":8,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/341\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/341\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/media?parent=341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/categories?post=341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/tags?post=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}