{"id":7918,"date":"2021-03-26T16:27:58","date_gmt":"2021-03-26T16:27:58","guid":{"rendered":"https:\/\/www.linuxfordevices.com\/?p=7918"},"modified":"2022-07-29T06:03:35","modified_gmt":"2022-07-29T06:03:35","slug":"linux-shells","status":"publish","type":"post","link":"https:\/\/www.linuxfordevices.com\/tutorials\/linux\/linux-shells","title":{"rendered":"Linux Shells &#8211; A Complete Guide"},"content":{"rendered":"\n<p>Linux shells are an essential part of any Linux system and can massively affect your workflow and can drastically increase your efficiency. In this module, we shall discuss the three most popular shells in Linux, namely: <strong><em>bash<\/em><\/strong>,<em><strong> <a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/ubuntu\/z-shell-on-ubuntu\" class=\"rank-math-link\">zsh<\/a>,<\/strong><\/em> and <em><strong>fish<\/strong><\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span id=\"eh-1\"><\/span>What Are Linux shells?<\/h2>\n\n\n\n<p>A<strong><em> SHELL <\/em><\/strong>is a program that lets you interact with the Operating System and serves as a Linux Command Line Interpreter. It provides us a medium to interact with the kernel and an initial medium to configure and modify initial files. This becomes extremely instrumental when we are doing some CLI-only tasks like Arch Linux install and don&#8217;t have the GUI tools available to us. <\/p>\n\n\n\n<p>Linux shells can also provide a lot of features that can aid the user with their daily workflow and day-to-day tasks. Some of such useful features are Tab Completion, Syntax Highlighting, and autosuggestions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span id=\"eh-2\"><\/span><span id=\"eh-2\"><\/span>How To Check Which Shell Is In Use?<\/h2>\n\n\n\n<p>To check the default Shell in use, you can type the following in a terminal :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; title: ; notranslate\" title=\"\">\n$ echo $SHELL\n<\/pre><\/div>\n\n\n<p>This should return you your default shell. However it might happen that you might be in a different shell than your default one. In that case, you can check your default shell with :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; title: ; notranslate\" title=\"\">\n$ echo $0\n<\/pre><\/div>\n\n\n<p>This should give you your current shell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span id=\"eh-3\"><\/span><span id=\"eh-3\"><\/span>Some Popular Linux Shells <\/h2>\n\n\n\n<p>Below we take a look at the 3 most popular shells in Linux :<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span id=\"eh-4\"><\/span><span id=\"eh-4\"><\/span>Bash: GNU Bourne-Again Shell<\/h3>\n\n\n\n<p>It is the default shell on most Linux Distros. It is reasonably customizable and fast. It comes with some nice features like Tab completion and also allows for some really nice shell scripts. The configuration for bash is located in a hidden file called<a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/linux\/bashrc-and-bash-profile\" class=\"rank-math-link\"> <em><strong>.bashrc<\/strong><\/em><\/a> in the user&#8217;s home directory. To know more about it, read this <strong><em><a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/linux\/bashrc-and-bash-profile\" class=\"rank-math-link\">article<\/a><\/em><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span id=\"eh-5\"><\/span><span id=\"eh-5\"><\/span>Zsh: Z-Shell<\/h3>\n\n\n\n<p><strong><em>Zsh<\/em><\/strong> is another great shell that is very similar to <strong><em>bash<\/em><\/strong> in its base form. However, the point which makes <em><strong>zsh<\/strong><\/em> standout from the rest is that is heavily customizable, especially with the aid of <strong><em><a href=\"https:\/\/github.com\/ohmyzsh\/ohmyzsh\" class=\"rank-math-link\" target=\"_blank\" rel=\"noopener\">OhMyZsh<\/a><\/em><\/strong>. You can install any number of plugins to extend the shell&#8217;s current capabilities and add new features. You can add elements to it like Color Schemes, Auto-Completion, Syntax Highlighting, and such. Read more about it <strong><em><a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/ubuntu\/z-shell-on-ubuntu\" class=\"rank-math-link\">here<\/a><\/em><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span id=\"eh-6\"><\/span><span id=\"eh-6\"><\/span>Fish: Friendly Interactive Shell&nbsp;<\/h3>\n\n\n\n<p>Fish or friendly interactive shell and is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family. It is not POSIX compatible, nor it is meant to be so. Fish provides a lot of functionality out of the box like Syntax Highlighting, Auto-Suggestion and such. It also gives us a GUI way to edit our configurations and you need not install any additional plugins for the same. You can still customize it further with <strong><em><a href=\"https:\/\/github.com\/oh-my-fish\/oh-my-fish\" class=\"rank-math-link\" target=\"_blank\" rel=\"noopener\">OhMyFish<\/a><\/em><\/strong>. Fish is my personal favourite because one doesn&#8217;t need to spend a lot of time configuring as most of the essential features are provided out of the Box.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span id=\"eh-7\"><\/span><span id=\"eh-7\"><\/span>Changing Your Default Linux Shells<\/h2>\n\n\n\n<p>Let&#8217;s begin by listing all the shells that are available on your system with the <a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/linux\/cat-more-command-in-linux\" class=\"rank-math-link\">cat command<\/a>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; title: ; notranslate\" title=\"\">\n$ cat \/etc\/shells\n<\/pre><\/div>\n\n\n<p>This should list out all the shells you have available on your system along with their full path. Now, to change your default shell, type in:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; title: ; notranslate\" title=\"\">\n$ chsh -s \/path\/to\/shell\n<\/pre><\/div>\n\n\n<p>This shall change the default shell for the current user. Sometimes you might need to logout and log back in for the changes to take place but after this your default change would be changed to the one you selected.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Hence we discussed a bit about Linux shells. There are still many different types of shell available but these are some of the most popular ones. You can compare and decide which one suits you the best and go ahead and use it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux shells are an essential part of any Linux system and can massively affect your workflow and can drastically increase your efficiency. In this module, we shall discuss the three most popular shells in Linux, namely: bash, zsh, and fish. What Are Linux shells? A SHELL is a program that lets you interact with the [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":7925,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[],"class_list":["post-7918","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/posts\/7918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/comments?post=7918"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/posts\/7918\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/media\/7925"}],"wp:attachment":[{"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/media?parent=7918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/categories?post=7918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxfordevices.com\/wp-json\/wp\/v2\/tags?post=7918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}