January 6 2024

Guide to Linux shells, from Bash to Bourne via Zsh and others.

Exploration of Unix/Linux shells: from the tradition of Bourne Shell to the modernity of Fish, a journey through the evolution and innovations of command line interfaces

Introduction

In the universe of Linux-based operating systems, the shell is a crucial component. It works both as a scripting language and as an interactive interface to manage the system. There are different shells, each with specific characteristics and functionality. This guide offers an in-depth exploration of some of the most popular shells: Bash, Zsh, Fish, Ksh, Tcsh, Csh, and the historic Bourne Shell.

If we look in more depth at all the Shells that should be treated, we should take into consideration at least those we see in the following diagram. It would not be realistic to cover them all one by one in this post, and we have decided that it is more than sufficient to cover those that are actually used frequently and which are rightly or wrongly considered standards in terms of diffusion and frequency of use.

UNIX Shells

However, it is worth mentioning for purely informative and historical purposes these two shells, which although they are no longer used today, have "set the tone" for an entire continuously evolving branch, Thompson Shell and PWB Shell.

La Thompson Shell it was one of the first shells used in Unix, developed by Ken Thompson, one of the co-creators of Unix, in the first version of the operating system in the late 60s. This shell was rather basic in its functionality, offering a simple command interpreter and a primitive scripting language. It didn't support advanced features like piping or redirections, but it laid the foundation for future Unix command interfaces.

Subsequently, the PCB Shell, or “Programmer’s Workbench Shell,” was introduced as part of the “Programmer’s Workbench” version of Unix. Developed primarily by John Mashey and others at Bell Labs, this shell introduced significant improvements over the Thompson Shell, including greater efficiency and new scripting capabilities. The PWB Shell was an important step towards the development of more advanced and user-friendly shells, directly influencing the creation of shells such as the Bourne Shell.

Both of these shells, Thompson and PWB, represent the embryonic stages in the development of user interfaces for Unix systems, laying the foundation for the modern shells we know today.

Bourne Shell (sh): The first Unix Shell from the 70s.

Historical Context and Development

The Bourne Shell (sh), developed by Stephen Bourne at Bell Labs in the late 70s, was a cornerstone in the development of Unix operating systems. This shell was Bourne's response to the need for a more functional and versatile user interface for early Unix systems. Its development coincided with a period of great innovation and experimentation in the field of operating systems, and the Bourne Shell was one of the first to set the standard for Unix command interfaces.

Main features

  1. Base for Many Other Shells: The Bourne Shell has been the basis from which many modern shells have taken inspiration or were designed to be compatible with. Its influence is evident in shells such as Bash (Bourne Again Shell), which extended its functionality while maintaining compatibility.
  2. Simple but Effective Scripting: While its scripting capabilities may seem limited by today's standards, the Bourne Shell introduced fundamental concepts to Unix scripting that are still relevant. This shell laid the foundation for task automation and management of Unix systems, directly influencing the development of more complex and advanced scripts.

Pros and Cons

  • Pro: Its POSIX compliance and historical impact are Bourne Shell's key strengths. It was a driving force in establishing a common scripting language and a basis for the development of future shells.
  • Cons: However, compared to modern shells, the Bourne Shell lacks many interactive features and improvements introduced over the years. These limitations make it less suitable for some of the more advanced tasks required by today's users.

Conclusion

The Bourne Shell played a crucial role in defining the user experience in Unix systems and laid the foundation for the development of subsequent shells. Its legacy lives on in modern shells that continue to evolve, offering ever more advanced features and intuitive user interfaces. Although it may seem outdated today in terms of functionality, its historical impact and contribution to the development of computing technologies remains invaluable.

Csh (C Shell): A developer-oriented shell

Historical Context and Development

Csh, known as C Shell, is a milestone in the Unix shell landscape. Developed by Bill Joy in the late 70s, this shell marked a major change in the way users interacted with Unix systems. Joy, co-founder of Sun Microsystems and a major contributor to the BSD operating system, introduced Csh at a time when user interface innovation was booming.

The main innovation of Csh was the introduction of a syntax similar to that of the C programming language. This choice represented a clear departure from existing shells, which were based on a more traditional syntax. The idea was to make the shell more familiar to C programmers, making it easier to write scripts and manage the system.

Main features

  1. C-Oriented Syntax: The most distinctive feature of Csh is its syntax, which mimics that of the C language. This made Csh particularly attractive to C programmers, who found it to be a more familiar and intuitive environment.
  2. Scripting features: Csh supports various scripting features such as aliases, shell variables and flow control. These features have made Csh a powerful option for managing automated tasks and customizing the work environment.

Pros and Cons

  • Pro: Its popularity among developers with C backgrounds has been one of Csh's main selling points. The familiarity of his syntax eased these programmers' transition to the Unix world.
  • Cons: Despite its initial innovation, Csh has some limitations, especially in terms of advanced scripting. Furthermore, its lack of adherence to the POSIX standard has led to compatibility issues with other Unix/Linux environments, limiting its usefulness in broader contexts.

Conclusion

Csh represented a major breakthrough in the design and functionality of Unix shells. With its emphasis on C-oriented syntax, it pioneered new forms of interaction with Unix operating systems. However, as user needs have evolved and new shells have emerged, Csh has seen a decline in its popularity. Despite this, its historical impact and influence on the development of subsequent shells remains an important point of reference in the field of computer technologies.

Ksh (Korn Shell): A Detailed Analysis

Historical Context and Development

The Korn Shell (Ksh) comes at a significant historical moment for the world of Unix/Linux command interfaces. Developed in the late 80s by David Korn at Bell Labs, Ksh was a response to growing needs for advanced scripting functionality combined with greater ease of use.

In those years, users and developers were looking for an environment that could offer both the power of advanced scripting functions and greater interactivity and ease of use than traditional shells. Ksh represented a solution to these needs, integrating and improving the features of existing shells and introducing new features.

Main features

  1. Compatibility: Ksh maintains a high level of compatibility with the Bourne Shell, allowing users to run existing scripts without modification. This made it easier for users to transition from other shells to Ksh.
  2. Scripting features: Ksh stands out for its advanced scripting capabilities. It supports associative arrays, custom functions, and other advanced features that were not common in shells of the time. These features have made Ksh a popular choice for complex scripting and automation.
  3. Interactive Functions: The Korn Shell has improved the interactive experience by introducing command autocompletion and improved command history. These features have made the shell friendlier for everyday and interactive use.

Pros and Cons

  • Pro: Ksh offers an excellent balance between advanced scripting features and interactive usability. This makes it a solid choice for users who need both a powerful scripting tool and an effective interactive shell.
  • Cons: Despite its strengths, Ksh has seen a decline in its popularity over the years, mostly due to the rise of other shells like Bash and Zsh. This has led to a smaller community and fewer updates than these newer shells.

Conclusion

Ksh represents an important step forward in the history of Unix/Linux shells. With its combination of powerful scripting capabilities and improvements in interactivity, it marked a turning point in the evolution of command interfaces. While it is less popular today than newer alternatives, its impact and legacy continues to be relevant in the shell landscape, especially for users who appreciate a classic yet powerful approach to system management and scripting.

Tcsh (TENEX C Shell): An improved C Shell

 

Historical Context and Development

Tcsh, which represents an improved version of the C Shell (csh), was born in an era of experimentation and innovation in the field of Unix/Linux shells. Developed to fill some gaps in CSH, TCSH introduced significant improvements that made it a popular choice among specific segments of Unix/Linux users.

C Shell, originally developed by Bill Joy, introduced a syntax similar to the C programming language, a novelty in the shell landscape. However, csh had some shortcomings, especially in terms of usability and functionality. Tcsh was developed to solve these problems, adding important features such as autocompletion and command history, which had become standard in contemporary shells.

Main features

  1. Syntax Similar to C: One of the distinctive features of Tcsh is its syntax, which recalls the C programming language. This makes it particularly attractive for developers and users who are familiar with C.
  2. Improvements over csh: Tcsh introduced a number of improvements over the original C Shell. These include a more sophisticated command autocompletion system, improved command history, and the ability to use more powerful aliases.

Pros and Cons

  • Pro: The improvements made over csh have made Tcsh a popular choice for those looking for a shell with familiar C syntax and modern features. These additions have significantly improved the end user experience.
  • Cons: Tcsh does not fully adhere to the POSIX standard, which can lead to compatibility issues with scripts written for other shells. Furthermore, for those unfamiliar with the syntax of the C language, Tcsh may be less intuitive than other shells such as Bash or Zsh.

Conclusion

Tcsh played an important role in the evolution of Unix/Linux shells, offering users a fusion of advanced scripting capabilities and a familiar C syntax. Although over the years its popularity has waned in favor of more modern shells and standardized, Tcsh remains an important piece in the history of command interfaces, especially appreciated by those who have an attraction to the C language and want a shell that reflects that familiarity.

Bash (Bourne Again Shell): An Improved Bourne Shell

Bourne Again Shell BASH

Historical Context and Development

Bash (Bourne Again Shell) emerges in a particularly rich historical context for the world of computing. It was 1989, a time when the free software movement was gaining momentum under the leadership of Richard Stallman and the GNU Project. In this scenario, Brian Fox, a programmer influenced by the ideology of free software, committed himself to creating a shell that was not only free but that surpassed the functionality offered by the Bourne Shell (sh) developed by Stephen Bourne at Bell Labs.

The Bourne Shell was, at that time, one of the predominant shells in Unix systems, but was subject to restrictions related to its proprietary license. Fox, under the aegis of the GNU Project, intended to develop a shell that was not only free but also more powerful and flexible. Thus was born Bash, a shell that combined compatibility with sh with new features and improvements.

Main features

  1. POSIX compatibility: One of the main challenges in developing Bash was ensuring compatibility with the POSIX standard. POSIX, which stands for “Portable Operating System Interface,” is a set of IEEE standards aimed at maintaining compatibility and portability between various Unix-like operating systems. Bash has embraced these standards, ensuring that scripts written for other POSIX shells can run without problems.
  2. Advanced Scripting: Bash introduced several advanced features that were not present in the original Bourne Shell. These include support for arrays, custom functions, and advanced control structures. These improvements have made Bash a powerful scripting tool, allowing users to write complex, functional scripts.
  3. Automatic Completion: One of Bash's most popular features is its autocomplete system. This allows users to automatically complete command, file and variable names with a simple keystroke, greatly improving the speed and efficiency of using the shell.
  4. Command History: Bash keeps a history of entered commands, allowing users to recall and modify previous commands. This feature is particularly useful in work environments where repeating similar commands is common.

Pros and Cons

  • Pro: Bash's widespread adoption, its richness of features, and its adaptability to complex scripting tasks make it one of the most popular and powerful shells available.
  • Cons: Despite its power, Bash can be less efficient than other modern shells for quick interactive tasks. Additionally, its syntax, while powerful, can sometimes be complex for less experienced users.

Conclusion

The birth of Bash marks a turning point in the evolution of operating system user interfaces. With its combination of compatibility, advanced features, and standards compliance, Bash has not only replaced the Bourne Shell in many systems but has become a mainstay in the world of Linux and Unix-like operating systems. Its influence extends far beyond simple command execution, contributing significantly to the world of scripting and automation in Unix and Linux environments.

Zsh (Z Shell): An Insight

Historical Context and Development

In the panorama of Unix and Linux shells, Zsh (Z Shell) represents a fascinating chapter. Developed by Paul Falstad in 1990, Zsh was born in a period in which the Unix ecosystem was experiencing significant evolution. At the time, users and developers were looking for more powerful and flexible alternatives to traditional shells like Bash and the Bourne Shell.

Falstad, seeing the potential of a shell that could overcome existing limitations, began the development of Zsh. The goal was clear: to create a shell that not only incorporated the best features of Bash and other popular shells, but also introduced new features, making it one of the most advanced and powerful shells.

Main features

  1. Customization: Zsh is renowned for its almost unlimited customization. Users can change almost every aspect of their shell environment, from prompts to colors to command behavior. This customization is made possible by a powerful and flexible configuration system.
  2. Completion Features: Zsh takes the concept of autocompletion to the next level. Not only does it suggest commands and file names, but it can also correct typos and provide detailed, context-based completion options.
  3. Oh my zsh: One of the reasons for Zsh's popularity is the existence of “Oh My Zsh,” a community-driven framework that offers a wide range of themes and plugins. This framework transforms Zsh configuration from a potentially arduous task to a simple and rewarding process, allowing users to harness the power of Zsh without having to dive into complex configuration files.

Pros and Cons

  • Pro: Unmatched customization and improved user interface make Zsh a popular choice for users who want a feature-rich and pleasant-to-use shell environment.
  • Cons: Despite these advantages, Zsh can be intimidating for beginners due to its initial complexity. Setup, while assisted by tools like “Oh My Zsh,” can require a steeper learning curve than other shells.

Conclusion

Zsh represents a point of reference in the evolution of command interfaces. With its emphasis on customization and improving user experience, Zsh is not just a shell, but a powerful tool that allows users to shape their work environment to their needs and preferences. Extensive community support and continuous evolution make Zsh an excellent choice for those seeking an advanced and deeply customizable shell experience.

Fish (Friendly Interactive Shell)

Historical Context and Development

Fish (Friendly Interactive Shell) marks a turning point in the world of Unix/Linux shells for its emphasis on ease of use and accessibility. Developed in 2005 by Axel Liljencrantz, Fish was born in a period in which most shells were oriented towards expert users, often to the detriment of usability for beginners or those looking for a more intuitive interface.

Liljencrantz's goal was clear: create a shell that was not only powerful but also easy to use, with a gentler learning curve than existing counterparts. Fish was designed to be more intuitive, with features that help the user in every step, from writing commands to executing them.

Main features

  1. Intelligent autocomplete: Fish takes autocompletion to the next level, suggesting commands based not only on history but also on current syntax. This makes it much easier for users to discover new commands and use existing ones more effectively.
  2. Syntax Coloring: One of Fish's most popular features is its ability to color syntax in real time. This helps users identify syntax errors, variables, and commands visually, making script writing more intuitive.
  3. Web-Based Configuration: Fish stands out for its web-based configuration. Users can customize their shell through a browser, making customization accessible even to those who are not comfortable with directly editing configuration files.

Pros and Cons

  • Pro: Its user-friendly nature makes Fish an excellent choice for beginners or those who want a more modern and accessible shell experience. Its intuitive features help reduce errors and speed up the learning process.
  • Cons: A significant limitation of Fish is its incomplete compatibility with the POSIX standard. This means that scripts written for other shells may not work properly in Fish, limiting its portability across different environments.

Conclusion

Fish represents an important step towards democratizing the use of shells in Unix and Linux environments. With his focus on ease of use and accessibility, Fish opened the door to a wider audience, showing that the powerful features of Unix/Linux shells can be made accessible and enjoyable to use. Despite some limitations, Fish remains a solid choice for those looking for an interactive shell that balances power and ease of use.

In General Conclusion on Linux Shells

In the journey of learning and experimenting with Unix/Linux shells, exploring the most modern shells can be an educationally enriching experience. Shells like Zsh and Fish offer a wide range of advanced features and customization options, which can provide a deeper understanding of the potential of command line interfaces. However, for those new to the Unix/Linux world or those looking for a more uniform and standardized experience, Bash is a solid choice. As the default shell on most Linux systems, it provides remarkable consistency and reliability. Furthermore, its ubiquity ensures that it is almost always available or easily installed on any system. This makes it particularly suitable for those who work on multiple systems or in environments where custom shells cannot be guaranteed. Ultimately, while exploring more advanced shells can be intriguing and educational, Bash remains the ideal choice for those who want a solid starting base, common and widely supported in the Linux ecosystem.

 

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.

0256569681

Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.

INFORMATION

Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds owns the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Facebook, Inc. owns the rights to Facebook®; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV This site is not affiliated, sponsored, or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a registered trademark at European level by MANAGED SERVER SRL Via Enzo Ferrari, 9 62012 Civitanova Marche (MC) Italy.

Back to top