{"id":112,"date":"2015-07-08T20:51:19","date_gmt":"2015-07-09T02:51:19","guid":{"rendered":"http:\/\/jacobncalvert.com\/?p=112"},"modified":"2018-02-10T14:42:03","modified_gmt":"2018-02-10T20:42:03","slug":"useful-linux-commands","status":"publish","type":"post","link":"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/","title":{"rendered":"Useful Linux Commands"},"content":{"rendered":"<p>I have been compiling a list of some Linux commands that I find most useful. Some of these are the basic run-of-the-mill commands that any intro to Linux class will teach, but some of them are a little more obscure, yet useful. They are listed below in alphabetical order.<\/p>\n<h4>apropos<\/h4>\n<p>This utility is related to the\u00a0<i>man<\/i>\u00a0utility. You can use it to find references within manual pages simply by providing an argument that is close to or exactly what you are looking for. For example you can find all the manual page names and sections that relate to\u00a0<i>printf\u00a0<\/i>simply by invoking\u00a0<i>apropos printf<\/i>. This will give you results for\u00a0<i>printf, fprintf, vprintf, vfwprintf&#8230;<\/i>\u00a0and so on.<\/p>\n<h4>cat<\/h4>\n<p>This one is one of my most used and extremely useful. Issuing\u00a0<i>cat FILENAME<\/i>\u00a0and the contents of that file will be dumped to the screen. Easy peasy.<\/p>\n<h4>dig<\/h4>\n<p>This is a handy little network utility. You can use it to grab information about any domain by simply running\u00a0<i>dig some.example.com any<\/i>.<\/p>\n<h4>find<\/h4>\n<p>Here is an extremely useful command. Ever need to know where a file is in the structure but only remember its name?\u00a0<i>find . -name filename<\/i>\u00a0will\u00a0<i>find<\/i>\u00a0it for you.<\/p>\n<h4>last<\/h4>\n<p>Another simple but useful command. Lists the last users logged into the system with times and other info.<\/p>\n<h4>look<\/h4>\n<p>In most Linux distros, you can look up the spelling of an English word without breaking out the dictionary. Suppose you don&#8217;t know how to spell &#8220;superfluous.&#8221; Type\u00a0<i>look superfl<\/i>\u00a0and you will see a list of words beginning with &#8220;superfl&#8221; &#8212; including superfluous.<\/p>\n<h4>nc<\/h4>\n<p><i>nc<\/i>\u00a0or\u00a0<i>netcat<\/i>\u00a0is a TCP and UDP utility that can act as a listener\/receiver as well as a requester\/sender\/server. There are so many options with this one that you&#8217;re better off checking the\u00a0<i>man<\/i>\u00a0page.<\/p>\n<h4>nl<\/h4>\n<p>This short command stands for &#8220;numbered lines.&#8221; Give it a file name as a parameter and it will print the file with numbered lines. Pretty useful!<\/p>\n<h4>pstree<\/h4>\n<p>Issuing this guy will print out a formatted tree of the processes on the system.<\/p>\n<h4>tail<\/h4>\n<p>This is useful for debugging. My most common usage is this:\u00a0<i>tail -f \/var\/log\/some.log<\/i>. That will open the log file and continually print the last few lines so you can debug that service.<\/p>\n<h4>touch<\/h4>\n<p>You can do a lot of things with touch, but the most basic is file creation. Need a new file right here?\u00a0<i>touch FILENAME<\/i>. Done.<\/p>\n<h4>tree<\/h4>\n<p>Similar to\u00a0<i>pstree<\/i>\u00a0but with the filesystem.<\/p>\n<h4>wget<\/h4>\n<p>Download all the things! The\u00a0<i>wget<\/i>\u00a0command will aloow you to download resources from a server simply by doing\u00a0<i>wget http:\/\/some.server.com\/resource.ext<\/i>. Check out the\u00a0<i>man<\/i>\u00a0page for all the other amazing features of\u00a0<i>wget<\/i>.<\/p>\n<h4>which<\/h4>\n<p>If you want to know what binary (or alias) is called when you issue a command, you use\u00a0<i>which SOME_COMMAND<\/i>. You&#8217;ll find out what you want to know.<\/p>\n<h4>who<\/h4>\n<p>If you want to know the users logged into the system, issue\u00a0<i>who<\/i>.<\/p>\n<h4>whoami<\/h4>\n<p>If you&#8217;re feeling lost, or simply forgot if you&#8217;re root or whoever,\u00a0<i>whoami<\/i>\u00a0will tell you right away.<\/p>\n<p>This list is far from exhaustive, because frankly, there are so many great utilities in most flavors of Linux, but these are some of my favorites. I&#8217;ve linked each one to their respective\u00a0<i>man<\/i>\u00a0pages below.<\/p>\n<p><a href=\"http:\/\/linux.die.net\/man\/1\/apropos\">apropos<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/cat\">cat<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/dig\">dig<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/find\">find<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/last\">last<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/look\">look<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/nc\">nc<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/nl\">nl<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/pstreetail\">pstreetail<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/touch\">touch<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/tree\">tree<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/wget\">wget<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/which\">which<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/who\">who<\/a><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/1\/whoami\">whoami<\/a><\/p>\n<p>Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been compiling a list of some Linux commands that I find most useful. Some of these are the basic run-of-the-mill commands that any intro to Linux class will teach, but some of them are a little more obscure, yet useful. They are listed below in alphabetical order. apropos This utility is related to the\u00a0man\u00a0utility. You can use it to find references within manual pages simply by providing an argument that is close to or exactly what you are&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[39],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Useful Linux Commands - Jacob N Calvert<\/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:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Useful Linux Commands - Jacob N Calvert\" \/>\n<meta property=\"og:description\" content=\"I have been compiling a list of some Linux commands that I find most useful. Some of these are the basic run-of-the-mill commands that any intro to Linux class will teach, but some of them are a little more obscure, yet useful. They are listed below in alphabetical order. apropos This utility is related to the\u00a0man\u00a0utility. You can use it to find references within manual pages simply by providing an argument that is close to or exactly what you are&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"Jacob N Calvert\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-09T02:51:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-02-10T20:42:03+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/#website\",\"url\":\"https:\/\/jacobncalvert.com\/blog-archive\/\",\"name\":\"Jacob N Calvert\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/jacobncalvert.com\/blog-archive\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/#webpage\",\"url\":\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/\",\"name\":\"Useful Linux Commands - Jacob N Calvert\",\"isPartOf\":{\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/#website\"},\"datePublished\":\"2015-07-09T02:51:19+00:00\",\"dateModified\":\"2018-02-10T20:42:03+00:00\",\"author\":{\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/#\/schema\/person\/f4b22a996d41bf09ed2bbe22912a8c8a\"},\"breadcrumb\":{\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/\",\"url\":\"https:\/\/jacobncalvert.com\/blog-archive\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/2015\/07\/08\/useful-linux-commands\/#webpage\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/#\/schema\/person\/f4b22a996d41bf09ed2bbe22912a8c8a\",\"name\":\"Jacob\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/jacobncalvert.com\/blog-archive\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/64a2dd1c00cb39dfc19bb1204c87efbc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/64a2dd1c00cb39dfc19bb1204c87efbc?s=96&d=mm&r=g\",\"caption\":\"Jacob\"},\"sameAs\":[\"https:\/\/jacobncalvert.com\"],\"url\":\"https:\/\/jacobncalvert.com\/blog-archive\/author\/jcalvert\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/posts\/112"}],"collection":[{"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":1,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"predecessor-version":[{"id":113,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/posts\/112\/revisions\/113"}],"wp:attachment":[{"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jacobncalvert.com\/blog-archive\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}