{"id":3376,"date":"2014-09-03T18:18:27","date_gmt":"2014-09-03T18:18:27","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2014\/09\/03\/alias-command\/"},"modified":"2022-03-31T19:30:00","modified_gmt":"2022-03-31T23:30:00","slug":"alias-command","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/","title":{"rendered":"alias command"},"content":{"rendered":"<p>When working with <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-login-ssh\/\">SSH<\/a> and the <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/command-list\/\">command line<\/a> interface, you may want to begin trimming down the number of keys you hit by creating aliases for the commands you use most often. This can help you move along faster when working on your site. This article goes over the <em>alias<\/em> command and how to use it.<\/p>\n<p><strong>Command: <\/strong>alias<br \/>\n<strong>Synopsis: <\/strong>alias [name[=value] &#8230;]\n<h2>Examples<\/h2>\n<h3>Alias for the clear command<\/h3>\n<p>In this example, we create an alias for the &#8216;<em>clear<\/em>&#8216; command. We shorten it to simply &#8216;<em>c<\/em>&#8216;.<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">alias c='clear'<\/span><\/pre>\n<h3>Aliases for various cd commands<\/h3>\n<p>For this example, we will make some shorter cd commands for going up one, two, or three levels.<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">alias ..='cd ..'<\/span> # <span style=\"color:red\">alias ...='cd ..\/..'<\/span> # <span style=\"color:red\">alias ....='cd ..\/..\/..'<\/span><\/pre>\n<h3>Aliases for common mistakes<\/h3>\n<p>If you have a habit of not leaving a space in between the &#8216;<em>cd<\/em>&#8221; and the &#8216;..&#8217; portion of the &#8216;<em>cd ..<\/em>&#8216; command, you can create an alias for that as well.<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">alias cd..='cd ..'<\/span><\/pre>\n<h2>Listing the aliases<\/h2>\n<p>If you want to have the entire list of aliases displayed, use the following version of the alias command.<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">alias -p<\/span> alias attrib='chmod' alias chdir='cd' alias copy='cp' alias cp='cp -i' alias d='dir' alias del='rm' alias deltree='rm -r'<\/pre>\n<h2>Removing an alias<\/h2>\n<p>The following couple of examples demonstrate how to remove aliases with the &#8216;<em>unalias<\/em>&#8216; command.<\/p>\n<h3>Removing a single alias<\/h3>\n<p>This example shows how to remove a single alias. In the example below we are removing the &#8216;<em>c<\/em>&#8216; alias we created above.&#8217;<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">unalias c<\/span><\/pre>\n<h3>Remove all aliases<\/h3>\n<p>If you wish to clear your alias list, use the following command. Do note that it deletes ALL aliases.<\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">unalias -a<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When working with SSH and the command line interface, you may want to begin trimming down the number of keys you hit by creating aliases for the commands you use most often. This can help you move along faster when working on your site. This article goes over the alias command and how to use<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\"> Read More ><\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308],"tags":[],"class_list":["post-3376","post","type-post","status-publish","format-standard","hentry","category-linux"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>alias command | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to use the Linus alias command to make shorter commands.\" \/>\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.inmotionhosting.com\/support\/server\/linux\/alias-command\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"alias command | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to use the Linus alias command to make shorter commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-03T18:18:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-31T23:30:00+00:00\" \/>\n<meta name=\"author\" content=\"Scott Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Scott Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\"},\"author\":{\"name\":\"Scott Mitchell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\"},\"headline\":\"alias command\",\"datePublished\":\"2014-09-03T18:18:27+00:00\",\"dateModified\":\"2022-03-31T23:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\"},\"wordCount\":231,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\",\"name\":\"alias command | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2014-09-03T18:18:27+00:00\",\"dateModified\":\"2022-03-31T23:30:00+00:00\",\"description\":\"Learn how to use the Linus alias command to make shorter commands.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"alias command\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\",\"name\":\"Scott Mitchell\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"alias command | InMotion Hosting","description":"Learn how to use the Linus alias command to make shorter commands.","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.inmotionhosting.com\/support\/server\/linux\/alias-command\/","og_locale":"en_US","og_type":"article","og_title":"alias command | InMotion Hosting","og_description":"Learn how to use the Linus alias command to make shorter commands.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2014-09-03T18:18:27+00:00","article_modified_time":"2022-03-31T23:30:00+00:00","author":"Scott Mitchell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Scott Mitchell","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/"},"author":{"name":"Scott Mitchell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed"},"headline":"alias command","datePublished":"2014-09-03T18:18:27+00:00","dateModified":"2022-03-31T23:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/"},"wordCount":231,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/","name":"alias command | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2014-09-03T18:18:27+00:00","dateModified":"2022-03-31T23:30:00+00:00","description":"Learn how to use the Linus alias command to make shorter commands.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/alias-command\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"alias command"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed","name":"Scott Mitchell","url":"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3376"}],"version-history":[{"count":1,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3376\/revisions"}],"predecessor-version":[{"id":95556,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3376\/revisions\/95556"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}