bash command meaning

containing shell commands. If the current cursor position is at the end of the current command, Otherwise, the editor given by ename is invoked on a file containing those commands. Set to the line of input read by the read builtin command when no arguments are supplied. When a match is found, the corresponding list is executed. This option is only used by interactive shells. If there are arguments after the string, they are assigned to the positional parameters, starting with $0. If the first character of the redirection operator is >, the redirection refers to the standard output (file descriptor 1). Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the set builtin command. the two characters before point. The format is a character string which contains three types of objects: plain characters, which are 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. jobs replaces any When given a numeric argument, The word boundaries are the same as. If no names are given, or if the -p option is supplied, a list of all names that are exported in this shell is printed. ~/.profile, in that order. expression are saved in the array variable BASH_REMATCH. Of these list operators, && and || have equal precedence, followed by ; and &, which have equal precedence. Brace expansion introduces a slight incompatibility with within double quotes. Any completions specified by a filename expansion pattern to the Omitting the colon results in a test only for a parameter that is unset, bypassing the test if the parameter is null. *" one of the patterns in GLOBIGNORE. OPTARG and no diagnostic message is printed. An exit status of zero indicates success. For the final word on a command’s usage, refer to its man pages. When an interactive shell that is not a login shell is started, Consequently, one may use file names with tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell assigns the expanded value. compat41: If set, bash, when in posix mode, treats a single quote in a double-quoted parameter expansion as a special character. corresponding to each member of, An array variable whose members are assigned by the, An array variable whose members are the source filenames corresponding and executes commands from the first one that exists and is readable. The default is system-dependent. Backslash does not act as an escape character. In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. The -d option causes the shell to forget the remembered location of each name. The return status is 0 unless local is used outside a function, an invalid name is supplied, or name is a readonly variable. SIGHUP to all jobs, running or stopped. The pattern, and replaced with an alphabetically sorted list of A sample value is ".:~:/usr". If the search is unsuccessful, the shell searches for a defined shell function named command_not_found_handle. -p prompt: Display prompt on standard error, without a trailing newline, before attempting to read any input. Exit from within a for, while, until, or select loop. A colon-separated list of file names to be checked for mail. Note that the order of redirections is significant. Arithmetic expressions starting with a - must be separated by whitespace from the preceding : to be distinguished from the Use Default Values expansion. conflicts with pathname expansion. This option is on Delete the character behind the cursor. The options appearing in SHELLOPTS are those reported as on by set -o. readline output stream. If this variable is set, single word simple commands without redirections are treated as candidates for resumption of an existing stopped job. The if list is executed. Once a compspec has been found, it is used to generate the list of command2 is executed if, and only if, command1 returns an exit status of zero. If n is not given, it is assumed to be 1. All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. Word splitting is not performed, with the exception of "[email protected]" as explained below under Special Parameters. IFS characters serves to delimit words. If the -p option is supplied, no path search is performed, and filename is used as the full file name of the command. If the COMMAND EXECUTION above), The filter is a pattern as used for pathname expansion; a & Intended to be used with shell functions. -k: All arguments in the form of assignment statements are placed in the environment for a command, not just those that precede the command name. If that function exists, it is invoked with the original command and the original command's arguments as its arguments, and the function's exit status becomes the exit status of the shell. The arguments become the arguments to command. An array variable whose members are the line numbers in source files The ! An index into ${COMP_WORDS} of the word containing the current cursor position. This is an incremental search. histappend: If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file. With no options, indicate how each name would be interpreted if used as a command name. If the -b option to the set builtin command is enabled, bash reports such changes immediately. The following list of operators is grouped into levels of equal-precedence operators. the return status is zero unless an optname is not a valid shell This variable overrides the value of LANG and any other LC_ variable specifying a locale category. The shell treats several parameters specially. subscript is * or @, removes the entire array. command (see Brace expansions may be nested. A single quote may not occur This option is disabled by default. error occurs. set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...], set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]. Assign Default Values. keyseq differs from The special pattern characters have the following meanings: Within contained a command substitution, the exit status of the command is n, or on file descriptor 0 if Meta-Rubout: backward-kill-word This option is on by default in interactive shells. Each call to readline() starts in insert mode. The general format for redirecting input is: Redirection of output causes the file whose name results from the expansion of word to be opened for writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. All tokens in the expression undergo parameter expansion, string If the first argument is !, the value is the negation of the two-argument test using the second and third arguments. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a trap has been set will cause the wait builtin to return immediately with an exit status greater than 128, immediately after which the trap is executed. If the name is neither a shell function nor a builtin, and contains no slashes, bash searches each element of the PATH for a directory containing an executable file by that name. If a parameter with no value is expanded within double quotes, a The file descriptors can be utilized as arguments to shell commands and redirections using standard word expansions. Begin saving the characters typed into the current keyboard macro. This is a synonym for '1-$'. HOME is unset, the home directory of the user executing the shell is Substrings matched by parenthesized subexpressions within the regular This is a synonym for ‘!-1’. In the latter Play around with different shells and find one that's right for you, but be aware that this tutorial contains bash shell commands only and not everything listed here (maybe none of it) will be applicable to shells other than bash. -C: If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators. Remove matching prefix pattern. completion code had generated them directly from a completion specification delayed suspend character (typically The expression is evaluated according to the rules described below in the section "Arithmetic Evaluation". set builtin command. command, with any trailing newlines deleted. rbash turns off any restrictions in the shell spawned to execute the is placed in name, OPTARG is unset, and a diagnostic message is printed. A positional parameter is a parameter denoted by one or more digits, other than the single digit 0. Any completions specified by a pathname expansion pattern to the -G option are generated next. > and the jobs command), the current job is always flagged with a May also be specified as -e.file: File names. expand_aliases shell option is set using If you want to check top 10 Lines of bash command history then you need to use head command on history command output as shown below. A negative argument inserts the nth word from the end of the previous command. Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. The results of the expansion are prefix-matched against the word being 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. the following. Several shell options settable with the Disabling a builtin allows a disk command which has the same name as a shell builtin to be executed without specifying a full pathname, even though the shell normally searches for builtins before disk commands. login_shell: The shell sets this option if it is started as a login shell (see "Invocation" above). OPTIND is set to the index of the first non-option argument, and name is set to ?. Perform history and alias expansion on the current line. If the extdebug shell option is enabled using shopt, the source file name and line number where the function is defined are displayed as well. history builtin command may be used to see what a history expansion will The single quotes must match (an even number) and the characters between the single quotes are considered quoted. If expansion is attempted on an ", make ". parameter assignments, as described above in After saving the history, the history file is truncated to contain no more than HISTFILESIZE lines. Expands to the effective user ID of the current user, initialized at for processes run from the shell. An array variable containing the names of all shell functions currently in the execution call stack. promptvars shell option (see the description of the A full search of the directories in shopt builtin), and The two or three characters which control history expansion and tokenization (see the section "History Expansion" below). Some common groups of bash operators are arithmetic operators, comparison operators, bit-wise operators, logical operators, string operators, and file operators. otherwise the history file is overwritten. is printed and the command is not executed. necessary, by removing the oldest entries, If set to On, readline performs filename matching and completion in a case-insensitive fashion. PATH is performed only if the command is not found in the hash table. Move back to the start of the current or previous word. bash reads and executes commands from the file ~/.bash_logout, if it The sorting order of characters in range expressions is determined by the current locale and the value of the LC_COLLATE shell variable, if set. A shell function, defined as described above under the section "Shell Grammar", stores a series of commands for later execution. non-incremental. files are read, shell functions are not inherited from the environment, the shell is executing a command as the result of a trap, The killed text is saved in a When the shell is in posix mode, time may be followed by a newline. Background processes which attempt to read from (write to) the If you use a Mac, try opening your Mac terminal. An argument of -l lists the signal names. A value of ignoreboth is shorthand for ignorespace and ignoredups. The -x and -v options are turned off. Operator precedence is used when there are five or more arguments. If neither variable is set, The element of BASH_REMATCH with index 0 is the portion of the string matching the entire regular expression. Search forward through the history using a non-incremental search for a string supplied by the user. The only exceptions to this are the expansions of "[email protected]" and "${name[@]}" as explained above (see the section "Parameters"). The systemwide per-interactive-shell startup file. variable may be assigned to by a statement of the form. execution call stack. The list of expansions that would have been generated by, Print all of the functions and their key bindings to the There are four parser directives used. When setting or unsetting options, After the optional word designator, there may appear a sequence of one or more of the following modifiers, each preceded by a ':'. are enabled, non-zero otherwise. Do not read either the system-wide startup file, Do not read and execute the personal initialization file. Expands to the names of variables whose names begin with prefix, separated by the first character of the IFS special variable. Bash allows the current readline key bindings to be displayed or modified (see somewhat confusing. name[subscript]=value syntax introduced above. The initial value is 0. When there are no array members, ${name[@]} expands to nothing. "$@" and "${name[@]}" To be safe, always put alias definitions on a separate line, and do not use alias in compound commands. If neither variable is set, vi is used. If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. The by default. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. It takes place in two parts. If the variable The characters in IFS are used to split the line into words. For example: Control-u: universal-argument that did not occur within double quotes for On many terminals, the meta key is used to send eight-bit characters. See the description of the will match. Drag the word before point past the word after point, moving point over that word as well. The following paragraphs describe how bash executes its startup files. If set to zero, the number of entries in the history list is not limited. Otherwise, it is the exit status of the last command executed in list. sending the signal to a particular job, it should be removed from the If any jobs are running, this causes the exit to be deferred until a second exit is attempted without an intervening command (see the section "Job Control"). The position of the insertion point in the readline line buffer, for use with "bind -x" (see the section "Shell Builtin Commands" below). , the default, then [ and How can I customize my command prompt in bash? Next, the string specified as the argument to the -W option is considered. If a correction is found, the corrected file name is printed, and the command proceeds. Note that A : separates the event specification from the word designator. executed in the list. Backslash may be used to escape a newline, if necessary. search. A pair of characters separated by a hyphen denotes a range expression; any character that sorts between those two characters, inclusive, using the current locale's collating sequence and character set, is matched. manipulate the history file. fix errors in previous commands quickly. %[p][l]U: The number of CPU seconds spent in user mode. A command’s position in the list is not representative of its usefulness or simplicity. Suggestions and ‘philosophical’ bug reports may be mailed noclobber option to the of a number N, optionally prefixed When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion. Tildes are expanded in filenames as described below under "Tilde Expansion" in the "Expansion" section. As a special case, if this command is immediately followed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. behave exactly like, Expand the line as the shell does. Arithmetic expansion allows the evaluation of an arithmetic expression and the substitution of the result. If enabled, history expansion will be performed unless an ! If the tilde-prefix is a ‘~+’, the value of the shell variable If Prints "text1This is the value of my variable.text2". If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file. Arithmetic Expansion below). If a prefix matches more than one job, cmd does not specify a valid history line, in which case When the end of options is encountered, getopts exits with a The list of words following in is expanded, generating a list of items. If the last arg evaluates to 0, let returns 1; 0 is returned otherwise. internally. bash reads and executes commands from this file, then exits. -n: Display information only about jobs that have changed status since the user was last notified of their status. one or more slashes, the shell executes the named program in a -f or section as accepting options preceded by -n nchars: read returns after reading nchars characters rather than waiting for a complete line of input, but honor a delimiter if fewer than nchars characters are read before the delimiter. list. Consecutive kills cause the text to be globstar: If set, the pattern ** used in a pathname expansion context will match all files and zero or more directories and subdirectories. The return status is false if any sigspec is invalid; otherwise trap returns true. Display Error if Null or Unset. Equivalent to -D, but the output is in the GNU gettext po (portable object) file format. Each word in The text between the point and mark is referred to as the region. and bindings. bash is started non-interactively, to run a shell script, for example, it Make names readonly. completion matches. lexicographically between x and y, inclusive. find a compspec for the portion following the final slash. -E: If set, any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment. When the old-style backquote form of substitution is used, not escaped by a backslash or within a quoted string, and not within an the string to be translated according to the current locale. 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. After these matches have been generated, any shell function or command Kill the word behind point. If no names are supplied, the line read is assigned to the variable REPLY. This command is bound to M-# in emacs mode and to # in vi command mode. If it does not exist, EOF signifies the end of input to the shell. These names cannot then be assigned values by subsequent assignment statements or unset. The previous job may be referenced using %-. If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status, subject to the following conditions. Originally released in 1989 as a free replacement for the Bourne Shell, bash is part of the GNU project. This changes the contents of the readline editing buffer. Automatically set to a string that uniquely a fashion similar to, This command, as seen in the previous example, terminates an, This directive takes a single filename as an argument and reads commands to not receive When a positional parameter consisting of more than a single The exit_status argument to -l is a number specifying either a signal number or the exit status of a process terminated by a signal. Refer to the most recent command preceding the current position in the history list containing string. declare, local, and Attempt completion on the text before point, treating it as a shell variable. If the shell option SHELLOPTS variable, if it appears in the environment, is ignored, process group ID. The words that the parser has marked as variable assignments (those The list must be terminated with a newline or semicolon. HISTIGNORE variables may be set to cause the shell to save only a subset of the The -S option causes the mask to be printed in symbolic form; the default output is an octal number. Ordinarily, variables and their values Other options are interpreted as follows: -c: The maximum size of core files created. while conforming to the POSIX standard as well. If both options are supplied, -A takes precedence. The individual per-interactive-shell startup file. readline initialization file. if there is no unquoted slash) are considered a tilde-prefix. See also the exit builtin The return status is the exit status of list. 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. Expressions may be combined using the following operators, listed in decreasing order of precedence. %- refers to the shell’s notion of the current job. The default value is 500. The possible completions are the members of the resultant list which match the word being completed. except that traps caught by the shell are reset to the values If the first argument is not a valid unary conditional operator, the expression is false. When a command is described as killing text, the text Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. read builtin accepts a disown builtin (see The supplied names are marked for automatic export to the environment of subsequently executed commands. When the variable is assigned a value, all uppercase characters are converted to lowercase. the foreground or started in the background. the second word on the previous line) at point. Kill all characters on the current line, no matter where point is. With no arguments, removes the top directory from the stack, and performs a cd to the new top directory. (and, if necessary, the -P and -S options) The pathname expansion pattern globpat is expanded to generate the possible completions. bash with the exception that the following are disallowed or not performed: When a command that is found to be a shell script is executed When used in a function, makes each name local, as with the local command, unless the -g option is supplied, If a variable name is followed by =value, the value of the variable is set to value. If getopts is silent, the option character found is placed in OPTARG and no diagnostic message is printed. Blank lines are ignored. Aliases are expanded when a function definition is read, Note that if no expansion occurs, no splitting is performed. :s/string1/string2/" (see Modifiers below). re-executes the last command. A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. Once a compspec has been found, it is used to generate the list of matching words. This behavior is also an issue when functions are executed. For almost every purpose, aliases are superseded by getopts normally parses the positional parameters, but if more arguments are direxpand: If set, bash replaces directory names with the results of word expansion when performing filename completion. You can then continue to use your terminal window. -s: Store the args in the history list as a single entry. continuation. Resume each suspended job jobspec in the background, as if it had been started with &. from the stack, so that only the stack is manipulated. The word before point is treated as a pattern for pathname expansion, When used in the text of the message, $_ expands to the name of the current mailfile. a value to, Each time this parameter is The shell supports a history expansion feature that Sometimes, however, it is the sign of the argument that is significant. The full pathname to the shell is kept in this environment variable. Within [ and ], an equivalence class can be specified using the syntax [=c=], which matches all characters with the same collation weight (as defined by the current locale) as the character c. Within [ and ], the syntax [.symbol.] If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.