Shell Review First chapter

Source: Internet
Author: User

Today to write blog only to find before there is no written, my God, I was asleep ...

1, what is a shell?

The shell is a unix/linux system with software that acts as an interface between the kernel and the user, reads the user's input command, sends it to the kernel to run it, and returns the result to the user after the run is finished.

The role of 2,shell

Separates the operating system and the user, responsible for interface and communication.

3, how to exit the remote login shell

Logout

Exit

Ctrl+l

4, how to view history commands

History #查看该用户使用过的命令

!399 #运行history第399命令

History-c #清除历史命令的记录

5, the difference between built-in commands and external commands

The built-in command refers to the commands contained within the Bash toolset. This is mainly due to the problem of execution efficiency----built-in commands will execute faster than external commands. Another part of the reason is that a particular built-in command requires direct access to the shell kernel part, whereas an external command usually requires a sub-process created by the fork () system, and then calls Execve () in the child process to execute an executable program.

6, how to customize the command

Alias cp= ' Cp-i ' #单引号防止解析

7, how to customize the action command character

echo $PS 1 or PS2 #哎呦就是这个修改项目, but change will become a loaded force, the front of every time the command of the display East, if you are interested in your own search changed ha, I am too lazy to remember.

8. Get Help information

-1,help help #一个月了还没用到, my goodness, I guess it's a salted fish command.

-2,man ls #当初纠结了好久怎么打出忙帮助文档, hey, but solved.

-3,info ls #至今还不知道这个和help是外部命令还是内建命令, but man is built, it seems to look at Mans is not enough Ah, still have to understand the source code and system ah.

9, Increase script execution permissions

chmod u+x user can perform

G+x User Group Executable

O+x other users can perform

A+x all user Classes execute #后面那还用到来着, forget-. -May I not forget my home still keep my own secretly hid condoms, let mother find but also thunder penalty.

10, adding environment variables

-1, view #有什么变量啊? Echo $PATH

-2, add export Path=~/bin:${path} #我依稀记得这个 ~ represents your user home directory, such as my ~ is/home/3dt, and also: is the delimiter, do not write will overwrite the original, what concept Ah, oh GG, the other operation commands are not , perhaps the export add variables are gone, haha, to be cautious ah, after all, change is a choice ah, to be responsible for OH.

-3 to view the echo $PATH #再看看是不是改对了呢?

11, 3 ways to run the script file

The script file is executed by the -1,source script via the built-in command of bash or the point command (a face-up)

-2,bin/bash script interprets the scripts file by executing shell program/bin/bash

-3,./script by adding Execute permissions for the script file and then running directly #sh name.sh This is a lot of it, this is the first way or the second way to save it later, I still solve how to learn the server, my second-hand notebook has been thirsty.

12, add comments in script

#略: haha hahaha or ha ha haha or or or or or or or or or or if this line is not preceded by a comment on the line

Shell Review First chapter

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.