?? 01. unix note.txt
字號:
-w Write the current history to the history file, overwriting the history file’s
contents.
-p Perform history substitution on the following args and display the result on
the standard output. Does not store the results in the history list. Each
arg must be quoted to disable normal history expansion.
-s Store the args in the history list as a single entry. The last command in the
history list is removed before the args are added.
If the HISTTIMEFORMAT is set, the time stamp information associated with each history
entry is written to the history file. The return value is 0 unless an invalid option
is encountered, an error occurs while reading or writing the history file, an invalid
offset is supplied as an argument to -d, or the history expansion supplied as an
argument to -p fails.
jobs [-lnprs] [ jobspec ... ]
jobs -x command [ args ... ]
The first form lists the active jobs. The options have the following meanings:
-l List process IDs in addition to the normal information.
-p List only the process ID of the job’s process group leader.
-n Display information only about jobs that have changed status since the user
was last notified of their status.
-r Restrict output to running jobs.
-s Restrict output to stopped jobs.
If jobspec is given, output is restricted to information about that job. The return
status is 0 unless an invalid option is encountered or an invalid jobspec is sup-
plied.
If the -x option is supplied, jobs replaces any jobspec found in command or args with
the corresponding process group ID, and executes command passing it args, returning
its exit status.
kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
kill -l [sigspec | exit_status]
Send the signal named by sigspec or signum to the processes named by pid or jobspec.
sigspec is either a case-insensitive signal name such as SIGKILL (with or without the
SIG prefix) or a signal number; signum is a signal number. If sigspec is not
present, then SIGTERM is assumed. An argument of -l lists the signal names. If any
arguments are supplied when -l is given, the names of the signals corresponding to
the arguments are listed, and the return status is 0. The exit_status argument to -l
is a number specifying either a signal number or the exit status of a process termi-
nated by a signal. kill returns true if at least one signal was successfully sent,
or false if an error occurs or an invalid option is encountered.
let arg [arg ...]
Each arg is an arithmetic expression to be evaluated (see ARITHMETIC EVALUATION). If
the last arg evaluates to 0, let returns 1; 0 is returned otherwise.
local [option] [name[=value] ...]
For each argument, a local variable named name is created, and assigned value. The
option can be any of the options accepted by declare. When local is used within a
function, it causes the variable name to have a visible scope restricted to that
function and its children. With no operands, local writes a list of local variables
to the standard output. It is an error to use local when not within a function. The
return status is 0 unless local is used outside a function, an invalid name is sup-
plied, or name is a readonly variable.
logout Exit a login shell.
popd [-n] [+n] [-n]
Removes entries from the directory stack. With no arguments, removes the top direc-
tory from the stack, and performs a cd to the new top directory. Arguments, if sup-
plied, have the following meanings:
+n Removes the nth entry counting from the left of the list shown by dirs, start-
ing with zero. For example: ‘‘popd +0’’ removes the first directory, ‘‘popd
+1’’ the second.
-n Removes the nth entry counting from the right of the list shown by dirs,
starting with zero. For example: ‘‘popd -0’’ removes the last directory,
‘‘popd -1’’ the next to last.
-n Suppresses the normal change of directory when removing directories from the
stack, so that only the stack is manipulated.
If the popd command is successful, a dirs is performed as well, and the return status
is 0. popd returns false if an invalid option is encountered, the directory stack is
empty, a non-existent directory stack entry is specified, or the directory change
fails.
printf [-v var] format [arguments]
Write the formatted arguments to the standard output under the control of the format.
The format is a character string which contains three types of objects: plain charac-
ters, which are simply copied to standard output, character escape sequences, which
are converted and copied to the standard output, and format specifications, each of
which causes printing of the next successive argument. In addition to the standard
printf(1) formats, %b causes printf to expand backslash escape sequences in the cor-
responding argument (except that \c terminates output, backslashes in \', \", and \?
are not removed, and octal escapes beginning with \0 may contain up to four digits),
and %q causes printf to output the corresponding argument in a format that can be
reused as shell input.
The -v option causes the output to be assigned to the variable var rather than being
printed to the standard output.
The format is reused as necessary to consume all of the arguments. If the format
requires more arguments than are supplied, the extra format specifications behave as
if a zero value or null string, as appropriate, had been supplied. The return value
is zero on success, non-zero on failure.
pushd [-n] [dir]
pushd [-n] [+n] [-n]
Adds a directory to the top of the directory stack, or rotates the stack, making the
new top of the stack the current working directory. With no arguments, exchanges the
top two directories and returns 0, unless the directory stack is empty. Arguments,
if supplied, have the following meanings:
+n Rotates the stack so that the nth directory (counting from the left of the
list shown by dirs, starting with zero) is at the top.
-n Rotates the stack so that the nth directory (counting from the right of the
list shown by dirs, starting with zero) is at the top.
-n Suppresses the normal change of directory when adding directories to the
stack, so that only the stack is manipulated.
dir Adds dir to the directory stack at the top, making it the new current working
directory.
If the pushd command is successful, a dirs is performed as well. If the first form
is used, pushd returns 0 unless the cd to dir fails. With the second form, pushd
returns 0 unless the directory stack is empty, a non-existent directory stack element
is specified, or the directory change to the specified new current directory fails.
pwd [-LP]
Print the absolute pathname of the current working directory. The pathname printed
contains no symbolic links if the -P option is supplied or the -o physical option to
the set builtin command is enabled. If the -L option is used, the pathname printed
may contain symbolic links. The return status is 0 unless an error occurs while
reading the name of the current directory or an invalid option is supplied.
read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d delim] [name ...]
One line is read from the standard input, or from the file descriptor fd supplied as
an argument to the -u option, and the first word is assigned to the first name, the
second word to the second name, and so on, with leftover words and their intervening
separators assigned to the last name. If there are fewer words read from the input
stream than names, the remaining names are assigned empty values. The characters in
IFS are used to split the line into words. The backslash character (\) may be used
to remove any special meaning for the next character read and for line continuation.
Options, if supplied, have the following meanings:
-a aname
The words are assigned to sequential indices of the array variable aname,
starting at 0. aname is unset before any new values are assigned. Other name
arguments are ignored.
-d delim
The first character of delim is used to terminate the input line, rather than
newline.
-e If the standard input is coming from a terminal, readline (see READLINE above)
is used to obtain the line.
-n nchars
read returns after reading nchars characters rather than waiting for a com-
plete line of input.
-p prompt
Display prompt on standard error, without a trailing newline, before attempt-
ing to read any input. The prompt is displayed only if input is coming from a
terminal.
-r Backslash does not act as an escape character. The backslash is considered to
be part of the line. In particular, a backslash-newline pair may not be used
as a line continuation.
-s Silent mode. If input is coming from a terminal, characters are not echoed.
-t timeout
Cause read to time out and return failure if a complete line of input is not
read within timeout seconds. This option has no effect if read is not reading
input from the terminal or a pipe.
-u fd Read input from file descriptor fd.
If no names are supplied, the line read is assigned to the variable REPLY. The
return code is zero, unless end-of-file is encountered, read times out, or an invalid
file descriptor is supplied as the argument to -u.
readonly [-apf] [name[=word] ...]
The given names are marked readonly; the values of these names may not be changed by
subsequent assignment. If the -f option is supplied, the functions corresponding to
the names are so marked. The -a option restricts the variables to arrays. If no
name arguments are given, or if the -p option is supplied, a list of all readonly
names is printed. The -p option causes output to be displayed in a format that may
be reused as input. If a variable name is followed by =word, the value of the vari-
able is set to word. The return status is 0 unless an invalid option is encountered,
one of the names is not a valid shell variable name, or -f is supplied with a name
that is not a function.
return [n]
Causes a function to exit with the return value specified by n. If n is omitted, the
return status is that of the last command executed in the function body. If used
outside a function, but during execution of a script by the . (source) command, it
causes the shell to stop executing that script and return either n or the exit status
of the last command executed within the script as the exit status of the script. If
used outside a function and not during execution of a script by ., the return status
is false. Any command associated with the RETURN trap is executed before execution
resumes after the function or script.
set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
Without options, the name and value of each shell variable are displayed in a format
that can be reused as input for setting or resetting the currently-set variables.
Read-only variables cannot be reset. In posix mode, only shell variables are listed.
The output is sorted according to the current locale. When options are specified,
they set or unset shell attributes. Any arguments remaining after the options are
processed are treated as values for the positional parameters and are assigned, in
order, to $1, $2, ... $n. Options, if specified, have the following meanings:
-a Automatically mark variables and functions which are modified or created for
export to the environment of subsequent commands.
-b Report the status of terminated background jobs immediately, rather than
before the next primary prompt. This is effective only when job control is
enabled.
-e Exit immediately if a simple command (see SHELL GRAMMAR above) exits with a
non-zero status. The shell does not exit if the command that fails is part
of the command list immediately following a while or until keyword, part of
the test in an if statement, part of a && or ││ list, or if the command’s
return value is being inverted via !. A trap on ERR, if set, is executed
before the shell exits.
-f Disable pathname expansion.
-h Remember the location of commands as they are looked up for execution. This
is enabled by default.
-k All arguments in the form of assignment statements are placed in the environ-
ment for a command, not just those that precede the command name.
-m Monitor mode. Job control is enabled. This option is on by default for
interactive shells on systems that support it (see JOB CONTROL above). Back-
ground processes run in a separate process group and a line containing their
exit status is printed upon their completion.
-n Read commands but do not execute them. This may be used to check a shell
script for syntax errors. This is ignored by interactive shells.
-o option-name
The option-name can be one of the following:
allexport
Same as -a.
braceexpand
Same as -B.
emacs Use an emacs-style command line editing interface. This is enabled
by default when the shell is interactive, unless the shell is started
w
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -