{"id":13,"date":"2015-11-06T16:56:15","date_gmt":"2015-11-06T16:56:15","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=13"},"modified":"2016-05-03T20:57:48","modified_gmt":"2016-05-03T20:57:48","slug":"command-line-fun-the-basics","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2015\/11\/06\/command-line-fun-the-basics\/","title":{"rendered":"command line fun &#8211; the basics"},"content":{"rendered":"<p>I was meeting with a younger friend to fix his virus laden laptop, it turned out to be quite a mess so we decided it would be more efficient to restore it from the recovery partition. I was a bit surprised to discover that his understanding of the command line was essentially a mystery.<\/p>\n<p>This column will be examining various Linux commands that can be used in scripting or while working on the command line. Wherever possible I will also demonstrate similar functionality for windows batch files.\u00a0\u00a0 It is actually possible to do some basic scripting on windows but on a limited scale unless you install some additional product to help out.<\/p>\n<p>Eventually, I am hoping to go beyond a &#8220;random&#8221; collection of commands and turn them into scripts to actually do useful work.<\/p>\n<h2>Basic commands<\/h2>\n<table class=\"w3-table-all\" style=\"width: 639px; height: 177px;\">\n<tbody>\n<tr>\n<th>Linux<\/th>\n<th>Windows<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>dir<\/td>\n<td>This command lists the files in the current working directory<\/td>\n<\/tr>\n<tr>\n<td>cd<\/td>\n<td>cd<\/td>\n<td>change directory to either a fully qualified directory name or to a subdirectory within the current directory<\/td>\n<\/tr>\n<tr>\n<td>rm<\/td>\n<td>del<\/td>\n<td>delete the filename in the current directory<\/td>\n<\/tr>\n<tr>\n<td>rmdir<\/td>\n<td>rmdir<\/td>\n<td>remove either a fully qualified directory name or to a subdirectory within the current directory<\/td>\n<\/tr>\n<tr>\n<td>clear<\/td>\n<td>cls<\/td>\n<td>erases the screen and puts the cursor in the upper left hand corner<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Linux command options<\/h2>\n<table class=\"w3-table-all\" style=\"width: 639px; height: 177px;\">\n<tbody>\n<tr>\n<th>Command<\/th>\n<th>option<\/th>\n<th>meaning<\/th>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-l<\/td>\n<td>directory listing in long format<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-lt<\/td>\n<td>directory listing in date\/time descending order<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-ltr<\/td>\n<td>directory listing in date\/time ascending order<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-lSr<\/td>\n<td>directory listing in long format sorted by filesize ascending.<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-1<\/td>\n<td>directory listing only filenames<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>-1<\/td>\n<td>directory listing only filenames<\/td>\n<\/tr>\n<tr>\n<td>rm<\/td>\n<td>-r<\/td>\n<td>removes subdirectories and their containing files<\/td>\n<\/tr>\n<tr>\n<td>rm<\/td>\n<td>-f<\/td>\n<td>ignore nonexistent files, never prompt<\/td>\n<\/tr>\n<tr>\n<td>rmdir<\/td>\n<td><\/td>\n<td>removes empty directories<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h2>Windows command options<\/h2>\n<table class=\"w3-table-all\" style=\"width: 639px; height: 177px;\">\n<tbody>\n<tr>\n<th>Command<\/th>\n<th>option<\/th>\n<th>meaning<\/th>\n<\/tr>\n<tr>\n<td>dir<\/td>\n<td>\/od<\/td>\n<td>directory listing order by date ascending<\/td>\n<\/tr>\n<tr>\n<td>dir<\/td>\n<td>\/os<\/td>\n<td>directory listing order increasing by size<\/td>\n<\/tr>\n<tr>\n<td>dir<\/td>\n<td>\/b<\/td>\n<td>directory listing displaying filenames only<\/td>\n<\/tr>\n<tr>\n<td>dir<\/td>\n<td>\/oe<\/td>\n<td>directory listing sorted by file extension<\/td>\n<\/tr>\n<tr>\n<td>del<\/td>\n<td>\/f<\/td>\n<td>Force deleting of read-only files<\/td>\n<\/tr>\n<tr>\n<td>del<\/td>\n<td>\/s<\/td>\n<td>recursively remove directories and their files<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>I was meeting with a younger friend to fix his virus laden laptop, it turned out to be quite a mess so we decided it would be more efficient to restore it from the recovery partition. I was a bit &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2015\/11\/06\/command-line-fun-the-basics\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[18,17,39],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/13"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":8,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":916,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/13\/revisions\/916"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}