{"id":19212,"date":"2010-05-28T08:09:27","date_gmt":"2010-05-28T08:09:27","guid":{"rendered":"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/unix-sysadmin-boot-camp-bash\/"},"modified":"2010-05-28T08:09:27","modified_gmt":"2010-05-28T08:09:27","slug":"unix-sysadmin-boot-camp-bash","status":"publish","type":"post","link":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/planetology\/unix-sysadmin-boot-camp-bash.php","title":{"rendered":"UNIX Sysadmin Boot Camp: bash"},"content":{"rendered":"<p><img decoding=\"async\" class=\"profile\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/6b58a_rrobson.jpg\" alt=\"Ryan Robson\" style=\"padding-left:10px; padding-right: 10px;\">Welcome back to <a href=\"http:\/\/blog.theplanet.com\/2010\/05\/21\/unix-sysadmin-boot-camp-welcome-to-the-jungle\/\">UNIX Sysadmin Boot Camp<\/a>. You&rsquo;ve had a few days to get some &ldquo;reps&rdquo; in accessing your server via <a href=\"http:\/\/blog.theplanet.com\/2010\/05\/24\/unix-sysadmin-boot-camp-ssh\/\">SSH<\/a>, so it&rsquo;s about time we add some weight to your exercise by teaching you some of the tools you will be using regularly to manage your server.<\/p><p>As we mentioned earlier in this series, customers with control panels like cPanel\/WHM and Plesk might be tempted to rely solely on those graphical interfaces. They are much more user-friendly in terms of performing routine server administration tasks, but at some point, you&rsquo;re going to need to get down and dirty on the command line. It&rsquo;s inevitable. This is where you&rsquo;ll use <strong>bash<\/strong> commands.  <\/p><p>Here are some of the top 10 essential commands you should get to know and remember in bash. <em>Click any of the commands to go to its official &ldquo;manual&rdquo; page.<\/em><\/p><ol><li><a href=\"http:\/\/linuxmanpages.com\/man1\/man.1.php\"><code>man<\/code><\/a> &ndash; This command provides a manual of other bash commands. Want more info on a command? Type <code>man commandname<\/code>, and you&rsquo;ll get more information about &ldquo;commandname&rdquo; than you probably wanted to know. It&rsquo;s extremely useful if you need a quick reference for a command, and it&rsquo;s often much more detailed and readable than a simple <code>--help<\/code> or <code>--h<\/code> extension.<\/li><li><a href=\"http:\/\/www.computerhope.com\/unix\/uls.htm\"><code>ls<\/code><\/a> &ndash; This command lets you list results. I showed you an example of this above, but the amount of options that are available to you with this command are worth looking into. Using the &ldquo;manual&rdquo; command above, run <code>man ls<\/code> and check out the possibilities. For example, if you&rsquo;re in <code>\/etc<\/code>, running <code>ls &ndash;l \/etc<\/code> will get you a slightly more detailed list. My most commonly used list command is <code>ls &ndash;hal<\/code>. Pop quiz for you (where you can test your <code>man<\/code> skills): What does the <code>-hal<\/code> mean?<\/li><li><a href=\"http:\/\/www.computerhope.com\/unix\/ucd.htm\"><code>cd<\/code><\/a> &ndash; This command lets you change directories. Want to go to <code>\/etc\/<\/code>? <code>cd \/etc\/<\/code> will take you there. Want to jump back a directory? <code>cd ..<\/code> does the trick.<\/li><li><a href=\"http:\/\/www.computerhope.com\/unix\/umv.htm\"><code>mv<\/code><\/a> &ndash; This command enables you to move files and folders. The syntax is <code>mv originalpath\/to\/file newpath\/to\/file<\/code>. Simple! There are more options that you can check out with the <code>man<\/code> command.<\/li><li><a href=\"http:\/\/www.computerhope.com\/unix\/urm.htm\"><code>rm<\/code><\/a> &ndash; This command enables you to remove a file or directory. In the same vein as the <code>mv<\/code> command, this is one of those basic commands that you just have to know. By running <code>rm filename<\/code>, you remove the &ldquo;filename&rdquo; file.<\/li><li><a href=\"http:\/\/www.computerhope.com\/unix\/ucp.htm\"><code>cp<\/code><\/a> &ndash; This command enables you to copy files from one place to another. Want to make a backup of a file before editing it? Run <code>cp origfile.bla origfile.bak<\/code>, and you have a backup in case your edit of <code>origfile.bla<\/code> goes horrendously wrong and makes babies cry. The syntax is simply: <code>cp \/source \/destination<\/code>. As with the above commands, check out the manual by running <code>man cp<\/code> for more options.<\/li><li><a href=\"http:\/\/linuxmanpages.com\/man1\/tar.1.php\"><code>tar<\/code><\/a> &ndash; On its own, <code>tar<\/code> is a command to group a bunch of files together, uncompressed. These files can then be compressed into .gzip format. The command can be used for creating or extracting, so it may be a good idea to familiarize yourself with the parameters, as you may find yourself using it quite often. For a GUI equivalent, think 7-zip or WinRAR for Windows.<\/li><li><a href=\"http:\/\/linuxmanpages.com\/man1\/wget.1.php\"><code>wget<\/code><\/a> &ndash; I love the simplicity of this little command. It enables you to &ldquo;get&rdquo; or download a target file. Yes, there are options, but all you need is a direct link to a file, and you just pull one of these: <code>wget urlhere<\/code>. Bam! That file starts downloading. Doesn&rsquo;t matter what kind of file it is, it&rsquo;s downloaded.<\/li><li><a href=\"http:\/\/linuxmanpages.com\/man1\/top.1.php\"><code>top<\/code><\/a> &ndash; This handy little binary will give you a live view of memory and CPU usage currently affecting your machine, and is useful for finding out where you need to optimize. It can also help you pinpoint what processes may be causing a slowdown or a load issue.<\/li><li><a href=\"http:\/\/linuxmanpages.com\/man1\/chmod.1.php\"><code>chmod<\/code><\/a> &ndash; This little sucker is vital to make your server both secure and usable, particularly when you&rsquo;re going to be serving for the public like you would with a web server. If you read about <a href=\"http:\/\/blog.theplanet.com\/2010\/02\/11\/how-i-learned-to-stop-worrying-and-love-permissions\/\">how I learned to stop worrying and love the bomb, er permissions<\/a>, you should be familiar with this command and its connotations. Combine good usage of permission and iptables, and you have a locked down server<\/li><\/ol><p>When you understand how to use these tools, you can start to monitor and track what&rsquo;s actually happening on your server. The more you know about your server, the more effective and efficient you can make it. In our next installment, we&rsquo;ll touch on some of the most common server logs and what you can do with the information they provide.<\/p><p>Did I miss any of your &ldquo;essential&rdquo; bash commands in my top 10 list? Leave a comment below with your favorites along with a quick explanation of what they do.<\/p><p>-Ryan<\/p><div><h4>Related Posts:<\/h4><ul><li><a href=\"http:\/\/blog.theplanet.com\/2010\/05\/24\/unix-sysadmin-boot-camp-ssh\/\" rel=\"bookmark\">UNIX Sysadmin Boot Camp: SSH<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2010\/02\/11\/how-i-learned-to-stop-worrying-and-love-permissions\/\" rel=\"bookmark\">How I Learned to Stop Worrying and Love Permissions<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2009\/05\/26\/mysql-update-from-hidden-select\/\" rel=\"bookmark\">MySQL &ndash; UPDATE from (Hidden) SELECT<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2008\/11\/13\/mysql-explain-yourself\/\" rel=\"bookmark\">MySQL &ndash; EXPLAIN Yourself<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2010\/05\/18\/mirroring-server-content-and-configuration-in-iis7\/\" rel=\"bookmark\">Mirroring Server Content and Configuration in IIS7<\/a><\/li><\/ul><\/div><p>\t<a rel=\"nofollow\" href=\"http:\/\/www.stumbleupon.com\/submit?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20bash\" title=\"StumbleUpon\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/6b58a_stumbleupon.png\" alt=\"StumbleUpon\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/twitter.com\/home?status=UNIX%20Sysadmin%20Boot%20Camp%3A%20bash%20-%20http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F\" title=\"Twitter\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/6b58a_twitter.png\" alt=\"Twitter\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/www.dzone.com\/links\/add.html?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20bash\" title=\"DZone\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/6b58a_dzone.png\" alt=\"DZone\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/digg.com\/submit?phase=2&amp;url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20bash&amp;bodytext=Welcome%20back%20to%20UNIX%20Sysadmin%20Boot%20Camp.%20You%27ve%20had%20a%20few%20days%20to%20get%20some%20%22reps%22%20in%20accessing%20your%20server%20via%20SSH%2C%20so%20it%27s%20about%20time%20we%20add%20some%20weight%20to%20your%20exercise%20by%20teaching%20you%20some%20of%20the%20tools%20you%20will%20be%20using%20regularly%20to%20manage%20your%20se\" title=\"Digg\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/6b58a_digg.png\" alt=\"Digg\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/delicious.com\/post?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20bash&amp;notes=Welcome%20back%20to%20UNIX%20Sysadmin%20Boot%20Camp.%20You%27ve%20had%20a%20few%20days%20to%20get%20some%20%22reps%22%20in%20accessing%20your%20server%20via%20SSH%2C%20so%20it%27s%20about%20time%20we%20add%20some%20weight%20to%20your%20exercise%20by%20teaching%20you%20some%20of%20the%20tools%20you%20will%20be%20using%20regularly%20to%20manage%20your%20se\" title=\"del.icio.us\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/31a69_delicious.png\" alt=\"del.icio.us\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/technorati.com\/faves?add=http%3A%2F%2Fblog.theplanet.com%2F2010%2F05%2F26%2Funix-sysadmin-boot-camp-bash%2F\" title=\"Technorati\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/31a69_technorati.png\" alt=\"Technorati\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Welcome back to UNIX Sysadmin Boot Camp. You&rsquo;ve had a few days to get some &ldquo;reps&rdquo; in accessing your server via SSH, so it&rsquo;s about time we add some weight to your exercise by teaching you some of the tools &hellip; <a href=\"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/planetology\/unix-sysadmin-boot-camp-bash.php\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"limit_modified_date":"","last_modified_date":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-19212","post","type-post","status-publish","format-standard","hentry","category-planetology"],"modified_by":null,"_links":{"self":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/19212"}],"collection":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/comments?post=19212"}],"version-history":[{"count":0,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/19212\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/media?parent=19212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/categories?post=19212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/tags?post=19212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}