{"id":8979,"date":"2022-06-15T20:14:50","date_gmt":"2022-06-15T17:14:50","guid":{"rendered":"https:\/\/starlanguageblog.com\/?p=8979"},"modified":"2022-06-15T20:14:50","modified_gmt":"2022-06-15T17:14:50","slug":"zsh-vs-bash-for-mac-explained","status":"publish","type":"post","link":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/","title":{"rendered":"Zsh Vs Bash For Mac Explained"},"content":{"rendered":"

Zsh Vs Bash For Mac Explained<\/span><\/h1>\n

There are several differences between bash and zsh shells. Both shells can search files<\/a> and directories. Zsh shell will look for files and directories with the letter ‘c’ in their names. Once you find a file or folder, it will be displayed. In Bash, if you type ‘c’ in the file or directory name, the file or folder will be listed as ‘c.p’. If you type ‘p’ in the file name, the folder’s name will be displayed instead.<\/span><\/p>\n

Plugin and theme support<\/span><\/h2>\n

Then there’s the question of plugin and theme support for zsh versus Bash for Mac. While there are no universally available themes, there are a few you can install for the shell of your choice’. Among them is agnoster, a Powerline-style theme with decorations such as the battery life, date, and host information. Similarly, akzsh looks great on a dark terminal and includes decorators for git status, last command run, and virtualenv status.<\/span><\/p>\n

Plugin and theme support for zssh vs Bash for Mac includes the oh-my-zsh theme, geodesic, and git status. Geometry is a minimalist ZSH theme with decorations for hostname, git status, and git. Using the git status theme, geossh-inspired themes like bureau, gerry, and ghoti are also available. Several other popular<\/a> themes are avit, hyperzsh, and zsh-based ones.<\/span><\/p>\n

zgenom is another popular option with a long list of extensions and plugins. This community-driven framework offers dozens of themes and over 120 optional plugins. Its auto-update tool allows it to manage and customize your shell environment without editing files. The zgenom plugin, for instance, also enables you to manage your shell environment without editing files. It also offers dotfile management.<\/span><\/p>\n

Besides the above, zsh for Mac has some other great extensions. Among them are tmux-zsh-vim-titles, which makes a single terminal title. Moreover, tmuxrepl automatically adds the git status command to your current command. At the same time, wsl2-ssh-pageant allows you to use your Yubikey-stored GPG keys. Another cool ZSH plugin is xxh-plugin-zsh-rc, which copies your current config file to the remote host.<\/span><\/p>\n

Tab completion<\/span><\/h3>\n

You can enable tab completion for command-line commands in zsh and Bash for Mac by installing the appropriate plugins. First, install zsh-autocomplete. This plugin comes with Homebrew, and you can install it from the $(brew –prefix)\/share\/zsh\/site-functions directory. After installing the plugin, locate the completion script in $(brew –prefix)\/share\/zsh\/site-functions. Once installed, you can use Bazel to copy the completion script to your \/usr\/local\/lib\/bazel\/bin directory.<\/span><\/p>\n

Both Bash and zsh for Mac have similar syntax and behavior so that you can transfer your knowledge from one shell to the other without any major learning curve. You can also tweak the colors of the shell interface using the LS_colors variable. Both shells have similar features, but you can customize your environment to suit your needs. Tab completion in zsh is more useful than in Bash, which only offers text-editing commands<\/a>.<\/span><\/p>\n

Zsh work as your default shell by running the command echo $SHELL. Alternatively, you can install OhMyZsh, a terminal extension that adds many features to the terminal. OhMyZsh also supports editing in multiple editors, such as VSCode. You can also install zsh by using the command zsh version.<\/span><\/p>\n

Configuration files<\/span><\/h3>\n

Both shells have their configuration files. Zshrc is the main shell configuration file, while bashrc is a small supplemental file. Bashrc is used to set aliases and other environment variables but contains little information. It is a good idea to avoid bashrc unless you need to alter these variables on your Mac manually.<\/span><\/p>\n

Both shells have configuration files, and you can set their defaults by editing or assigning a new value to variables. Zsh comes with a bundled editor called nano and ed, and it is possible to set these options yourself. If you are unsure what settings you’ll want to modify, consult the Oh My Zsh Wiki for a list of themes.<\/span><\/p>\n

Zsh has more potential than Bash. With plugins, you can extend its capabilities. A new feature is syntax highlighting, while others include history<\/a>-based completion, autosuggestions, and Git-related features. You can use a mix of these options to customize your shell’s appearance and functionality. You can also make changes to a file’s configuration file with a few mouse clicks, which makes it a breeze to modify.<\/span><\/p>\n

The MIT license of Zsh allows Apple to keep it current. On the other hand, Bash is still widely used, and you can modify the settings to suit your personal preferences. Bash is also available for Mac OS users. But which shell is best for you?<\/span><\/p>\n

One of the most noticeable differences between Zsh and Bash for Mac is how they handle truncation. Bash always applies truncation to the entire range between ‘on’ and ‘off’. In contrast, zsh only applies it to the individual %’ construct. As a result, if you need to truncate a file, you must use the NULLCMD parameter in Zsh.<\/span><\/p>\n

Another notable difference between Bash and Zsh for Mac is globbing. Both systems use the same globbing symbols, but zsh recognizes it as a login shell. Then, you’ll see an explanation of the options available. You can also try zsh -l to see how to switch between the two shells.<\/span><\/p>\n

Unlike the latter, ZLE does not differentiate between these two cases well. In this case, ZLE thinks the terminal<\/a> will wrap at the margin rather than discarding the newline. Then, it moves up one line before redrawing the prompt. In contrast, terminals wrap at the margin, and truncation in ZLE’s case differs from how it occurs in reality.<\/span><\/p>\n

Aliases<\/span><\/h3>\n

When choosing between Bash and zsh for Mac, you should focus on the aliases. You can use one or both of these tools for common tasks. For example, you may want to determine the number of processes using your CPU or memory. But, if you want to know which processes are listening on your UDP or TCP ports, you can use the top10processes alias. The following two examples show the differences between these two shells.<\/span><\/p>\n

Aliases can be any command or group of commands. For example, you can use the grep command to search for’ssh’ and “code” to enter a text file. On Macs, you can also use the alias command to find a string or group of characters. Once you’ve found the string or phrase, you can use the alias to execute it.<\/span><\/p>\n

Final Words<\/span><\/h2>\n

Unlike Bash, zsh keeps a history of commands executed on the terminal. Unlike Bash, Zsh will append a record to the previous one, making editing easier. However, you can run multiple windows with zsh, which can get confusing if you use more than one terminal. Y<\/span><\/p>\n

ou can use the INC_APPEND_HISTORY command to get around this, adding new history to the current history file as lines execute. One of the differences between Bash and Zsh is their key bindings. Bash uses bindkey, while zsh uses the bindkey builtin to bind keys to zle widgets. Bash’s default shell is Bash, but zsh supports more functions and customizations. You can also run your crontabs and interactive shells with zsh.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

Zsh Vs Bash For Mac Explained There are several differences between bash and zsh shells. Both shells can search files and directories. Zsh shell will look for files and directories with the letter ‘c’ in their names. Once you find a file or folder, it will be displayed. In Bash, if you type ‘c’ in […]<\/p>\n","protected":false},"author":1,"featured_media":8980,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[81],"tags":[419,430],"yoast_head":"\nZsh Vs Bash For Mac Explained - Star Language Blog<\/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:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Zsh Vs Bash For Mac Explained - Star Language Blog\" \/>\n<meta property=\"og:description\" content=\"Zsh Vs Bash For Mac Explained There are several differences between bash and zsh shells. Both shells can search files and directories. Zsh shell will look for files and directories with the letter ‘c’ in their names. Once you find a file or folder, it will be displayed. In Bash, if you type ‘c’ in […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"Star Language Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-15T17:14:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"427\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Starla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Starla\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\"},\"author\":{\"name\":\"Starla\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/18c6c447348b68f36676245bfe3f83fc\"},\"headline\":\"Zsh Vs Bash For Mac Explained\",\"datePublished\":\"2022-06-15T17:14:50+00:00\",\"dateModified\":\"2022-06-15T17:14:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\"},\"wordCount\":1203,\"publisher\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp\",\"keywords\":[\"Computer Language\",\"Zsh Vs Bash For Mac Explained\"],\"articleSection\":[\"Computer Language\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\",\"url\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\",\"name\":\"Zsh Vs Bash For Mac Explained - Star Language Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp\",\"datePublished\":\"2022-06-15T17:14:50+00:00\",\"dateModified\":\"2022-06-15T17:14:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage\",\"url\":\"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp\",\"contentUrl\":\"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp\",\"width\":640,\"height\":427,\"caption\":\"Zsh Vs Bash For Mac Explained\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.starlanguageblog.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Zsh Vs Bash For Mac Explained\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#website\",\"url\":\"https:\/\/www.starlanguageblog.com\/\",\"name\":\"Star Language Blog\",\"description\":\"Educative\",\"publisher\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.starlanguageblog.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#organization\",\"name\":\"Star Language Blog\",\"url\":\"https:\/\/www.starlanguageblog.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/starlanguageblog.com\/wp-content\/uploads\/2022\/02\/StarLa-logo.webp\",\"contentUrl\":\"https:\/\/starlanguageblog.com\/wp-content\/uploads\/2022\/02\/StarLa-logo.webp\",\"width\":100,\"height\":50,\"caption\":\"Star Language Blog\"},\"image\":{\"@id\":\"https:\/\/www.starlanguageblog.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/18c6c447348b68f36676245bfe3f83fc\",\"name\":\"Starla\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/14d663ea5b6cb9fe714dae0d82cf59f1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/14d663ea5b6cb9fe714dae0d82cf59f1?s=96&d=mm&r=g\",\"caption\":\"Starla\"},\"sameAs\":[\"https:\/\/starlanguageblog.com\"],\"url\":\"https:\/\/www.starlanguageblog.com\/author\/dwaipayan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Zsh Vs Bash For Mac Explained - Star Language Blog","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.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/","og_locale":"en_US","og_type":"article","og_title":"Zsh Vs Bash For Mac Explained - Star Language Blog","og_description":"Zsh Vs Bash For Mac Explained There are several differences between bash and zsh shells. Both shells can search files and directories. Zsh shell will look for files and directories with the letter ‘c’ in their names. Once you find a file or folder, it will be displayed. In Bash, if you type ‘c’ in […]","og_url":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/","og_site_name":"Star Language Blog","article_published_time":"2022-06-15T17:14:50+00:00","og_image":[{"width":640,"height":427,"url":"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp","type":"image\/webp"}],"author":"Starla","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Starla","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#article","isPartOf":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/"},"author":{"name":"Starla","@id":"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/18c6c447348b68f36676245bfe3f83fc"},"headline":"Zsh Vs Bash For Mac Explained","datePublished":"2022-06-15T17:14:50+00:00","dateModified":"2022-06-15T17:14:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/"},"wordCount":1203,"publisher":{"@id":"https:\/\/www.starlanguageblog.com\/#organization"},"image":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp","keywords":["Computer Language","Zsh Vs Bash For Mac Explained"],"articleSection":["Computer Language"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/","url":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/","name":"Zsh Vs Bash For Mac Explained - Star Language Blog","isPartOf":{"@id":"https:\/\/www.starlanguageblog.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage"},"image":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp","datePublished":"2022-06-15T17:14:50+00:00","dateModified":"2022-06-15T17:14:50+00:00","breadcrumb":{"@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#primaryimage","url":"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp","contentUrl":"https:\/\/www.starlanguageblog.com\/wp-content\/uploads\/2022\/06\/pexels-cottonbro-5483077.webp","width":640,"height":427,"caption":"Zsh Vs Bash For Mac Explained"},{"@type":"BreadcrumbList","@id":"https:\/\/www.starlanguageblog.com\/zsh-vs-bash-for-mac-explained\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.starlanguageblog.com\/"},{"@type":"ListItem","position":2,"name":"Zsh Vs Bash For Mac Explained"}]},{"@type":"WebSite","@id":"https:\/\/www.starlanguageblog.com\/#website","url":"https:\/\/www.starlanguageblog.com\/","name":"Star Language Blog","description":"Educative","publisher":{"@id":"https:\/\/www.starlanguageblog.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.starlanguageblog.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.starlanguageblog.com\/#organization","name":"Star Language Blog","url":"https:\/\/www.starlanguageblog.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.starlanguageblog.com\/#\/schema\/logo\/image\/","url":"https:\/\/starlanguageblog.com\/wp-content\/uploads\/2022\/02\/StarLa-logo.webp","contentUrl":"https:\/\/starlanguageblog.com\/wp-content\/uploads\/2022\/02\/StarLa-logo.webp","width":100,"height":50,"caption":"Star Language Blog"},"image":{"@id":"https:\/\/www.starlanguageblog.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/18c6c447348b68f36676245bfe3f83fc","name":"Starla","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.starlanguageblog.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/14d663ea5b6cb9fe714dae0d82cf59f1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14d663ea5b6cb9fe714dae0d82cf59f1?s=96&d=mm&r=g","caption":"Starla"},"sameAs":["https:\/\/starlanguageblog.com"],"url":"https:\/\/www.starlanguageblog.com\/author\/dwaipayan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/posts\/8979"}],"collection":[{"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/comments?post=8979"}],"version-history":[{"count":0,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/posts\/8979\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/media\/8980"}],"wp:attachment":[{"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/media?parent=8979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/categories?post=8979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.starlanguageblog.com\/wp-json\/wp\/v2\/tags?post=8979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}