Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shell environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. the environment and functions of shell

Overview of shell, command completion, command history, command aliases, wildcards

Character, command background sending and job control

Shell: the interface between the operating system and the user

Bash used in the user's shell operating system ubuntu

Command completion: intelligent association for input commands, which can greatly improve the input of commands

Efficiency and reduce spelling mistakes at the same time.

Click the completion command with TAB and double-click to list the intelligent matching conjecture

A command that can.

Completion limit: usually completes the command under the command path of the system, and partially completes the command line

Command parameters of

Command history: history has a limit on the number of entries saved

Hitory-c emptying history itself is also emptied.

Use! Match the previously used command

Alias: the nickname of the original command, a function of shell, a shortcut to the command

Alias View alias

Setting: alias zq ='ls-a'

Wildcard: a special symbol supported by a system program for universal matching *: any number of

? Any one must exist []: any one of 0-9, Fan

Any one of the encirclement

Command background sending and job control: commands are independent from the control of command-line interactive programs

Run.

Use of the command sent in the background: the life can be changed by using the "&" symbol at the end of the original command

Send it to the background to run.

Command job control: some kind of task arrangement for a command job by the system

Use the jobs command to view the current acquired job tasks

Use bg to switch the suspended current command to the background

Use fg to switch the most recent background job back to the foreground

The concept of shell variables, custom variables, environment variables, predefined variables, location variables

Shell variables are containers where shell programs store data information in memory.

Set the shell variable and add $eg:echo ${color} ball and echo when referencing

The result of $color ball output is the same

Custom variables: the variables named by users themselves cannot be the same as those named by the system

Name setting: try to capitalize the first letter

Environment variable: a variable used in a system to store environmental information data, usually assigned by the system

Set the initial offer

Everywhere and save: you can change the environment in the current shell environment with the export command

The quantity is exported to the child shell and can be saved in the configuration file ~ / .bashrc

Less / etc/bash.bashrc

Less / etc/profile

Less / .profile

Less / .bashrc

The concept of PATH variables: the sitting path of a storage system command, usually an absolute path, that provides

It is of great significance to the convenience of system command search.

Setting of PATH variable: eg PATH=/home/zq/bin/:$PATH

PS1: first-level prompt

PS2:

Predefined variable: a built-in variable provided by the shell program to store the state information during the running of the shell program. There is no need to set only $$to store the process number information of the current process $0 to store the process name information of the current process, $?!

Position variable: a variable provided by the shell program that can be used to refer to the parameters passed to the program, and the position variable is switched with shift.

Piping and redirection

Application of standard equipment files, piping, redirection, piping and redirection

Standard input file: stdin standard input file is / dev/stdin described as "0"

Standard output file: stdout / dev/stdout description "1"

Standard error file: stderr / dev/stderr description "2"

Pipe:

A pipe is a device provided by the system for transmitting information between commands.

The information transmission of the pipeline is one-way transmission from the back to the back.

The pipe passes only the standard output of the previous command program to the latter command.

Use of pipes: |, cascading

Redirect: the act of redirecting information originally associated with input or output to a standard device file to a known disk file

> override redirection > > append redirection

Use cat < output.txt for input redirection

Here document Technology of Standard input redirection

Use of merge output redirection

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report