Skip to content
Hanlei Qin edited this page Nov 23, 2024 · 34 revisions

In computing, a shell is a command-line interpreter which exposes access to an operating system's services. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer around the operating system.

Command-line shells require the user to be familiar with commands and their calling syntax, and to understand concepts about the shell-specific scripting language (for example, bash).

Learn

scripting

  • Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting
  • Shell 脚本编程30分钟入门
  • Shell 脚本传参方法总结
    echo $0    # 当前脚本的文件名(间接运行时还包括绝对路径)。
    echo $n    # 传递给脚本或函数的参数。n 是一个数字,表示第几个参数。例如,第一个参数是 $1 。
    echo $#    # 传递给脚本或函数的参数个数。
    echo $*    # 传递给脚本或函数的所有参数。
    echo $@    # 传递给脚本或函数的所有参数。被双引号 (" ") 包含时,与 $* 不同,下面将会讲到。
    echo $?    # 上个命令的退出状态,或函数的返回值。
    echo $$    # 当前 Shell 进程 ID。对于 Shell 脚本,就是这些脚本所在的进程 ID。
    echo $_    # 上一个命令的最后一个参数
    echo $!    # 后台运行的最后一个进程的 ID 号
  • useful scripts for making developer's everyday life easier and happier, involved java, shell etc.
  • Minimal safe Bash script template
  • Advanced Shell Scripting Techniques: Automating Complex Tasks with Bash

The Bourne shell was the default shell for Version 7 Unix. Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link or hard link to a compatible shell—even when other shells are used by most users.

  • pure sh bible: A collection of pure POSIX sh alternatives to external processes.

Bash (the Bourne-Again shell)

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used as the default login shell for most Linux distributions and all releases of Apple's macOS prior to macOS Catalina. A version is also available for Windows 10 via the Windows Subsystem for Linux. It is also the default user shell in Solaris 11.

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.

  • Moving to zsh
  • 你不需要花哨的命令提示符
  • Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.
  • Antigen is a small set of functions that help you easily manage your shell (zsh) plugins, called bundles. The concept is pretty much the same as bundles in a typical vim+pathogen setup. Antigen is to zsh, what Vundle is to vim.
  • awesome-zsh-plugins: A collection of ZSH frameworks, plugins, tutorials & themes inspired by the various awesome list collections out there.

Tools

  • shellcheck, a static analysis tool for shell scripts https://www.shellcheck.net
  • explainshell is a tool (with a web interface) capable of parsing man pages, extracting options and explain a given command-line by matching each argument to the relevant help text in the man page. http://www.explainshell.com/
  • cheat allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.
  • cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way.
  • Generic Colouriser is yet another colouriser (written in python) for beautifying your logfiles or output of commands.
  • CLI: improved - zh-CN
  • Modern Unix: A collection of modern/faster/saner alternatives to common unix commands.
  • Distrobox: Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with.
  • When You Should Use Bash Over Python
  • sh Python process launching http://amoffat.github.com/sh
  • xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.5+ with additional shell primitives. xonsh (pronounced conch) is meant for the daily use of experts and novices alike.
  • sarge, a wrapper for subprocess which aims to make life easier for anyone who needs to interact with external applications from their Python code.
  • (:warning:May be outdated)Plumbum: Shell Combinators http://plumbum.readthedocs.org

FAQs

Resources

  • Awesome Shell: A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.
  • Awesome Bash: A curated list of delightful Bash scripts and resources.
  • awesome-cli-apps A curated list of command line apps
Clone this wiki locally