Introduction to Linux Shell

Source: Internet
Author: User

What is a shell?

ShellIs the user interface of the system, which provides an interface between the user and the kernel for interactive operation. At the same time, the shell is a command interpreter that interprets the commands entered by the user and sends them to the kernel. Not only this,ShellHas its own programming language for editing commands, which allows the user to write theshellcommand to form a program.

It is not the various terminal emulators of different distributions that often make a difference in the actual experience in the graphical interface, but thisShell(shell). There's a shell and a nucleus, and the nucleus here meansUNIX/LinuxKernelShellRefers to the Software (command parser) that "provides the user with an interface", similar toDOSUnder thecommand(command line) and latercmd.exe

UNIX/LinuxUnder the operating systemShellIt is the interface of user interaction and the scripting language of control system. Of course, this is different fromWindowsThe command line, although it also provides a very simple control statement. InWindowsOperating system, some users will never directly use theShell。 However inUNIXSeries of operating systems,Shellis still a scripting interpreter that controls system startup and many other utilities.

Shell category

in  unix/linux   In the more common  shell

  • Bourne Again Shell(Bash for short)

  • Bourne Shell(referred to as SH)

  • C-Shell(abbreviation CSH)

  • Korn Shell(Abbreviation Ksh)

  • Z shell(abbreviation zsh)

UbuntuThe terminal is using the defaultbash, the default desktop environment isGNOMEOrUnity(based on GNOME), our environment uses thezshAndxfce

can also through  cat/etc/shells   To see the shell types on our host.

First shell script

Open a text editor (you can usevi/vimcommand to create a file), creating a new filetest.sh, the extension is sh (sh for Shell), and the extension does not affect script execution.

Enter the code:

 esc Key, and then enter  :wq Save exit Edit, specific  vim editor is explained in more detail in later chapters.

Note: #! This is a convention tag that tells the system that the script is executed with the specified interpreter. When not specified, $SHELL the value of the variable is used by default.

An attempt is performed to script the script file that is written./test.sh direct execution prompts for insufficient script permissions.


Use chmod +x test.sh to give execute permissions to scripts written

Give the script file permission to execute once again./test.sh, output script content after execution

In practical work it is recommended to use ZSH to execute the script, he can provide a lot of script output information.

Introduction to Linux shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.