当前位置:文档之家› bash

bash

bash
bash

NAME

bash ? GNU Bourne-Again SHell

SYNOPSIS

bash[options] [?le]

COPYRIGHT

Bash is Copyright ? 1989-2011 by the Free Software Foundation, Inc.

DESCRIPTION

Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a ?le.Bash also incorporates useful features from the Korn and C shells (ksh and csh).

Bash is intended to be a conformant implementation of the Shell and Utilities portion of the IEEE POSIX speci?cation (IEEE Standard 1003.1).Bash can be con?gured to be POSIX-conformant by default. OPTIONS

All of the single-character shell options documented in the description of the set builtin command can be used as options when the shell is invoked. In addition,bash interprets the following options when it is invoked:

?c string If the?c option is present, then commands are read from string.If there are arguments after the string,they are assigned to the positional parameters, starting with$0.

?i If the?i option is present, the shell is interactive.

?l Make bash act as if it had been invoked as a login shell (see INVOCATION below).

?r If the?r option is present, the shell becomes restricted(see RESTRICTED SHELL below).

?s If the?s option is present, or if no arguments remain after option processing, then commands are read from the standard input.This option allows the positional parameters to be set when

invoking an interactive shell.

?D A list of all double-quoted strings preceded by$is printed on the standard output.These are the strings that are subject to language translation when the current locale is not C or POSIX.

This implies the?n option; no commands will be executed.

[?+]O [shopt_option]

shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN

COMMANDS below). If shopt_option is present,?O sets the value of that option;+O unsets

it. If shopt_option is not supplied, the names and values of the shell options accepted by shopt

are printed on the standard output.If the invocation option is+O,the output is displayed in a

format that may be reused as input.

??A??signals the end of options and disables further option processing.Any arguments after the??are treated as ?lenames and arguments. An argument of?is equivalent to??.

Bash also interprets a number of multi-character options.These options must appear on the command line before the single-character options to be recognized.

??debugger

Arrange for the debugger pro?le to be executed before the shell starts.Turns on extended debug-

ging mode (see the description of the extdebug option to the shopt builtin below).

??dump?po?strings

Equivalent to?D,but the output is in the GNU gettext po(portable object) ?le format.

??dump?strings

Equivalent to?D.

??help Display a usage message on standard output and exit successfully.

??init??le?le

??rc?le?le

Execute commands from?le instead of the standard personal initialization ?le?/.bashrc if the

shell is interactive (see INVOCATION below).

??login

Equivalent to?l.

??noediting

Do not use the GNU readline library to read command lines when the shell is interactive.

??nopro?le

Do not read either the system-wide startup ?le/etc/pro?le or any of the personal initialization ?les

?/.bash_pro?le,?/.bash_login,or?/.pro?le.By default,bash reads these ?les when it is invoked as

a login shell (see INVOCATION below).

??norc Do not read and execute the personal initialization ?le?/.bashrc if the shell is interactive.This option is on by default if the shell is invoked as sh.

??posix

Change the behavior of bash where the default operation differs from the POSIX standard to

match the standard (posix mode).

??restricted

The shell becomes restricted (see RESTRICTED SHELL below).

??verbose

Equivalent to?v.

??version

Show version information for this instance of bash on the standard output and exit successfully. ARGUMENTS

If arguments remain after option processing, and neither the?c nor the?s option has been supplied, the ?rst argument is assumed to be the name of a ?le containing shell commands.If bash is invoked in this fashion, $0is set to the name of the ?le, and the positional parameters are set to the remaining arguments.Bash reads and executes commands from this ?le, then exits.Bash’s exit status is the exit status of the last com-mand executed in the script.If no commands are executed, the exit status is 0.An attempt is ?rst made to open the ?le in the current directory,and, if no ?le is found, then the shell searches the directories in PATH for the script.

INVOCATION

A login shell is one whose ?rst character of argument zero is a?,or one started with the??login option.

An interactive shell is one started without non-option arguments and without the?c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the?i option.PS1is set and$?includes i if bash is interactive,allowing a shell script or a startup ?le to test this state.

The following paragraphs describe how bash executes its startup ?les.If any of the ?les exist but cannot be read,bash reports an error.Tildes are expanded in ?le names as described below under Tilde Expansion in the EXPANSION section.

When bash is invoked as an interactive login shell, or as a non-interactive shell with the??login option, it ?rst reads and executes commands from the ?le/etc/pro?le,if that ?le exists. After reading that ?le, it looks for?/.bash_pro?le,?/.bash_login,and?/.pro?le,in that order,and reads and executes commands from the ?rst one that exists and is readable.The??nopro?le option may be used when the shell is started to inhibit this behavior.

When a login shell exits,bash reads and executes commands from the ?le?/.bash_logout,if it exists.

When an interactive shell that is not a login shell is started,bash reads and executes commands from ?/.bashrc,if that ?le exists. This may be inhibited by using the??norc option. The??rc?le?le option will force bash to read and execute commands from?le instead of?/.bashrc.

When bash is started non-interactively,to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a ?le to read and execute.Bash behaves as if the following command were executed:

if [ ?n "$BASH_ENV" ]; then . "$BASH_ENV"; fi

but the value of the PATH variable is not used to search for the ?le name.

If bash is invoked with the name sh,it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.When invoked as an interactive login shell, or a non-interactive shell with the??login option, it ?rst attempts to read and execute commands from/etc/pro?le and?/.pro?le,in that order.The??nopro?le option may be used to inhibit this behavior.

When invoked as an interactive shell with the name sh,bash looks for the variable ENV,expands its value if it is de?ned, and uses the expanded value as the name of a ?le to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup ?les, the??rc?le option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any other startup ?les.

When invoked as sh,bash enters posix mode after the startup ?les are read.

When bash is started in posix mode, as with the??posix command line option, it follows the POSIX stan-dard for startup ?les.In this mode, interactive shells expand the ENV variable and commands are read and executed from the ?le whose name is the expanded value. No other startup ?les are read.

Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd,or the secure shell daemon sshd.If bash deter-mines it is being run in this fashion, it reads and executes commands from?/.bashrc,if that ?le exists and is readable. It will not do this if invoked as sh.The??norc option may be used to inhibit this behavior,and the??rc?le option may be used to force another ?le to be read, but rshd does not generally invoke the shell with those options or allow them to be speci?ed.

If the shell is started with the effective user (group) id not equal to the real user (group) id, and the?p option is not supplied, no startup ?les are read, shell functions are not inherited from the environment, the SHELLOPTS,BASHOPTS,CDPATH,and GLOBIGNORE variables, if they appear in the environment, are ignored, and the effective user id is set to the real user id.If the?p option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset.

DEFINITIONS

The following de?nitions are used throughout the rest of this document.

blank A space or tab.

word A sequence of characters considered as a single unit by the shell.Also known as a token.

name A word consisting only of alphanumeric characters and underscores, and beginning with an alpha-betic character or an underscore.Also referred to as an identi?er.

metacharacter

A character that, when unquoted, separates words. One of the following:

|&;()<>space tab

control operator

A token that performs a control function.It is one of the following symbols:

|| & && ; ;; ( ) | |&

RESERVED WORDS

Reserved words are words that have a special meaning to the shell.The following words are recognized as reserved when unquoted and either the ?rst word of a simple command (see SHELL GRAMMAR below) or the third word of a case or for command:

!case do done elif else esac ? for function if in select then until

while { } time [[ ]]

SHELL GRAMMAR

Simple Commands

A simple command is a sequence of optional variable assignments followed by blank-separated words and

redirections, and terminated by a control operator.The ?rst word speci?es the command to be executed, and is passed as argument zero.The remaining words are passed as arguments to the invoked command.

The return value of a simple command is its exit status, or 128+n if the command is terminated by signal n.

Pipelines

A pipeline is a sequence of one or more commands separated by one of the control operators|or|&.The

format for a pipeline is:

[time[?p]] [ ! ]command[[| |&]command2... ]

The standard output of command is connected via a pipe to the standard input of command2.This connec-tion is performed before any redirections speci?ed by the command (see REDIRECTION below). If|&is used, the standard error of command is connected to command2’s standard input through the pipe; it is shorthand for2>&1 |.This implicit redirection of the standard error is performed after any redirections speci?ed by the command.

The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled.

If pipefail is enabled, the pipeline’s return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully.If the reserved word!precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status as described above.The shell waits for all commands in the pipeline to terminate before returning a value.

If the time reserved word precedes a pipeline, the elapsed as well as user and system time consumed by its execution are reported when the pipeline terminates.The?p option changes the output format to that spec-i?ed by POSIX.When the shell is in posix mode,it does not recognize time as a reserved word if the next token begins with a ‘-’.The TIMEFORMAT variable may be set to a format string that speci?es how the timing information should be displayed; see the description of TIMEFORMAT under Shell Variables below.

When the shell is in posix mode,time may be followed by a newline. In this case, the shell displays the total user and system time consumed by the shell and its children.The TIMEFORMAT variable may be used to specify the format of the time information.

Each command in a pipeline is executed as a separate process (i.e., in a subshell).

Lists

A list is a sequence of one or more pipelines separated by one of the operators;,&,&&,or||,and option-

ally terminated by one of;,&,or.

Of these list operators,&&and||have equal precedence, followed by;and&,which have equal prece-dence.

A sequence of one or more newlines may appear in a list instead of a semicolon to delimit commands.

If a command is terminated by the control operator&,the shell executes the command in the background in

a subshell. The shell does not wait for the command to ?nish, and the return status is https://www.doczj.com/doc/2c15174401.html,mands sepa-

rated by a;are executed sequentially; the shell waits for each command to terminate in turn.The return status is the exit status of the last command executed.

AND and OR lists are sequences of one of more pipelines separated by the&&and||control operators, respectively.AND and OR lists are executed with left associativity.An AND list has the form command1&&command2

command2is executed if, and only if,command1returns an exit status of zero.

An OR list has the form

command1||command2

command2is executed if and only if command1returns a non-zero exit status.The return status of AND and OR lists is the exit status of the last command executed in the list.

Compound Commands

A compound command is one of the following:

(list)list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below).

Variable assignments and builtin commands that affect the shell’s environment do not remain in

effect after the command completes.The return status is the exit status of list.

{list;}list is simply executed in the current shell environment.list must be terminated with a newline or semicolon. This is known as a group command.The return status is the exit status of list.Note

that unlike the metacharacters(and),{and}are reserved words and must occur where a reserved

word is permitted to be recognized.Since they do not cause a word break, they must be separated from list by whitespace or another shell metacharacter.

((expression))

The expression is evaluated according to the rules described below under ARITHMETIC EV ALUA-TION.If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1.This is exactly equivalent to let "expression".

[[expression]]

Return a status of 0 or 1 depending on the evaluation of the conditional expression expression.

Expressions are composed of the primaries described below under CONDITIONAL EXPRES-SIONS.Word splitting and pathname expansion are not performed on the words between the[[ and]];tilde expansion, parameter and variable expansion, arithmetic expansion, command substi-tution, process substitution, and quote removal are performed.Conditional operators such as?f must be unquoted to be recognized as primaries.

When used with[[,theoperators sort lexicographically using the current locale.

When the==and!=operators are used, the string to the right of the operator is considered a pat-tern and matched according to the rules described below under Pattern Matching.If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters. The return value is 0 if the string matches (==)or does not match (!=)the pattern, and 1otherwise. Any part of the pattern may be quoted to force it to be matched as a string.

An additional binary operator,=?,is available, with the same precedence as==and!=.When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in regex(3)). The return value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional expression’s return value is 2.If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters.Any part of the pattern may be quoted to force it to be matched as a string.Substrings matched by parenthesized subexpressions within the regular expression are saved in the array variable BASH_REMATCH.The element of BASH_REMATCH with index0is the portion of the string matching the entire regular expression. The element of BASH_REMATCH with index n is the portion of the string matching the n th parenthesized subexpression.

Expressions may be combined using the following operators, listed in decreasing order of prece-dence:

(expression)

Returns the value of expression.This may be used to override the normal precedence of

operators.

!expression

True if expression is false.

expression1&&expression2

True if both expression1and expression2are true.

expression1||expression2

True if either expression1or expression2is true.

The&&and||operators do not evaluate expression2if the value of expression1is suf?cient to determine the return value of the entire conditional expression.

for name[[in[word...]];]do list;done

The list of words following in is expanded, generating a list of items.The variable name is set to each element of this list in turn, and list is executed each time.If the in word is omitted, the for command executes list once for each positional parameter that is set (see PARAMETERS below).

The return status is the exit status of the last command that executes. If the expansion of the items following in results in an empty list, no commands are executed, and the return status is 0.

for((expr1;expr2;expr3)) ;do list;done

First, the arithmetic expression expr1is evaluated according to the rules described below under

ARITHMETIC EV ALUATION.The arithmetic expression expr2is then evaluated repeatedly until

it evaluates to zero.Each time expr2evaluates to a non-zero value,list is executed and the arith-

metic expression expr3is evaluated. If any expression is omitted, it behaves as if it evaluates to 1.

The return value is the exit status of the last command in list that is executed, or false if any of the

expressions is invalid.

select name[in word];do list;done

The list of words following in is expanded, generating a list of items.The set of expanded words

is printed on the standard error,each preceded by a number.If the in word is omitted, the posi-

tional parameters are printed (see PARAMETERS below). The PS3prompt is then displayed and a

line read from the standard input.If the line consists of a number corresponding to one of the dis-

played words, then the value of name is set to that word. If the line is empty,the words and

prompt are displayed again. If EOF is read, the command completes.Any other value read causes

name to be set to null.The line read is saved in the variable REPLY.The list is executed after

each selection until a break command is executed. The exit status of select is the exit status of the

last command executed in list,or zero if no commands were executed.

case word in[[(]pattern[|pattern]... )list;; ] ...esac

A case command ?rst expands word,and tries to match it against each pattern in turn, using the

same matching rules as for pathname expansion (see Pathname Expansion below). The word is

expanded using tilde expansion, parameter and variable expansion, arithmetic substitution, com-

mand substitution, process substitution and quote removal. Each pattern examined is expanded

using tilde expansion, parameter and variable expansion, arithmetic substitution, command substi-

tution, and process substitution.If the shell option nocasematch is enabled, the match is per-

formed without regard to the case of alphabetic characters.When a match is found, the corre-

sponding list is executed. If the;;operator is used, no subsequent matches are attempted after the

?rst pattern https://www.doczj.com/doc/2c15174401.html,ing;&in place of;;causes execution to continue with the list associated

with the next set of https://www.doczj.com/doc/2c15174401.html,ing;;&in place of;;causes the shell to test the next pattern list in

the statement, if any, and execute any associated list on a successful match.The exit status is zero

if no pattern matches.Otherwise, it is the exit status of the last command executed in list.

if list;then list;[elif list;then list;]... [else list;]?

The if list is executed. If its exit status is zero, the then list is executed. Otherwise,each elif list

is executed in turn, and if its exit status is zero, the corresponding then list is executed and the

command completes.Otherwise, the else list is executed, if present.The exit status is the exit sta-

tus of the last command executed, or zero if no condition tested true.

while list-1;do list-2;done

until list-1;do list-2;done

The while command continuously executes the list list-2as long as the last command in the list

list-1returns an exit status of zero.The until command is identical to the while command, except

that the test is negated;list-2is executed as long as the last command in list-1returns a non-zero

exit status.The exit status of the while and until commands is the exit status of the last command

executed in list-2,or zero if none was executed.

Coprocesses

A coprocess is a shell command preceded by the coproc reserved word. A coprocess is executed asyn-

chronously in a subshell, as if the command had been terminated with the&control operator,with a two-way pipe established between the executing shell and the coprocess.

The format for a coprocess is:

coproc[NAME]command[redirections]

This creates a coprocess named NAME.If NAME is not supplied, the default name is https://www.doczj.com/doc/2c15174401.html, must not be supplied if command is a simple command(see above); otherwise, it is interpreted as the ?rst word of the simple command.When the coproc is executed, the shell creates an array variable (see Arrays

below) named NAME in the context of the executing shell.The standard output of command is connected via a pipe to a ?le descriptor in the executing shell, and that ?le descriptor is assigned to NAME[0]. The standard input of command is connected via a pipe to a ?le descriptor in the executing shell, and that ?le descriptor is assigned to NAME[1]. This pipe is established before any redirections speci?ed by the com-mand (see REDIRECTION below). The?le descriptors can be utilized as arguments to shell commands and redirections using standard word expansions. The process ID of the shell spawned to execute the coprocess is available as the value of the variable NAME_PID. The wait builtin command may be used to wait for the coprocess to terminate.

The return status of a coprocess is the exit status of command.

Shell Function De?nitions

A shell function is an object that is called like a simple command and executes a compound command with

a new set of positional parameters.Shell functions are declared as follows:

name()compound?command[redirection]

function name[()]compound?command[redirection]

This de?nes a function named name.The reserved word function is optional.If the function

reserved word is supplied, the parentheses are optional.The body of the function is the compound

command compound?command(see Compound Commands above). That command is usually a

list of commands between { and }, but may be any command listed under Compound Commands

https://www.doczj.com/doc/2c15174401.html,pound?command is executed whenever name is speci?ed as the name of a simple

command. Any redirections (see REDIRECTION below) speci?ed when a function is de?ned are

performed when the function is executed. The exit status of a function de?nition is zero unless a

syntax error occurs or a readonly function with the same name already exists. When executed, the

exit status of a function is the exit status of the last command executed in the body.(See FUNC-

TIONS below.)

COMMENTS

In a non-interactive shell, or an interactive shell in which the interactive_comments option to the shopt builtin is enabled (see SHELL BUILTIN COMMANDS below), a word beginning with#causes that word and all remaining characters on that line to be ignored.An interactive shell without the interactive_com-ments option enabled does not allow comments. The interactive_comments option is on by default in interactive shells.

QUOTING

Quoting is used to remove the special meaning of certain characters or words to the shell.Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion.

Each of the metacharacters listed above under DEFINITIONS has special meaning to the shell and must be quoted if it is to represent itself.

When the command history expansion facilities are being used (see HISTORY EXPANSION below), the history expansion character,usually!,must be quoted to prevent history expansion.

There are three quoting mechanisms: the escape character,single quotes, and double quotes.

A non-quoted backslash (\)is the escape character.It preserves the literal value of the next character that

follows, with the exception of . If a\ pair appears, and the backslash is not itself quoted, the\ is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).

Enclosing characters in single quotes preserves the literal value of each character within the quotes.A sin-gle quote may not occur between single quotes, even when preceded by a backslash.

Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of$,`,\,and, when history expansion is enabled,!.The characters$and`retain their special meaning within double quotes.The backslash retains its special meaning only when followed by one of the following characters:$,`,",\,or.A double quote may be quoted within double quotes by pre-ceding it with a backslash.If enabled, history expansion will be performed unless an!appearing in double

quotes is escaped using a backslash.The backslash preceding the!is not removed.

The special parameters*and@have special meaning when in double quotes (see PARAMETERS below).

Words of the form$'string'are treated specially.The word expands to string,with backslash-escaped char-acters replaced as speci?ed by the ANSI C standard.Backslash escape sequences, if present, are decoded as follows:

\a alert (bell)

\b backspace

\e

\E an escape character

\f form feed

\n new line

\r carriage return

\t horizontal tab

\v vertical tab

\\backslash

\'single quote

\"double quote

\nnn the eight-bit character whose value is the octal value nnn(one to three digits)

\x HH the eight-bit character whose value is the hexadecimal value HH(one or two hex digits)

\u HHHH

the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH

(one to four hex digits)

\U HHHHHHHH

the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHH-

HHH(one to eight hex digits)

\c x a control-x character

The expanded result is single-quoted, as if the dollar sign had not been present.

A double-quoted string preceded by a dollar sign ($"string") will cause the string to be translated according

to the current locale.If the current locale is C or POSIX,the dollar sign is ignored.If the string is trans-lated and replaced, the replacement is double-quoted.

PARAMETERS

A parameter is an entity that stores values. It can be a name,a number,or one of the special characters

listed below under Special Parameters.A variable is a parameter denoted by a name.A variable has a value and zero or more attributes.Attributes are assigned using the declare builtin command (see declare below in SHELL BUILTIN COMMANDS).

A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it

may be unset only by using the unset builtin command (see SHELL BUILTIN COMMANDS below).

A variable may be assigned to by a statement of the form

name=[value]

If value is not given, the variable is assigned the null string.All values undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal(see EXPANSION below). If the variable has its integer attribute set, then value is evaluated as an arithmetic expression even if the $((...)) expansion is not used (see Arithmetic Expansion below). Word splitting is not performed, with the exception of"$@"as explained below under Special Parameters.Pathname expansion is not performed. Assignment statements may also appear as arguments to the alias,declare,typeset,export, readonly,and local builtin commands.

In the context where an assignment statement is assigning a value to a shell variable or array index, the += operator can be used to append to or add to the variable’s previous value. When+= is applied to a variable for which the integer attribute has been set,value is evaluated as an arithmetic expression and added to the variable’s current value, which is also evaluated. When+= is applied to an array variable using compound

assignment (see Arrays below), the variable’s value is not unset (as it is when using =), and new values are appended to the array beginning at one greater than the array’s maximum index(for indexed arrays) or added as additional key?value pairs in an associative array.When applied to a string-valued variable,value is expanded and appended to the variable’s value.

Positional Parameters

A positional parameter is a parameter denoted by one or more digits, other than the single digit 0.Posi-

tional parameters are assigned from the shell’s arguments when it is invoked, and may be reassigned using the set builtin command.Positional parameters may not be assigned to with assignment statements.The positional parameters are temporarily replaced when a shell function is executed (see FUNCTIONS below).

When a positional parameter consisting of more than a single digit is expanded, it must be enclosed in braces (see EXPANSION below).

Special Parameters

The shell treats several parameters specially.These parameters may only be referenced; assignment to them is not allowed.

*Expands to the positional parameters, starting from one.When the expansion occurs within dou-ble quotes, it expands to a single word with the value of each parameter separated by the ?rst char-

acter of the IFS special variable. That is, "$*"is equivalent to "$1c$2c...", where c is the ?rst char-

acter of the value of the IFS variable. If IFS is unset, the parameters are separated by spaces.If

IFS is null, the parameters are joined without intervening separators.

@Expands to the positional parameters, starting from one.When the expansion occurs within dou-ble quotes, each parameter expands to a separate word. That is, "$@"is equivalent to "$1""$2"...

If the double-quoted expansion occurs within a word, the expansion of the ?rst parameter is joined

with the beginning part of the original word, and the expansion of the last parameter is joined with

the last part of the original word. When there are no positional parameters, "$@"and$@expand

to nothing (i.e., they are removed).

#Expands to the number of positional parameters in decimal.

?Expands to the exit status of the most recently executed foreground pipeline.

?Expands to the current option ?ags as speci?ed upon invocation, by the set builtin command, or those set by the shell itself (such as the?i option).

$Expands to the process ID of the shell.In a () subshell, it expands to the process ID of the current shell, not the subshell.

!Expands to the process ID of the most recently executed background (asynchronous) command.

0Expands to the name of the shell or shell script.This is set at shell initialization.If bash is invoked with a ?le of commands,$0is set to the name of that ?le.If bash is started with the?c

option, then$0is set to the ?rst argument after the string to be executed, if one is present.Other-

wise, it is set to the ?le name used to invoke bash,as giv e n by argument zero.

_At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list.Subsequently,expands to the last argument to the

previous command, after expansion. Also set to the full pathname used to invoke each command

executed and placed in the environment exported to that command.When checking mail, this

parameter holds the name of the mail ?le currently being checked.

Shell Variables

The following variables are set by the shell:

BASH Expands to the full ?le name used to invoke this instance of bash.

BASHOPTS

A colon-separated list of enabled shell options.Each word in the list is a valid argument for the?s

option to the shopt builtin command (see SHELL BUILTIN COMMANDS below). The options

appearing in BASHOPTS are those reported as on by shopt.If this variable is in the environment

when bash starts up, each shell option in the list will be enabled before reading any startup ?les.

This variable is read-only.

BASHPID

Expands to the process ID of the current bash process. This differs from$$under certain circum-stances, such as subshells that do not require bash to be re-initialized.

BASH_ALIASES

An associative array variable whose members correspond to the internal list of aliases as main-tained by the alias builtin. Elements added to this array appear in the alias list; unsetting array ele-ments cause aliases to be removed from the alias list.

BASH_ARGC

An array variable whose values are the number of parameters in each frame of the current bash execution call stack.The number of parameters to the current subroutine (shell function or script executed with.or source)is at the top of the stack.When a subroutine is executed, the number of parameters passed is pushed onto BASH_ARGC.The shell sets BASH_ARGC only when in extended debugging mode (see the description of the extdebug option to the shopt builtin below) BASH_ARGV

An array variable containing all of the parameters in the current bash execution call stack.The ?nal parameter of the last subroutine call is at the top of the stack; the ?rst parameter of the initial call is at the bottom.When a subroutine is executed, the parameters supplied are pushed onto BASH_ARGV.The shell sets BASH_ARGV only when in extended debugging mode (see the description of the extdebug option to the shopt builtin below)

BASH_CMDS

An associative array variable whose members correspond to the internal hash table of commands as maintained by the hash builtin. Elements added to this array appear in the hash table; unsetting array elements cause commands to be removed from the hash table.

BASH_COMMAND

The command currently being executed or about to be executed, unless the shell is executing a command as the result of a trap, in which case it is the command executing at the time of the trap. BASH_EXECUTION_STRING

The command argument to the?c invocation option.

BASH_LINENO

An array variable whose members are the line numbers in source ?les where each corresponding member of FUNCNAME was inv o ked.${BASH_LINENO[$i]}is the line number in the source ?le (${BASH_SOURCE[$i+1]})where${FUNCNAME[$i]}was called (or ${BASH_LINENO[$i-1]}if referenced within another shell function).Use LINENO to obtain the current line number.

BASH_REMATCH

An array variable whose members are assigned by the=?binary operator to the[[conditional com-mand. The element with index0is the portion of the string matching the entire regular expression.

The element with index n is the portion of the string matching the n th parenthesized subexpres-sion. This variable is read-only.

BASH_SOURCE

An array variable whose members are the source ?lenames where the corresponding shell function names in the FUNCNAME array variable are de?ned.The shell function${FUNCNAME[$i]}is de?ned in the ?le${BASH_SOURCE[$i]}and called from${BASH_SOURCE[$i+1]}.

BASH_SUBSHELL

Incremented by one each time a subshell or subshell environment is spawned. The initial value is 0.

BASH_VERSINFO

A readonly array variable whose members hold version information for this instance of bash.The

values assigned to the array members are as follows:

BASH_VERSINFO[0]The major version number (the release).

BASH_VERSINFO[1]The minor version number (the version).

BASH_VERSINFO[2]The patch level.

BASH_VERSINFO[3]The build version.

BASH_VERSINFO[4]The release status (e.g.,beta1).

BASH_VERSINFO[5]The value of MACHTYPE.

BASH_VERSION

Expands to a string describing the version of this instance of bash.

COMP_CWORD

An index into${COMP_WORDS}of the word containing the current cursor position.This vari-able is available only in shell functions invoked by the programmable completion facilities (see Programmable Completion below).

COMP_KEY

The key (or ?nal key of a key sequence) used to invoke the current completion function.

COMP_LINE

The current command line.This variable is available only in shell functions and external com-mands invoked by the programmable completion facilities (see Programmable Completion below).

COMP_POINT

The index of the current cursor position relative to the beginning of the current command.If the current cursor position is at the end of the current command, the value of this variable is equal to ${#COMP_LINE}.This variable is available only in shell functions and external commands invoked by the programmable completion facilities (see Programmable Completion below). COMP_TYPE

Set to an integer value corresponding to the type of completion attempted that caused a completion function to be called:TAB,for normal completion,?,for listing completions after successive tabs, !,for listing alternatives on partial word completion,@,to list completions if the word is not unmodi?ed, or%,for menu completion.This variable is available only in shell functions and external commands invoked by the programmable completion facilities (see Programmable Completion below).

COMP_WORDBREAKS

The set of characters that the readline library treats as word separators when performing word completion. If COMP_WORDBREAKS is unset, it loses its special properties, even if it is subse-quently reset.

COMP_WORDS

An array variable (see Arrays below) consisting of the individual words in the current command line. The line is split into words as readline would split it, using COMP_WORDBREAKS as described above.This variable is available only in shell functions invoked by the programmable completion facilities (see Programmable Completion below).

COPROC

An array variable (see Arrays below) created to hold the ?le descriptors for output from and input to an unnamed coprocess (see Coprocesses above).

DIRSTACK

An array variable (see Arrays below) containing the current contents of the directory stack.

Directories appear in the stack in the order they are displayed by the dirs builtin. Assigning to members of this array variable may be used to modify directories already in the stack, but the pushd and popd builtins must be used to add and remove directories. Assignment to this variable will not change the current directory.If DIRSTACK is unset, it loses its special properties, even if it is subsequently reset.

EUID Expands to the effective user ID of the current user,initialized at shell startup.This variable is readonly.

FUNCNAME

An array variable containing the names of all shell functions currently in the execution call stack.

The element with index0is the name of any currently-executing shell function.The bottom-most element (the one with the highest index) is"main".This variable exists only when a shell func-tion is executing. Assignments to FUNCNAME have no effect and return an error status.If FUNC-NAME is unset, it loses its special properties, even if it is subsequently reset.

This variable can be used with BASH_LINENO and BASH_SOURCE.Each element of

FUNCNAME has corresponding elements in BASH_LINENO and BASH_SOURCE to describe the call stack.For instance,${FUNCNAME[$i]}was called from the ?le ${BASH_SOURCE[$i+1]}at line number${BASH_LINENO[$i]}.The caller builtin displays the current call stack using this information.

GROUPS

An array variable containing the list of groups of which the current user is a member.Assign-ments to GROUPS have no effect and return an error status.If GROUPS is unset, it loses its spe-cial properties, even if it is subsequently reset.

HISTCMD

The history number,or index in the history list, of the current command.If HISTCMD is unset, it loses its special properties, even if it is subsequently reset.

HOSTNAME

Automatically set to the name of the current host.

HOSTTYPE

Automatically set to a string that uniquely describes the type of machine on which bash is execut-ing. The default is system-dependent.

LINENO

Each time this parameter is referenced, the shell substitutes a decimal number representing the current sequential line number (starting with 1) within a script or function.When not in a script or function, the value substituted is not guaranteed to be meaningful.If LINENO is unset, it loses its special properties, even if it is subsequently reset.

MACHTYPE

Automatically set to a string that fully describes the system type on which bash is executing, in the standard GNU cpu-company-system format. The default is system-dependent.

MAPFILE

An array variable (see Arrays below) created to hold the text read by the map?le builtin when no variable name is supplied.

OLDPWD

The previous working directory as set by the cd command.

OPTARG

The value of the last option argument processed by the getopts builtin command (see SHELL BUILTIN COMMANDS below).

OPTIND

The index of the next argument to be processed by the getopts builtin command (see SHELL BUILTIN COMMANDS below).

OSTYPE

Automatically set to a string that describes the operating system on which bash is executing. The default is system-dependent.

PIPESTATUS

An array variable (see Arrays below) containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command). PPID The process ID of the shell’s parent. This variable is readonly.

PWD The current working directory as set by the cd command.

RANDOM

Each time this parameter is referenced, a random integer between 0 and 32767 is generated.The sequence of random numbers may be initialized by assigning a value to RANDOM.If RANDOM is unset, it loses its special properties, even if it is subsequently reset.

READLINE_LINE

The contents of the readline line buffer,for use with bind -x(see SHELL BUILTIN COM-MANDS below).

READLINE_POINT

The position of the insertion point in the readline line buffer,for use with bind -x(see SHELL BUILTIN COMMANDS below).

REPLY

Set to the line of input read by the read builtin command when no arguments are supplied. SECONDS

Each time this parameter is referenced, the number of seconds since shell invocation is returned.

If a value is assigned to SECONDS,the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned.If SECONDS is unset, it loses its special properties, even if it is subsequently reset.

SHELLOPTS

A colon-separated list of enabled shell options.Each word in the list is a valid argument for the

?o option to the set builtin command (see SHELL BUILTIN COMMANDS below). The options appearing in SHELLOPTS are those reported as on by set ?o.If this variable is in the environment when bash starts up, each shell option in the list will be enabled before reading any startup ?les.

This variable is read-only.

SHLVL

Incremented by one each time an instance of bash is started.

UID Expands to the user ID of the current user,initialized at shell startup.This variable is readonly. The following variables are used by the shell.In some cases,bash assigns a default value to a variable; these cases are noted below.

BASH_ENV

If this parameter is set when bash is executing a shell script, its value is interpreted as a ?lename containing commands to initialize the shell, as in?/.bashrc.The value of BASH_ENV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a ?le name.PATH is not used to search for the resultant ?le name.

BASH_XTRACEFD

If set to an integer corresponding to a valid ?le descriptor,bash will write the trace output gener-ated when set -x is enabled to that ?le descriptor.The ?le descriptor is closed when BASH_XTRACEFD is unset or assigned a new value. Unsetting BASH_XTRACEFD or assigning it the empty string causes the trace output to be sent to the standard error.Note that setting BASH_XTRACEFD to 2 (the standard error ?le descriptor) and then unsetting it will result in the standard error being closed.

CDPATH

The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories speci?ed by the cd command. A sample value is ".:?:/usr".

COLUMNS

Used by the select compound command to determine the terminal width when printing selection lists. Automatically set upon receipt of a SIGWINCH.

COMPREPLY

An array variable from which bash reads the possible completions generated by a shell function invoked by the programmable completion facility (see Programmable Completion below). EMACS

If bash?nds this variable in the environment when the shell starts with value t,it assumes that the shell is running in an Emacs shell buffer and disables line editing.

ENV Similar to BASH_ENV;used when the shell is invoked in POSIX mode.

FCEDIT

The default editor for the fc builtin command.

FIGNORE

A colon-separated list of suf?xes to ignore when performing ?lename completion (see READLINE

below). A?lename whose suf?x matches one of the entries in FIGNORE is excluded from the list of matched ?lenames.A sample value is".o:?".

FUNCNEST

If set to a numeric value greater than 0, de?nes a maximum function nesting level. Function invocations that exceed this nesting level will cause the current command to abort.

GLOBIGNORE

A colon-separated list of patterns de?ning the set of ?lenames to be ignored by pathname expan-

sion. If a?lename matched by a pathname expansion pattern also matches one of the patterns in GLOBIGNORE,it is removed from the list of matches.

HISTCONTROL

A colon-separated list of values controlling how commands are saved on the history list.If the list

of values includes ignorespace,lines which begin with a space character are not saved in the his-tory list.A value of ignoredups causes lines matching the previous history entry to not be saved.

A value of ignoreboth is shorthand for ignorespace and ignoredups.A value of erasedups causes

all previous lines matching the current line to be removed from the history list before that line is saved. Any value not in the above list is ignored.If HISTCONTROL is unset, or does not include

a valid value, all lines read by the shell parser are saved on the history list, subject to the value of

HISTIGNORE.The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTCONTROL.

HISTFILE

The name of the ?le in which command history is saved(see HISTORY below). The default value is?/.bash_history.If unset, the command history is not saved when an interactive shell exits. HISTFILESIZE

The maximum number of lines contained in the history ?le.When this variable is assigned a value, the history ?le is truncated, if necessary,by removing the oldest entries, to contain no more than that number of lines.The default value is 500.The history ?le is also truncated to this size after writing it when an interactive shell exits.

HISTIGNORE

A colon-separated list of patterns used to decide which command lines should be saved on the his-

tory list.Each pattern is anchored at the beginning of the line and must match the complete line (no implicit ‘*’is appended). Each pattern is tested against the line after the checks speci?ed by HISTCONTROL are applied.In addition to the normal shell pattern matching characters, ‘&’matches the previous history line.‘&’may be escaped using a backslash; the backslash is removed before attempting a match.The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTIGNORE. HISTSIZE

The number of commands to remember in the command history (see HISTORY below). The default value is 500.

HISTTIMEFORMAT

If this variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each history entry displayed by the history builtin. If this variable is set, time stamps are written to the history ?le so they may be preserved across shell sessions.This uses the history comment character to distinguish timestamps from other history lines.

HOME

The home directory of the current user; the default argument for the cd builtin command.The value of this variable is also used when performing tilde expansion.

HOSTFILE

Contains the name of a ?le in the same format as/etc/hosts that should be read when the shell needs to complete a hostname.The list of possible hostname completions may be changed while the shell is running; the next time hostname completion is attempted after the value is changed, bash adds the contents of the new?le to the existing list.If HOSTFILE is set, but has no value, or does not name a readable ?le,bash attempts to read/etc/hosts to obtain the list of possible host-name completions.When HOSTFILE is unset, the hostname list is cleared.

IFS The Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command.The default value is ‘‘’’. IGNOREEOF

Controls the action of an interactive shell on receipt of an EOF character as the sole input.If set, the value is the number of consecutive EOF characters which must be typed as the ?rst characters on an input line before bash exits. If the variable exists but does not have a numeric value, or has

no value, the default value is 10.If it does not exist,EOF signi?es the end of input to the shell. INPUTRC

The ?lename for the readline startup ?le, overriding the default of?/.inputrc(see READLINE below).

LANG Used to determine the locale category for any category not speci?cally selected with a variable starting with LC_.

LC_ALL

This variable overrides the value of LANG and any other LC_variable specifying a locale cate-gory.

LC_COLLATE

This variable determines the collation order used when sorting the results of pathname expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within pathname expansion and pattern matching.

LC_CTYPE

This variable determines the interpretation of characters and the behavior of character classes within pathname expansion and pattern matching.

LC_MESSAGES

This variable determines the locale used to translate double-quoted strings preceded by a$.

LC_NUMERIC

This variable determines the locale category used for number formatting.

LINES Used by the select compound command to determine the column length for printing selection lists.

Automatically set upon receipt of a SIGWINCH.

MAIL If this parameter is set to a ?le or directory name and the MAILPATH variable is not set,bash informs the user of the arrival of mail in the speci?ed ?le or Maildir-format directory. MAILCHECK

Speci?es how often (in seconds)bash checks for mail.The default is 60 seconds.When it is time to check for mail, the shell does so before displaying the primary prompt.If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking. MAILPATH

A colon-separated list of ?le names to be checked for mail.The message to be printed when mail

arrives in a particular ?le may be speci?ed by separating the ?le name from the message with a ‘?’. When used in the text of the message,$_expands to the name of the current mail?le.Exam-ple:

MAILPATH='/var/mail/bfox?"You have mail":?/shell?mail?"$_ has mail!"'

Bash supplies a default value for this variable, but the location of the user mail ?les that it uses is system dependent (e.g., /var/mail/$USER).

OPTERR

If set to the value 1,bash displays error messages generated by the getopts builtin command (see SHELL BUILTIN COMMANDS below).OPTERR is initialized to 1 each time the shell is invoked or a shell script is executed.

PATH The search path for commands.It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the value of PATH indicates the current directory.A null directory name may appear as two adjacent colons, or as an initial or trailing colon.The default path is system-dependent, and is set by the administrator who installs bash.A common value is /usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin.

POSIXLY_CORRECT

If this variable is in the environment when bash starts, the shell enters posix mode before reading the startup ?les, as if the??posix invocation option had been supplied.If it is set while the shell is running,bash enables posix mode,as if the command set -o posix had been executed. PROMPT_COMMAND

If set, the value is executed as a command prior to issuing each primary prompt.

PROMPT_DIRTRIM

If set to a number greater than zero, the value is used as the number of trailing directory compo-nents to retain when expanding the\w and\W prompt string escapes (see PROMPTING below).

Characters removed are replaced with an ellipsis.

PS1The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is ‘‘\s?\v\$’’.

PS2The value of this parameter is expanded as with PS1and used as the secondary prompt string.The default is ‘‘>’’.

PS3The value of this parameter is used as the prompt for the select command (see SHELL GRAM-MAR above).

PS4The value of this parameter is expanded as with PS1and the value is printed before each command bash displays during an execution trace.The ?rst character of PS4is replicated multiple times, as necessary,to indicate multiple levels of indirection.The default is ‘‘+’’.

SHELL

The full pathname to the shell is kept in this environment variable. If it is not set when the shell starts,bash assigns to it the full pathname of the current user’s login shell.

TIMEFORMAT

The value of this parameter is used as a format string specifying how the timing information for pipelines pre?xed with the time reserved word should be displayed.The%character introduces an escape sequence that is expanded to a time value or other information.The escape sequences and their meanings are as follows; the braces denote optional portions.

%%A literal%.

%[p][l]R The elapsed time in seconds.

%[p][l]U The number of CPU seconds spent in user mode.

%[p][l]S The number of CPU seconds spent in system mode.

%P The CPU percentage, computed as (%U + %S) / %R.

The optional p is a digit specifying the precision,the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output.At most three places after the decimal point may be speci?ed; values of p greater than 3 are changed to 3.If p is not speci?ed, the value 3 is used.

The optional l speci?es a longer format, including minutes, of the form MM m SS.FF s. The value of p determines whether or not the fraction is included.

If this variable is not set,bash acts as if it had the value$'\nreal\t%3lR\nuser\t%3lU\nsys%3lS'.

If the value is null, no timing information is displayed.A trailing newline is added when the for-mat string is displayed.

TMOUT

If set to a value greater than zero,TMOUT is treated as the default timeout for the read builtin.

The select command terminates if input does not arrive after TMOUT seconds when input is com-ing from a terminal.In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt.Bash terminates after waiting for that number of seconds if input does not arrive.

TMPDIR

If set,bash uses its value as the name of a directory in which bash creates temporary ?les for the shell’s use.

auto_resume

This variable controls how the shell interacts with the user and job control.If this variable is set, single word simple commands without redirections are treated as candidates for resumption of an existing stopped job.There is no ambiguity allowed; if there is more than one job beginning with the string typed, the job most recently accessed is selected.The name of a stopped job, in this context, is the command line used to start it.If set to the value exact,the string supplied must match the name of a stopped job exactly; if set to substring,the string supplied needs to match a substring of the name of a stopped job.The substring value provides functionality analogous to the%?job identi?er (see JOB CONTROL below). If set to any other value, the supplied string

must be a pre?x of a stopped job’s name; this provides functionality analogous to the%string job

identi?er.

histchars

The two or three characters which control history expansion and tokenization (see HISTORY

EXPANSION below). The?rst character is the history expansion character,the character which

signals the start of a history expansion, normally ‘!’. The second character is the quick substitu-

tion character,which is used as shorthand for re-running the previous command entered, substitut-

ing one string for another in the command.The default is ‘?’. The optional third character is the

character which indicates that the remainder of the line is a comment when found as the ?rst char-

acter of a word, normally ‘#’. The history comment character causes history substitution to be

skipped for the remaining words on the line.It does not necessarily cause the shell parser to treat

the rest of the line as a comment.

Arrays

Bash provides one-dimensional indexed and associative array variables. Any variable may be used as an indexed array; the declare builtin will explicitly declare an array.There is no maximum limit on the size of an array,nor any requirement that members be indexed or assigned contiguously.Indexed arrays are refer-enced using integers (including arithmetic expressions) and are zero-based; associative arrays are refer-enced using arbitrary strings.

An indexed array is created automatically if any variable is assigned to using the syntax name[sub-script]=value.The subscript is treated as an arithmetic expression that must evaluate to a number.If sub-script evaluates to a number less than zero, it is used as an offset from one greater than the array’s maxi-mum index(so a subcript of -1 refers to the last element of the array).To explicitly declare an indexed array,use declare?a name(see SHELL BUILTIN COMMANDS below).declare?a name[subscript]is also accepted; the subscript is ignored.

Associative arrays are created using declare?A name.

Attributes may be speci?ed for an array variable using the declare and readonly builtins. Each attribute applies to all members of an array.

Arrays are assigned to using compound assignments of the form name=(value1... value n),where each value is of the form [subscript]=string.Indexed array assignments do not require the bracket and subscript.

When assigning to indexed arrays, if the optional brackets and subscript are supplied, that index is assigned to; otherwise the index of the element assigned is the last index assigned to by the statement plus one.

Indexing starts at zero.

When assigning to an associative array,the subscript is required.

This syntax is also accepted by the declare builtin. Individual array elements may be assigned to using the name[subscript]=value syntax introduced above.

Any element of an array may be referenced using ${name[subscript]}. The braces are required to avoid con?icts with pathname expansion. If subscript is@or*,the word expands to all members of name.

These subscripts differ only when the word appears within double quotes.If the word is double-quoted, ${name[*]} expands to a single word with the value of each array member separated by the ?rst character of the IFS special variable, and ${name[@]} expands each element of name to a separate word. When there are no array members, ${name[@]} expands to nothing.If the double-quoted expansion occurs within a word, the expansion of the ?rst parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. This is analogous to the expansion of the special parameters*and@(see Special Parameters above). ${#name[subscript]} expands to the length of ${name[subscript]}. If subscript is*or@,the expansion is the number of ele-ments in the array.Referencing an array variable without a subscript is equivalent to referencing the array with a subscript of 0.

An array variable is considered set if a subscript has been assigned a value. The null string is a valid value.

The unset builtin is used to destroy arrays.unset name[subscript]destroys the array element at index sub-script.Care must be taken to avoid unwanted side effects caused by pathname expansion.unset name,

where name is an array,or unset name[subscript], where subscript is*or@,removes the entire array.

The declare,local,and readonly builtins each accept a?a option to specify an indexed array and a?A option to specify an associative array.If both options are supplied,?A takes precedence.The read builtin accepts a?a option to assign a list of words read from the standard input to an array.The set and declare builtins display array values in a way that allows them to be reused as assignments.

EXPANSION

Expansion is performed on the command line after it has been split into words. There are seven kinds of expansion performed:brace expansion,tilde expansion,parameter and variable expansion,command sub-stitution,arithmetic expansion,word splitting,and pathname expansion.

The order of expansions is: brace expansion, tilde expansion, parameter,variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion.

On systems that can support it, there is an additional expansion available:process substitution.

Only brace expansion, word splitting, and pathname expansion can change the number of words of the expansion; other expansions expand a single word to a single word. The only exceptions to this are the expansions of "$@"and "${name[@]}"as explained above (see PARAMETERS).

Brace Expansion

Brace expansion is a mechanism by which arbitrary strings may be generated.This mechanism is similar to pathname expansion,but the ?lenames generated need not exist. Patterns to be brace expanded take the form of an optional preamble,followed by either a series of comma-separated strings or a sequence expres-sion between a pair of braces, followed by an optional postscript.The preamble is pre?xed to each string contained within the braces, and the postscript is then appended to each resulting string, expanding left to right.

Brace expansions may be nested.The results of each expanded string are not sorted; left to right order is preserved. For example, a{d,c,b}e expands into ‘ade ace abe’.

A sequence expression takes the form{x..y[..incr]},where x and y are either integers or single characters,

and incr,an optional increment, is an integer.When integers are supplied, the expression expands to each number between x and y,inclusive.Supplied integers may be pre?xed with0to force each term to have the same width.When either x or y begins with a zero, the shell attempts to force all generated terms to contain the same number of digits, zero-padding where necessary.When characters are supplied, the expression expands to each character lexicographically between x and y,inclusive.Note that both x and y must be of the same type.When the increment is supplied, it is used as the difference between each term.The default increment is 1 or -1 as appropriate.

Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result.It is strictly textual.Bash does not apply any syntactic interpretation to the con-text of the expansion or the text between the braces.

A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one

unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged. A{or,may be quoted with a backslash to prevent its being considered part of a brace expres-sion. To avoid con?icts with parameter expansion, the string${is not considered eligible for brace expan-sion.

This construct is typically used as shorthand when the common pre?x of the strings to be generated is longer than in the above example:

mkdir /usr/local/src/bash/{old,new,dist,bugs}

or

chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}

Brace expansion introduces a slight incompatibility with historical versions of sh.sh does not treat open-ing or closing braces specially when they appear as part of a word, and preserves them in the output.Bash removes braces from words as a consequence of brace expansion. For example, a word entered to sh as ?le{1,2}appears identically in the output.The same word is output as?le1 ?le2after expansion by bash.

If strict compatibility with sh is desired, start bash with the+B option or disable brace expansion with the +B option to the set command (see SHELL BUILTIN COMMANDS below).

Tilde Expansion

If a word begins with an unquoted tilde character (‘?’), all of the characters preceding the ?rst unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-pre?x.If none of the characters in the tilde-pre?x are quoted, the characters in the tilde-pre?x following the tilde are treated as a possible login name.If this login name is the null string, the tilde is replaced with the value of the shell parameter HOME.If HOME is unset, the home directory of the user executing the shell is substituted instead.Other-wise, the tilde-pre?x is replaced with the home directory associated with the speci?ed login name.

If the tilde-pre?x is a ‘?+’, the value of the shell variable PWD replaces the tilde-pre?x.If the tilde-pre?x is a‘??’, the value of the shell variable OLDPWD,if it is set, is substituted.If the characters following the tilde in the tilde-pre?x consist of a number N,optionally pre?xed by a ‘+’ or a ‘?’, the tilde-pre?x is replaced with the corresponding element from the directory stack, as it would be displayed by the dirs builtin invoked with the tilde-pre?x as an argument. If the characters following the tilde in the tilde-pre?x consist of a number without a leading ‘+’ or ‘?’, ‘+’ is assumed.

If the login name is invalid, or the tilde expansion fails, the word is unchanged.

Each variable assignment is checked for unquoted tilde-pre?xes immediately following a:or the ?rst=.In these cases, tilde expansion is also performed.Consequently,one may use ?le names with tildes in assign-ments to PATH,MAILPATH,and CDPATH,and the shell assigns the expanded value.

Parameter Expansion

The ‘$’character introduces parameter expansion, command substitution, or arithmetic expansion. The parameter name or symbol to be expanded may be enclosed in braces, which are optional but serve to pro-tect the variable to be expanded from characters immediately following it which could be interpreted as part of the name.

When braces are used, the matching ending brace is the ?rst ‘}’not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion.

${parameter}

The value of parameter is substituted.The braces are required when parameter is a positional

parameter with more than one digit, or when parameter is followed by a character which is not to

be interpreted as part of its name.

If the ?rst character of parameter is an exclamation point (!), a level of variable indirection is introduced.

Bash uses the value of the variable formed from the rest of parameter as the name of the variable; this vari-able is then expanded and that value is used in the rest of the substitution, rather than the value of parame-ter itself. This is known as indirect expansion.The exceptions to this are the expansions of ${!pre?x*}and ${!name[@]} described below. The exclamation point must immediately follow the left brace in order to introduce indirection.

In each of the cases below,word is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion.

When not performing substring expansion, using the forms documented below,bash tests for a parameter that is unset or null.Omitting the colon results in a test only for a parameter that is unset.

${parameter:?word}

Use Default Values.If parameter is unset or null, the expansion of word is substituted.Other-

wise, the value of parameter is substituted.

${parameter:=word}

Assign Default Values.If parameter is unset or null, the expansion of word is assigned to

parameter.The value of parameter is then substituted.Positional parameters and special param-

eters may not be assigned to in this way.

${parameter:?word}

Display Error if Null or Unset.If parameter is null or unset, the expansion of word(or a mes-sage to that effect if word is not present) is written to the standard error and the shell, if it is not interactive,exits. Otherwise,the value of parameter is substituted.

${parameter:+word}

Use Alternate Value.If parameter is null or unset, nothing is substituted, otherwise the expan-sion of word is substituted.

${parameter:offset}

${parameter:offset:length}

Substring Expansion.Expands to up to length characters of parameter starting at the character speci?ed by offset.If length is omitted, expands to the substring of parameter starting at the char-acter speci?ed by offset.length and offset are arithmetic expressions (see ARITHMETIC EV ALU-ATION below). If offset evaluates to a number less than zero, the value is used as an offset from the end of the value of parameter.If length evaluates to a number less than zero, and parameter is not@and not an indexed or associative array,it is interpreted as an offset from the end of the value of parameter rather than a number of characters, and the expansion is the characters between the two offsets. If parameter is@,the result is length positional parameters beginning at offset.If parameter is an indexed array name subscripted by @ or *, the result is the length members of the array beginning with ${parameter[offset]}. A negative offset is taken relative to one greater than the maximum index of the speci?ed array.Substring expansion applied to an associative array produces unde?ned results.Note that a negative offset must be separated from the colon by at least one space to avoid being confused with the :- expansion. Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1 by default. If off-set is 0, and the positional parameters are used,$0is pre?xed to the list.

${!pre?x*}

${!pre?x@}

Names matching pre?x.Expands to the names of variables whose names begin with pre?x,sepa-rated by the ?rst character of the IFS special variable. When@is used and the expansion appears within double quotes, each variable name expands to a separate word.

${!name[@]}

${!name[*]}

List of array keys.If name is an array variable, expands to the list of array indices (keys) assigned in name.If name is not an array,expands to 0 if name is set and null otherwise.When @is used and the expansion appears within double quotes, each key expands to a separate word. ${#parameter}

Parameter length.The length in characters of the value of parameter is substituted.If parame-ter is*or@,the value substituted is the number of positional parameters.If parameter is an array name subscripted by*or@,the value substituted is the number of elements in the array. ${parameter#word}

${parameter##word}

Remove matching pre?x pattern.The word is expanded to produce a pattern just as in path-name expansion. If the pattern matches the beginning of the value of parameter,then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ‘‘#’’case) or the longest matching pattern (the ‘‘##’’ case) deleted.If parameter is@or*,the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resul-tant list.If parameter is an array variable subscripted with@or*,the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list. ${parameter%word}

${parameter%%word}

Remove matching suf?x pattern.The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches a trailing portion of the expanded value of parameter,then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the

pscc常用快捷键

Photoshop CC常用快捷键 1、工具箱 移动工具【V】 矩形、椭圆选框工具【M】 套索、多边形套索、磁性套索【L】 快速选择工具、魔棒工具【W】 裁剪、透视裁剪、切片、切片选择工具【C】 吸管、颜色取样器、标尺、注释、123计数工具【I】 污点修复画笔、修复画笔、修补、内容感知移动、红眼工具【J】 画笔、铅笔、颜色替换、混合器画笔工具【B】 仿制图章、图案图章工具【S】 历史记录画笔工具、历史记录艺术画笔工具【Y】 像皮擦、背景橡皮擦、魔术橡皮擦工具【E】 渐变、油漆桶工具【G】 减淡、加深、海棉工具【O】 钢笔、自由钢笔、添加锚点、删除锚点、转换点工具【P】 横排文字、直排文字、横排文字蒙板、直排文字蒙板【T】 路径选择、直接选择工具【A】 矩形、圆角矩形、椭圆、多边形、直线、自定义形状工具【U】 抓手工具【H】 旋转视图工具【R】 缩放工具【Z】 添加锚点工具【+】 删除锚点工具【-】 默认前景色和背景色【D】 切换前景色和背景色【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具【空格】 打开工具选项面板【Enter】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字) 【0】至【9】循环选择画笔【[】或【]】 选择第一个画笔【Shift】+【[】 选择最后一个画笔【Shift】+【]】 】N【+】Ctrl【) 中”渐变编辑器”在(建立新渐变. 2、文件操作 新建图形文件【Ctrl】+【N】 用默认设置创建新文件【Ctrl】+【Alt】+【N】 打开已有的图像【Ctrl】+【O】

PS CC 2018 快捷键大全

PS CC 2018 快捷键大全 一、工具箱 (多种工具共用一个快捷键的可同时按【Shift】加此快捷键选取) 矩形、椭圆选框工具【M】 移动工具【V】 套索、多边形套索、磁性套索【L】 魔棒工具【W】 裁剪工具【C】 切片工具、切片选择工具【K】 喷枪工具【J】 画笔工具、铅笔工具【B】 像皮图章、图案图章【S】 历史画笔工具、艺术历史画笔【Y】 像皮擦、背景擦除、魔术像皮擦【E】 渐变工具、油漆桶工具【G】 模糊、锐化、涂抹工具【R】 减淡、加深、海棉工具【O】 路径选择工具、直接选取工具【A】 文字工具【T】 钢笔、自由钢笔【P】 矩形、圆边矩形、椭圆、多边形、直线【U】 写字板、声音注释【N】 吸管、颜色取样器、度量工具【I】

抓手工具【H】 缩放工具【Z】 默认前景色和背景色【D】 切换前景色和背景色【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具【空格】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字) 【0】至【9】循环选择画笔【或】 建立新渐变(在”渐变编辑器”中)【Ctrl】+【N】 二、文件操作 新建图形文件【Ctrl】+【N】 打开已有的图像【Ctrl】+【O】 打开为... 【Ctrl】+【Alt】+【O】 关闭当前图像【Ctrl】+【W】 保存当前图像【Ctrl】+【S】 另存为... 【Ctrl】+【Shift】+【S】 存储为网页用图形【Ctrl】+【Alt】+【Shift】+【S】 页面设置【Ctrl】+【Shift】+【P】 打印预览【Ctrl】+【Alt】+【P】 打印【Ctrl】+【P】

Linux Bash Shell快速入门 在线教程

BASH 的基本语法 最简单的例子——Hello World! 关于输入、输出和错误输出 BASH 中对变量的规定(与C 语言的异同) BASH 中的基本流程控制语法 函数的使用 2.1 最简单的例子——Hello World! 几乎所有的讲解编程的书给读者的第一个例子都是Hello World 程序,那么我们今天也就从这个例子出发,来逐步了解BASH。 用vi 编辑器编辑一个hello 文件如下: #!/bin/bash # This is a very simple example echo Hello World 这样最简单的一个BASH 程序就编写完了。这里有几个问题需要说明一下: 一,第一行的#! 是什么意思 二,第一行的/bin/bash 又是什么意思 三,第二行是注释吗 四,echo 语句 五,如何执行该程序 #! 是说明hello 这个文件的类型的,有点类似于Windows 系统下用不同文件后缀来表示不同文件类型的意思(但不相同)。Linux 系统根据"#!" 及该字串后面的信息确定该文件的类型,关于这一问题同学们回去以后可以通过"man magic"命令及/usr/share/magic 文件来了解这方面的更多内容。在BASH 中第一行的"#!" 及后面的"/bin/bash" 就表明该文件是一个BASH 程序,需要由/bin 目录下的bash 程序来解释执行。BASH 这个程序一般是存放在/bin 目录下,如果你的Linux 系统比较特别,bash 也有可能被存放在/sbin 、/usr/local/bin 、/usr/bin 、/usr/sbin 或/usr/local/sbin 这样的目录下;如果还找不到,你可以用"locate bash" "find / -name bash 2> /dev/null" 或"whereis bash" 这三个命令找出bash 所在的位置;如果仍然找不到,那你可能需要自己动手安装一个BASH 软件包了。 第二行的"# This is a ..." 就是BASH 程序的注释,在BASH 程序中从“#”号(注意:后面紧接着是“!”号的除外)开始到行尾的多有部分均被看作是程序的注释。的三行的echo 语句的功能是把echo 后面的字符串输出到标准输出中去。由于echo 后跟的是"Hello World" 这个字符串,因此"Hello World"这个字串就被显示在控制台终端的屏幕上了。需要注意的是BASH 中的绝大多数语句结尾处都没有分号。 如何执行该程序呢?有两种方法:一种是显式制定BASH 去执行:

Adobe Photoshop CC 2020 快捷键

Adobe Photoshop CC2020快捷键 目录 应用程序菜单 (1) 文件 (1) 编辑 (1) 图像 (2) 图层 (2) 选择 (2) 滤镜 (3) 3D (3) 视图 (3) 窗口 (3) 帮助 (3) 面板菜单 (4) 3D (4) 图层 (4) 工具 (4) 任务空间 (6) 选择并遮住 (6) 内容识别填充 (6)

应用程序菜单 命令 快捷键 文件 新建 Ctrl+N 打开 Ctrl+O 在 Bridge 中浏览 Alt+Ctrl+O 或Shift+Ctrl+O 打开为 Alt+Shift+Ctrl+O 关闭 Ctrl+W 关闭全部 Alt+Ctrl+W 关闭其它 Alt+Ctrl+P 关闭并转到 Bridge Shift+Ctrl+W 存储 Ctrl+S 存储为 Shift+Ctrl+S 或Alt+Ctrl+S 恢复 F12 导出> 导出为 Alt+Shift+Ctrl+W 存储为 Web 所用格式(旧版) Alt+Shift+Ctrl+S 文件简介... Alt+Shift+Ctrl+I 打印... Ctrl+P 打印一份 Alt+Shift+Ctrl+P 退出 Ctrl+Q 编辑 还原 Ctrl+Z 重做 Shift+Ctrl+Z 切换最终状态 Alt+Ctrl+Z 渐隐... Shift+Ctrl+F 剪切 Ctrl+X或F2 拷贝 Ctrl+C或F3 合并拷贝 Shift+Ctrl+C 粘贴 Ctrl+V或F4 选择性粘贴> 原位粘贴 Shift+Ctrl+V 贴入 Alt+Shift+Ctrl+V 搜索 Ctrl+F 填充... Shift+F5 内容识别缩放 Alt+Shift+Ctrl+C 自由变换 Ctrl+T 变换> 再次 Shift+Ctrl+T 颜色设置... Shift+Ctrl+K

Shell命令

Shell Shell 就是用户与操作系统内核之间的接口,起着协调用户与系统的一致性和在用户与系统之间进行交互的作用。 4.1.1 Shell 的基本概念 1. 什么是S hell Shell 就是用户与操作系统内核之间的接口,起着协调用户与系统的一致性和在用户与系统之间进行交互的作用。Shell 在L inux 系统中具有极其重要的地位,如图4-1 所示

第 4 章 Shell 与 V i 编辑器 - 71 - diff grep vi multitasking sh gcc device hardware interface kernn e l TCP/IP stack bash utilii t es 图 4-1 Linux 系统结构组成 2. Shell 的功能 Shell 最重要的功能是命令解释,从这种意义上来说,Shell 是一个命令解释器。Linux 系统中的所有可执行文件都可以作为 Shell 命令来执行。将可执行文件作一个分类,如表 4-1 所示。 表 4-1 可执行文件的分类 部的解释器将其解释为系统功能调用并转交给内核执行;若是外部命令或实用程序就试图 在硬盘中查找该命令并将其调入内存,再将其解释为系统功能调用并转交给内核执行。在 查找该命令时分为两种情况: 用户给出了命令路径,Shell 就沿着用户给出的路径查找,若找到则调入内存,若没有 则输出提示信息; 用户没有给出命令的路径,Shell 就在环境变量 PATH 所制定的路径中依次进行查找, 若找到则调入内存,若没找到则输出提示信息。 图 4-2 描述了 S hell 是如何完成命令解释的。

Photoshop CC2018快捷键大全

Photoshop CC2018快捷键大全!篇幅较长,建议先收藏,以后有需要了随时可以查看 一、工具箱 (多种工具共用一个快捷键的可同时按【Shift】加此快捷键选取) 矩形、椭圆选框工具?【M】 移动工具?【V】 套索、多边形套索、磁性套索?【L】 魔棒工具?【W】 裁剪工具?【C】 切片工具、切片选择工具?【K】 喷枪工具?【J】 画笔工具、铅笔工具?【B】 像皮图章、图案图章?【S】 历史画笔工具、艺术历史画笔?【Y】 像皮擦、背景擦除、魔术像皮擦?【E】 渐变工具、油漆桶工具【G】 模糊、锐化、涂抹工具?【R】 减淡、加深、海棉工具【O】 路径选择工具、直接选取工具【A】 文字工具【T】 钢笔、自由钢笔【P】 矩形、圆边矩形、椭圆、多边形、直线【U】 写字板、声音注释【N】 吸管、颜色取样器、度量工具【I】

抓手工具?【H】 缩放工具?【Z】 默认前景色和背景色【D】 切换前景色和背景色?【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式?【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具?【空格】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字)【0】至【9】循环选择画笔?【[ 】或【] 】 建立新渐变(在”渐变编辑器”中)【Ctrl】+【N】 二、文件操作 新建图形文件【Ctrl】+【N】 打开已有的图像【Ctrl】+【O】 打开为...?【Ctrl】+【Alt】+【O】 关闭当前图像【Ctrl】+【W】 保存当前图像【Ctrl】+【S】 另存为...?【Ctrl】+【Shift】+【S】 存储为网页用图形【Ctrl】+【Alt】+【Shift】+【S】 页面设置?【Ctrl】+【Shift】+【P】 打印预览【Ctrl】+【Alt】+【P】 打印?【Ctrl】+【P】 退出Photoshop?【Ctrl】+【Q】

BASH脚本编程

一个最简单的脚本 这篇指南将通过一些例子来帮助大家学习功能强大的shell脚本编程. 在这一节中我将学习一些简单的脚本,它将有利于你深入学习一些知识。 一个最经典的HelloWorld程序 #!/bin/bash echoHelloWorld 这个脚本只有二行,它的第一行这个脚本程序由那个程序来解释.第二行只有一个简单的动作,它的功能是在终端上打印出一行”HelloWorld”。如果你测试着执行这个命令时(./hello.sh),你将会得到一个commandnotfound的信息,这种情况大部分可能是你的第一行#!/bin/bash 这个程序有问题,你一定要确保bash可以找到并且可用。(一般情况下你还要对这个脚本附一个可执行权限) #chmodu xhello.sh 一个非常简单的备份脚本 #!/bin/bash tar-cZf/var/my-backup.tgz/home/me/ 在这个脚本中,它替换了上一个例子的将一行信息打印在终端上的功能,取尔代之的是一个备份/home目录的tar备份命令。 关于重定向的一些信息 最基本的理论基础 这里有对于三个文件的重定向定义:stdin(标准输入),stdout(标准输出)andstderr(标准错误输出)(std=standard). 基本上你可以 1.重定向stdout到一个文件 2.重定向stderr到一个文件 3.重定向stdout到stderr 4.重定向stderr到stdout 5.重定向stderr到stdout中并且成为一个文件 6.重定向stderrandstdouttostdout 7.重定向stderrandstdouttostderr 在Linux中1代表'标准输出',2代表’标准错误’ 标准输出 这个例子将会使ls的显示结果重定向到一个文件中. ls-l>ls-l.txt

[实用参考]Mac 版Photoshop 快捷键大全

Mac版Photoshop 快捷键一样的只不过是mac上的花键相当于window上的ctrl 取消当前命令:Esc; 工具选项板:Enter; 选项板调整:Shift+Tab; 退出系统:Ctrl+Q; 获取帮助:F1; 剪切选择区:F2/Ctrl+G; 拷贝选择区:F3/Ctrl+C; 粘贴选择区:F4/Ctrl+V; 显示或关闭画笔选项板:F5; 显示或关闭颜色选项板:F6; 显示或关闭图层选项板:F7; 显示或关闭信息选项板:F8; 显示或关闭动作选项板:F9; 显示或关闭选项板、状态栏和工具箱:Tab; 全选:Ctrl+A; 反选:Shift+Ctrl+I; 取消选择区:Ctrl+D; 选择区域移动:方向键; 将图层转换为选择区:Ctrl+单击工作图层; 选择区域以10个像素为单位移动:Shift+方向键; 复制选择区域:Alt+方向键; 填充为前景色:Alt+Delete; 填充为背景色:Ctrl+Delete; 调整色阶工具:Ctrl+L; 调整色彩平衡:Ctrl+B; 调节色调/饱和度:Ctrl+U; 自由变形:Ctrl+T; 增大笔头大小:“中括号”; 减小笔头大小:“中括号”; 选择最大笔头:Shift+“中括号”; 选择最小笔头:Shift+“中括号”;

重复使用滤镜:Ctrl+F; 移至上一图层:Ctrl+“中括号”; 排至下一图层:Ctrl+“中括号”; 移至最前图层:Shift+Ctrl+“中括号”;移至最底图层:Shift+Ctrl+“中括号”;激活上一图层:Alt+“中括号”; 激活下一图层:Alt+“中括号”; 合并可见图层:Shift+Ctrl+E; 放大视窗:Ctrl+“+”; 缩小视窗:Ctrl+“-”; 放大局部:Ctrl+空格键+鼠标单击;缩小局部:Alt+空格键+鼠标单击;翻屏查看:PageUp/PageDown; 显示或隐藏标尺:Ctrl+R; 显示或隐藏虚线:Ctrl+H; 显示或隐藏网格:Ctrl+”。 打开文件:Ctrl+O; 关闭文件:Ctrl+W; 文件存盘:Ctrl+S; 打印文件:Ctrl+P; 恢复到上一步:Ctrl+Z; 矩形、椭圆工具[M] 裁剪工具[C] 移动工具[V] 套索、多边形套索、磁性套索[L] 魔棒工具[W] 喷枪工具[J] 画笔工具[B] 像皮图章、图案图章[S] 历史记录画笔工具[P] 像皮擦工具[E] 铅笔、直线工具[N] 模糊、锐化、涂抹工具[R] 减淡、加深、海棉工具[O]

linux常用命令之bash入门指南

1 什么是Bash 什么是Shell Bash 是GNU Bourne-Again SHell,是目前大多数Linux发行版采用的Shell。 Shell 是*nix提供给用户使用的界面。 一个操作系统的底层是独立运行的,用户界面和底层分开,可以最大限度的保证系统稳定。Shell就是一个特殊的程序,负责接受用户的命令,并把系统的响应返回给用户。 Bash Shell一般不需要自己安装,在安装发行版的同时都会安装好。 Shell的存在是和登陆相关的,从用户名密码验证通过以后,Shell就启动了,知道你退出,Shell就结束了运行。 除了Bash Shell之外,还有很多其他的Shell。 2 Linux的文件、目录、程序 Linux的文件、目录、程序是使用bash操作的主要对象。有必要事先了解一下文件、目录和程序的概念 文件 Linux中一切都是文件、普通的文件、设备文件、管道也是文件的形式。一切操作都是文件为基础的。DOS操作系统早期也是模拟这种方式,不过有很多漏洞(比如C:concon会蓝屏) 文件是有属性的,有一个属性表示这个文件是不是目录,有3个属性表示这个文件的访问权限,还有一些表示从这个文件派生出的文件属性。 目录 目录是管理文件的手段,不同的文件要分门别类才容易找到。严格的说,目录也是一种文件,是具有目录属性的文件。

文件和目录都有所有者和所有组。叫UID和GID,对应的,有3个属性表示相应的权限。后面写到ls和chmod有详细地说明。 程序 程序是可以执行的代码,有些是直接交给内核或者CPU执行的,有些是通过其他程序执行的(解释脚本),可以运行的程序都有一个可执行的属性。 3 简单的命令ls cp mv mkdir rm chown chmod 前面说了一些枯燥的概念,现在趁着看官还没有烦躁,开始实际操作的例子。 QUOTE: Last login: Mon Aug 14 21:52:47 2006 from 61.149.202.143 [root@CERNET ~]# 这就是bash登陆后的样子。#井号是root特权用户的提示符号,一般用户提示符是$符号。 现在输入ls,列出当前目录的内容 QUOTE: [root@CERNET ~]# ls anaconda-ks.cfg install.log.syslog log4cplus-1.0.2 MceMonitor-install-files.tgz.md5s um vmstat_monitor Ice-3.0.1 jwsmtp-1.32.11 log4cplus-1.0.2.tar.gz memcached-1.1.12 wuhan.sh Ice-3.0.1.tar.gz jwsmtp-1.32.11.tar.gz login_keepalived memcached-1.1.12.tar.gz ids.sh libevent-0.8 MceMonitor sar.log install.log libevent-0.8.tar.gz MceMonitor-install-files.tgz tmp

Photoshop CC 所有快捷键

Adobe? Photoshop? CC 键盘快捷键 应用程序菜单 命令快捷键 文件 新建... Ctrl+N 打开... Ctrl+O 在Bridge 中浏览... Alt+Ctrl+O Shift+Ctrl+O 在Mini Bridge 中浏览... 打开为... Alt+Shift+Ctrl+O 打开为智能对象... 最近打开文件> 清除最近的文件列表 关闭Ctrl+W 关闭全部Alt+Ctrl+W 关闭并转到Bridge... Shift+Ctrl+W 存储Ctrl+S 存储为... Shift+Ctrl+S Alt+Ctrl+S 签入... 存储为Web 所用格式... Alt+Shift+Ctrl+S 恢复F12 置入... 导入> 变量数据组... 视频帧到图层... 注释... WIA 支持... 导出> 数据组作为文件... Zoomify... 路径到Illustrator... 渲染视频... 自动> 批处理... PDF 演示文稿...

创建快捷批处理... 裁剪并修齐照片 联系表II... Photomerge... 合并到HDR Pro... 镜头校正... 条件模式更改... 限制图像... 脚本> 图像处理器... 删除所有空图层 拼合所有蒙版 拼合所有图层效果 将图层复合导出到PDF... 图层复合导出到文件... 将图层导出到文件... 脚本事件管理器... 将文件载入堆栈... 统计... 载入多个DICOM 文件... 浏览... 文件简介... Alt+Shift+Ctrl+I 打印... Ctrl+P 打印一份Alt+Shift+Ctrl+P 还原/重做Ctrl+Z 前进一步Shift+Ctrl+Z 后退一步Alt+Ctrl+Z 渐隐... Shift+Ctrl+F 剪切Ctrl+X F2 拷贝Ctrl+C F3 合并拷贝Shift+Ctrl+C 粘贴Ctrl+V F4 选择性粘贴> 原位粘贴Shift+Ctrl+V 贴入Alt+Shift+Ctrl+V 外部粘贴 清除

最新pscc常用快捷键

Photoshop CC常用快捷键1 1、工具箱 移动工具【V】 矩形、椭圆选框工具【M】 套索、多边形套索、磁性套索【L】 快速选择工具、魔棒工具【W】 裁剪、透视裁剪、切片、切片选择工具【C】 吸管、颜色取样器、标尺、注释、123计数工具【I】 污点修复画笔、修复画笔、修补、内容感知移动、红眼工具【J】画笔、铅笔、颜色替换、混合器画笔工具【B】 仿制图章、图案图章工具【S】 历史记录画笔工具、历史记录艺术画笔工具【Y】 像皮擦、背景橡皮擦、魔术橡皮擦工具【E】 渐变、油漆桶工具【G】 减淡、加深、海棉工具【O】 钢笔、自由钢笔、添加锚点、删除锚点、转换点工具【P】 横排文字、直排文字、横排文字蒙板、直排文字蒙板【T】 1

路径选择、直接选择工具【A】 矩形、圆角矩形、椭圆、多边形、直线、自定义形状工具【U】 抓手工具【H】 旋转视图工具【R】 缩放工具【Z】 添加锚点工具【+】 删除锚点工具【-】 默认前景色和背景色【D】 切换前景色和背景色【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具【空格】 打开工具选项面板【Enter】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字) 【0】至【9】循环选择画笔【[】或【]】 选择第一个画笔【Shift】+【[】 选择最后一个画笔【Shift】+【]】 2

3

用默认设置创建新文件【Ctrl】+【Alt】+【N】 打开已有的图像【Ctrl】+【O】 打开为... 【Ctrl】+【Alt】+【O】 关闭当前图像【Ctrl】+【W】 保存当前图像【Ctrl】+【S】 另存为... 【Ctrl】+【Shift】+【S】 存储为Web所用格式【Ctrl】+【Alt】+ 【Shift】+【S】页面设置【Ctrl】+【Shift】+【P】 打印【Ctrl】+【P】 打开“预置”对话框【Ctrl】+【K】 3 3、选择功能 全部选取【Ctrl】+【A】 取消选择【Ctrl】+【D】 重新选择【Ctrl】+【Shift】+【D】 羽化选择【Shift】+【F6】 反向选择【Ctrl】+【Shift】+【I】 路径变选区数字键盘的【Enter】 4

Linux Shell(bash) 重定向技巧

Linux Shell(bash) 重定向技巧 linux 环境中支持输入输出重定向,用符号<和>来表示。 0、1和2分别表示标准输入、标准输出和标准错误信息输出, 可以用来指定需要重定向的标准输入或输出,比如2>a.txt 表示将错误信息输出到文件a.txt中。 同时,还可以在这三个标准输入输出之间实现重定向,比如将错误信息重定向到标准输出,可以用2>&1来实现。 Linux下还有一个特殊的文件/dev/null,它就像一个无底洞,所有重定向到它的信息都会消失得无影无踪。这一点非常有用,当我们不需要回显程序的所有信息时,就可以将输出重定向到/dev/null。 如果想要正常输出和错误信息都不显示,则要把标准输出和标准错误都重定向到/dev/null,例如: # ls 1>/dev/null 2>/dev/null 还有一种做法是将错误重定向到标准输出,然后再重定向到/dev/null,例如: # ls >/dev/null 2>&1 注意:此处的顺序不能更改,否则达不到想要的效果,此时先将标准输出重定向到/dev/null,然后将标准错误重定向到标准输出,由于标准输出已经重定向到了/dev/null,因此标准错误也会重定向到/dev/null. 1. 标准输入的控制 语法:命令< 文件将文件做为命令的输入。 例如: mail -s “mail test” wesongzhou@https://www.doczj.com/doc/2c15174401.html, < file1 将文件file1 当做信件的内容,主 题名称为mail test,送给收信人。 2. 标准输出的控制 语法:命令> 文件将命令的执行结果送至指定的文件中。 例如: ls -l > list 将执行“ls -l” 命令的结果写入文件list 中。

超详细!Photoshop CC2018快捷键大全!

超详细!Photoshop CC2018快捷键大全! 篇幅较长,建议先收藏,以后有需要了随时可以查看一、工具箱(多种工具共用一个快捷键的可同时按【Shift】加此快捷键选取)矩形、椭圆选框工具【M】移动工具【V】套索、多边形套索、磁性套索【L】魔棒工具【W】裁剪工具【C】切片工具、切片选择工具【K】喷枪工具【J】画笔工具、铅笔工具【B】像皮图章、图案图章【S】历史画笔工具、艺术历史画笔【Y】像皮擦、背景擦除、魔术像皮擦【E】渐变工具、油漆桶工具【G】模糊、锐化、涂抹工具【R】减淡、加深、海棉工具【O】路径选择工具、直接选取工具【A】文字工具【T】钢笔、自由钢笔【P】矩形、圆边矩形、椭圆、多边形、直线【U】写字板、声音注释【N】吸管、颜色取样器、度量工具【I】抓手工具【H】缩放工具【Z】默认前景色和背景色【D】切换前景色和背景色【X】切换标准模式和快速蒙板模式【Q】标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】临时使用移动工具【Ctrl】临时使用吸色工具【Alt】临时使用抓手工具【空格】快速输入工具选项(当前工具选项面板中至少有一个可调节数字)【0】至【9】循环选择画笔【[ 】或【] 】建立新渐变(在”渐变编辑器”中)【Ctrl】+【N】二、文件操作新建图形文件【Ctrl】+【N】打开已有的图像【Ctrl】+【O】打开为...【Ctrl】+【Alt】+【O】关闭

当前图像【Ctrl】+【W】保存当前图像【Ctrl】+【S】另存为...【Ctrl】+【Shift】+【S】存储为网页用图形【Ctrl】+【Alt】+【Shift】+【S】页面设置【Ctrl】+【Shift】+【P】打印预览【Ctrl】+【Alt】+【P】打印【Ctrl】+【P】退出Photoshop【Ctrl】+【Q】三、编辑操作还原/重做前一步操作【Ctrl】+【Z】一步一步向前还原【Ctrl】+【Alt】+【Z】一步一步向后重做【Ctrl】+【Shift】+【Z】淡入/淡出【Ctrl】+【Shift】+【F】剪切选取的图像或路径【Ctrl】+【X】或【F2】拷贝选取的图像或路径【Ctrl】+【C】合并拷贝【Ctrl】+【Shift】+【C】将剪贴板的内容粘到当前图形中【Ctrl】+【V】或【F4】将剪贴板的内容粘到选框中【Ctrl】+【Shift】+【V】自由变换【Ctrl】+【T】应用自由变换(在自由变换模式下)【Enter】从中心或对称点开始变换(在自由变换模式下)【Alt】限制(在自由变换模式下)【Shift】扭曲(在自由变换模式下)【Ctrl】取消变形(在自由变换模式下)【Esc】自由变换复制的象素数据【Ctrl】+【Shift】+【T】再次变换复制的象素数据并建立一个副本【Ctrl】+【Shift】+【Alt】+【T】删除选框中的图案或选取的路径【DEL】用背景色填充所选区域或整个图层【Ctrl】+【BackSpace】或【Ctrl】+【Del】用前景色填充所选区域或整个图层【Alt】+【BackSpace】或【Alt】+【Del】弹出“填充”对话框【Shift】+【BackSpace】从历史记录中填充【Alt】+【Ctrl】+【Backspace】打开“颜

pscc2017快捷键大全三、编辑操作

pscc2017快捷键大全三、编辑操作 三、编辑操作还原/重做前一步操作【Ctrl】【Z】一步一步向前还原【Ctrl】【Alt】【Z】一步一步向后重做【Ctrl】【Shift】【Z】淡入/淡出【Ctrl】【Shift】【F】剪切选取的图像或路径【Ctrl】【X】或【F2】拷贝选取的图像或路径【Ctrl】【C】合并拷贝【Ctrl】【Shift】【C】将剪贴板的内容粘到当前图形中【Ctrl】【V】或【F4】将剪贴板的内容粘到选框中【Ctrl】【Shift】【V】自由变换【Ctrl】【T】应用自由变换(在自由变换模式下) 【Enter】从中心或对称点开始变换(在自由变换模式下) 【Alt】限制(在自由变换模式下) 【Shift】扭曲(在自由变换模式下) 【Ctrl】取消变形(在自由变换模式下) 【Esc】自由变换复制的象素数据【Ctrl】【Shift】【T】再次变换复制的象素数据并建立一个副本【Ctrl】【Shift】【Alt】【T】删除选框中的图案或选取的路径【DEL】用背景色填充所选区域或整个图层【Ctrl】【BackSpace】或【Ctrl】【Del】用前景色填充所选区域或整个图层【Alt】【BackSpace】或【Alt】【Del】弹出“填充”对话框【Shift】【BackSpace】从历史记录中填充【Alt】【Ctrl】【Backspace】打开“颜色设置”对话框【Ctrl】【Shift】【K】打开“预先调整管理器”对话框【Alt】【E】放开

后按【M】预设画笔(在“预先调整管理器”对话框中)【Ctrl】【1】预设颜色样式(在“预先调整管理器”对话框中)【Ctrl】【2】预设渐变填充(在“预先调整管理器”对话框中)【Ctrl】【3】预设图层效果(在“预先调整管理器”对话框中)【Ctrl】【4】预设图案填充(在“预先调整管理器”对话框中)【Ctrl】【5】预设轮廓线(在“预先调整管理器”对话框中)【Ctrl】【6】预设定制矢量图形(在“预先调整管理器”对话框中)【Ctrl】【7】打开“预置”对话框【Ctrl】【K】显示最后一次显示的“预置”对话框【Alt】【Ctrl】【K】设置“常规”选项(在预置对话框中) 【Ctrl】【1】设置“存储文件”(在预置对话框中) 【Ctrl】【2】设置“显示和光标”(在预置对话框中) 【Ctrl】【3】设置“透明区域与色域”(在预置对话框中) 【Ctrl】【4】设置“单位与标尺”(在预置对话框中) 【Ctrl】【5】设置“参考线与网格”(在预置对话框中) 【Ctrl】【6】设置“增效工具与暂存盘”(在预置对话框中) 【Ctrl】【7】设置“内存与图像高速缓存”(在预置对话框中) 【Ctrl】【8】

Linux之bash介绍

Linux之bash介绍 shell是一个程序,可以称之为壳程序,用于用户与操作系统进行交互。用来区别与核,相当于是一个命令解析器,Shell有很多中,这里列出其中几种 - Bourne SHell(sh) - Bourne Again SHell(bash) - C SHell(csh) - KornSHell(ksh) - zsh 各个shell的功能都差不太多,在某些语法的下达下面有些区别,Linux预设就是bash。这里主要介绍bash。 bash bash命令是sh命令的超集。大多数sh脚本都可以在bash下运行,bash主要有如下这些功能: bash功能 记录历史命令:bash可以记录曾经的命令,保持在~/.bash_history文件中,只保存上次注销登录之后的命令 tab键自动补全:使用tab见可以自动不全命令或者目录i alias命令别名:可以使用alias ll='ls -al'来设置命令的别名 工作控制:可以将某些任务放在后台去运行,这里不多种介绍 程序脚本:可以执行shell脚本文件 通配符:在查找相关文件或者执行相关命令时,可以使用通配符* 内建命令type:可以使用type 命令来查看某个命令是否为内建在bash当中的命令「 bash变量 bash中变量有两种,分别是环境变量和自定义变量,可以理解为全局变量和局部变量,在理解他们的区别前,需要知道副程序和子程序,举个例子,当前的bash我们称之为父程序,而在这个bash下执行的任何程序,都称之为子程序。那全局变量和局部变量的区别就是,全局变量在子程序中仍然有效,局部变量只在当前程序中生效。(注意,一旦退出父程序这个bash的话,无论是全局变量还是局部变量都失效了,再次打开bash时,该变量是不存在的) 变量范围 变量的设定 变量的设定有几个规则,这里列举如下: - 设定变量通过=来链接,例如name=sujinzhou,两边不能有空格,如果有空格的话,需要用引号 - 变量名只能是英文名和数字,只能是英文开头 - 如果变量内容被引号扩起来的话,双引号和单引号是有区别的 - 双引号里面的特殊字符,会保持原有的特性。 - 单引号里面的特殊字符,只会是字符 - 使用\将特殊字符转换为一般字符

Photoshop-CC-常用快捷键

Photoshop CC常用快捷键 1. 工具箱 工具箱(多种工具共用一个快捷键的可同时按【Shift】加此快捷键选取) 移动工具【V】 矩形、椭圆选框工具【M】 套索、多边形套索、磁性套索【L】 快速选择工具、魔棒工具【W】 裁剪、透视裁剪、切片、切片选择工具【C】 吸管、颜色取样器、标尺、注释、123计数工具【I】 污点修复画笔、修复画笔、修补、容感知移动、红眼工具【J】 画笔、铅笔、颜色替换、混合器画笔工具【B】 仿制图章、图案图章工具【S】 历史记录画笔工具、历史记录艺术画笔工具【Y】 橡皮擦、背景橡皮擦、魔术橡皮擦工具【E】 渐变、油漆桶工具【G】 模糊、锐化、涂抹工具【R】 减淡、加深、海棉工具【O】 钢笔、自由钢笔、添加锚点、删除锚点、转换点工具【P】 横排文字、直排文字、横排文字蒙板、直排文字蒙板【T】 路径选择、直接选择工具【A】 矩形、圆角矩形、椭圆、多边形、直线、自定义形状工具【U】 抓手工具【H】 旋转视图工具【R】 缩放工具【Z】 添加锚点工具【+】 删除锚点工具【-】(貌似鼠标移到路径上就自动加减了?) 默认前景色和背景色【D】 切换前景色和背景色【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具【空格】 打开工具选项面板【Enter】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字)【0】至【9】 循环选择画笔【[】或【]】(就是改变画笔大小) 选择第一个画笔【Shift】+【[】(就是改变画笔硬度大小,即边缘虚化程度) 选择最后一个画笔【Shift】+【]】(就是改变画笔硬度大小,即边缘虚化程度) 建立新渐变(在“渐变编辑器”中)【Ctrl】+【N】(好像没用,可以换成【Alt】+【W】)2. 文件操作 新建图形文件【Ctrl】+【N】 用默认设置创建新文件【Ctrl】+【Alt】+【N】(好像没用......) 打开已有的图像【Ctrl】+【O】

linux系统中的常见基本命令大全

linux系统中的常见基本命令大全 系统信息 arch显示机器的处理器架构(1) uname-m显示机器的处理器架构(2) uname-r显示正在使用的内核版本 dmidecode-q显示硬件系统部件-(SMBIOS/DMI) hdparm-i/dev/hda罗列一个磁盘的架构特性 hdparm-tT/dev/sda在磁盘上执行测试性读取操作 cat/proc/cpuinfo显示CPUinfo的信息 cat/proc/interrupts显示中断 cat/proc/meminfo校验内存使用 cat/proc/swaps显示哪些swap被使用 cat/proc/version显示内核的版本 cat/proc/net/dev显示网络适配器及统计 cat/proc/mounts显示已加载的文件系统 lspci-tv罗列PCI设备 lsusb-tv显示USB设备 date显示系统日期 cal2007显示2007年的日历表 date0412********.00设置日期和时间-月日时分年.秒 clock-w将时间修改保存到BIOS 关机(系统的关机、重启以及登出) shutdown-hnow关闭系统(1) init0关闭系统(2) telinit0关闭系统(3) shutdown-hhours:minutes&按预定时间关闭系统 shutdown-c取消按预定时间关闭系统 shutdown-rnow重启(1) reboot重启(2)

logout注销 文件和目录 cd/home进入'/home'目录' cd..返回上一级目录 cd../..返回上两级目录 cd进入个人的主目录 cd~user1进入个人的主目录 cd-返回上次所在的目录 pwd显示工作路径 ls查看目录中的文件 ls-F查看目录中的文件 ls-l显示文件和目录的详细资料 ls-a显示隐藏文件 ls*[0-9]*显示包含数字的文件名和目录名 tree显示文件和目录由根目录开始的树形结构(1) lstree显示文件和目录由根目录开始的树形结构(2) mkdirdir1创建一个叫做'dir1'的目录' mkdirdir1dir2同时创建两个目录 mkdir-p/tmp/dir1/dir2创建一个目录树 rm-ffile1删除一个叫做'file1'的文件' rmdirdir1删除一个叫做'dir1'的目录' rm-rfdir1删除一个叫做'dir1'的目录并同时删除其内容 rm-rfdir1dir2同时删除两个目录及它们的内容 mvdir1new_dir重命名/移动一个目录 cpfile1file2复制一个文件 cpdir/*.复制一个目录下的所有文件到当前工作目录 cp-a/tmp/dir1.复制一个目录到当前工作目录 cp-adir1dir2复制一个目录 ln-sfile1lnk1创建一个指向文件或目录的软链接 lnfile1lnk1创建一个指向文件或目录的物理链接

pscc常用快捷键大全

Ps cc 常用快捷键 1、工具箱 移动工具【V】 矩形、椭圆选框工具【M】 套索、多边形套索、磁性套索【L】 快速选择工具、魔棒工具【W】 裁剪、透视裁剪、切片、切片选择工具【C】 吸管、颜色取样器、标尺、注释、123计数工具【I】 污点修复画笔、修复画笔、修补、内容感知移动、红眼工具【J】 画笔、铅笔、颜色替换、混合器画笔工具【B】 仿制图章、图案图章工具【S】 历史记录画笔工具、历史记录艺术画笔工具【Y】 像皮擦、背景橡皮擦、魔术橡皮擦工具【E】 渐变、油漆桶工具【G】 减淡、加深、海棉工具【O】 钢笔、自由钢笔、添加锚点、删除锚点、转换点工具【P】 横排文字、直排文字、横排文字蒙板、直排文字蒙板【T】 路径选择、直接选择工具【A】 矩形、圆角矩形、椭圆、多边形、直线、自定义形状工具【U】 抓手工具【H】 旋转视图工具【R】 缩放工具【Z】 添加锚点工具【+】 删除锚点工具【-】 默认前景色和背景色【D】 切换前景色和背景色【X】 切换标准模式和快速蒙板模式【Q】 标准屏幕模式、带有菜单栏的全屏模式、全屏模式【F】 临时使用移动工具【Ctrl】 临时使用吸色工具【Alt】 临时使用抓手工具【空格】 打开工具选项面板【Enter】 快速输入工具选项(当前工具选项面板中至少有一个可调节数字) 【0】至【9】循环选择画笔【[】或【]】 选择第一个画笔【Shift】+【[】 选择最后一个画笔【Shift】+【]】 建立新渐变(在”渐变编辑器”中) 【Ctrl】+【N】 2、文件操作 新建图形文件【Ctrl】+【N】 用默认设置创建新文件【Ctrl】+【Alt】+【N】 打开已有的图像【Ctrl】+【O】 打开为... 【Ctrl】+【Alt】+【O】 关闭当前图像【Ctrl】+【W】

xshell-linux命令(1)

suse linux 常用命令 (1)命令ls——列出文件 ls -la 给出当前目录下所有文件的一个长列表,包括以句点开头的“隐藏”文件 ls a* 列出当前目录下以字母a开头的所有文件 ls -l *.doc 给出当前目录下以.doc结尾的所有文件 (2)命令cp——复制文件 cp afile afile.bak 把文件复制为新文件afile.bak cp afile /home/bible/ 把文件afile从当前目录复制到/home/bible/目录下 cp * /tmp 把当前目录下的所有未隐藏文件复制到/tmp/目录下 cp -a docs docs.bak 递归性地把当前目录下的docs目录复制为新目录docs.bak,保持文件属性,并复制所有的文件,包括以句点开头的隐藏文件。为了方便起见,-a选项包含-R 选项 cp -i 在覆盖前询问用户 cp -v 告诉用户正在做什么 (3)命令mv——移动和重命名文件 mv aflie bfile 将afile重命名为bfile mv afile /tmp 把当前目录下的afile移动到/tmp/目录下 (4)命令rm——删除文件和目录 rm afile 删除文件afile rm * 删除当前目录下的所有文件(未隐藏文件)。rm命令不删除目录,除非也指定了-r(递归)参数。 rm -rf domed 删除domed目录以及它所包含的所有内容 rm -i a* 删除当前目录下所有以字母a开头的文件,并且在每次删除时,提示用户进行确认 (5)命令cd——更改目录 cd ~ 切换到主目录 cd /tmp 切换到目录/tmp cd dir切换到当前目录下的dir目录 cd /切换到根目录 cd ..切换到到上一级目录 cd ../..切换到上二级目录 cd ~切换到用户目录,比如是root用户,则切换到/root下 (6)命令mkdir——建立目录 mkdir phots 在当前目录中建立名为photos的目录 mkdir -p this/that/theother 在当前目录下建立指定的嵌套子目录 (7)命令mkdir——删除目录 mkdir 将删除空目录 (8)命令more、less——查看文件内容 more /etc/passwd 查看/etc/passwd的内容 功能:分页显示命令

相关主题
文本预览
相关文档 最新文档