Dataset Viewer
Auto-converted to Parquet Duplicate
chapter_title
stringclasses
9 values
section_title
stringlengths
6
77
num_words
int64
7
5.33k
num_chars
int64
47
32.6k
text
stringlengths
47
32.6k
Introduction
What is Bash?
157
954
Bash is the shell, or command language interpreter, for the gnu operating system. The name is an acronym for the ‘Bourne-Again SHell’, a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell sh, which appeared in the Seventh Edition Bell Labs Research version of Unix. Bash is largely compat...
Introduction
What is a shell?
350
2,378
At its base, a shell is simply a macro processor that executes commands. The term macro processor means functionality where text and symbols are expanded to create larger expressions. A Unix shell is both a command interpreter and a programming language. As a command interpreter, the shell provides the user interface t...
Definitions
2 Definitions
427
2,569
These definitions are used throughout the remainder of this manual. POSIX A family of open system standards based on Unix. Bash is primarily concerned with the Shell and Utilities portion of the posix 1003.1 standard. blank A space or tab character. whitespace A character belonging to the space character class in t...
Basic Shell Features
3 Basic Shell Features
87
569
Bash is an acronym for ‘Bourne-Again SHell’. The Bourne shell is the traditional Unix shell originally written by Stephen Bourne. All of the Bourne shell builtin commands are available in Bash, and the rules for evaluation and quoting are taken from the posix specification for the ‘standard’ Unix shell. This chapter br...
Basic Shell Features
Shell Syntax
113
720
When the shell reads input, it proceeds through a sequence of operations. If the input indicates the beginning of a comment, the shell ignores the comment symbol (‘#’), and the rest of that line. Otherwise, roughly speaking, the shell reads its input and divides the input into words and operators, employing the quoting...
Basic Shell Features
Shell Operation
138
870
The following is a brief description of the shell’s operation when it reads and executes a command. Basically, the shell does the following: 1. Reads its input from a file, from a string supplied as an argument to the -c invocation option, or from the user’s terminal. 2. Breaks the input into words and operators, obeyi...
Basic Shell Features
Quoting
103
675
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 shell metacharacters has special meaning to the she...
Basic Shell Features
Escape Character
63
378
A non-quoted backslash ‘\’ is the Bash escape character. It preserves the literal value of the next character that follows, removing any special meaning it has, with the exception of newline. If a \newline pair appears, and the backslash itself is not quoted, the \newline is treated as a line continuation (that is, it ...
Basic Shell Features
Single Quotes
31
195
Enclosing characters in single quotes (‘’’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
Basic Shell Features
Double Quotes
164
1,025
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, ‘!’. When the shell is in posix mode, the ‘!’ has no special meaning within double quotes, even when history expansion is enabled. The...
Basic Shell Features
ANSI-C Quoting
167
1,050
Character sequences of the form $’string’ are treated as a special kind of single quotes. The sequence expands to string, with backslash-escaped characters in string replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows: \a alert (bell) \b backspace \e \E An ...
Basic Shell Features
Locale-Specific Translation
780
4,915
Prefixing a double-quoted string with a dollar sign (‘$’), such as $"hello, world", causes the string to be translated according to the current locale. The gettext infrastructure performs the lookup and translation, using the LC_MESSAGES, TEXTDOMAINDIR, and TEXTDOMAIN shell variables, as explained below. See the gettex...
Basic Shell Features
Comments
88
569
In a non-interactive shell, or an interactive shell in which the interactive_comments option to the shopt builtin is enabled, a word beginning with ‘#’ introduces a comment. A word begins at the beginning of a line, after unquoted whitespace, or after an operator. The comment causes that word and all remaining characte...
Basic Shell Features
Shell Commands
64
359
A simple shell command such as echo a b c consists of the command itself followed by arguments, separated by spaces. More complex shell commands are composed of simple commands arranged together in a variety of ways: in a pipeline in which the output of one command becomes the input of a second, in a loop or conditiona...
Basic Shell Features
Reserved Words
101
522
Reserved words are words that have special meaning to the shell. They are used to begin and end the shell’s compound commands. The following words are recognized as reserved when unquoted and the first word of a command (see below for exceptions): if then elif else fi time for in until while do done case esac coproc se...
Basic Shell Features
Simple Commands
78
449
A simple command is the kind of command that’s executed most often. It’s just a sequence of words separated by blanks, terminated by one of the shell’s control operators. The first word generally specifies a command to be executed, with the rest of the words being that command’s arguments. The return status of a simple...
Basic Shell Features
Pipelines
466
2,742
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]] [!] command1 [ | or |& command2 ]... The output of each command in the pipeline is connected via a pipe to the input of the next command. That is, each command reads the previ...
Basic Shell Features
Lists of Commands
272
1,560
A list is a sequence of one or more pipelines separated by one of the operators ‘;’, ‘&’, ‘&&’, or ‘||’, and optionally terminated by one of ‘;’, ‘&’, or a newline. Of these list operators, ‘&&’ and ‘||’ have equal precedence, followed by ‘;’ and ‘&’, which have equal precedence. A sequence of one or more newlines may ...
Basic Shell Features
Compound Commands
101
639
Compound commands are the shell programming language constructs. Each construct begins with a reserved word or control operator and is terminated by a corresponding reserved word or operator. Any redirections associated with a compound command apply to all commands within that compound command unless explicitly overrid...
Basic Shell Features
Looping Constructs
332
1,986
Bash supports the following looping constructs. Note that wherever a ‘;’ appears in the description of a command’s syntax, it may be replaced with one or more newlines. until The syntax of the until command is: until test-commands; do consequent-commands; done Execute consequent-commands as long as test-commands has a...
Basic Shell Features
Conditional Constructs
2,104
12,805
if The syntax of the if command is: if test-commands; then consequent-commands; [elif more-test-commands; then more-consequents;] [else alternate-consequents;] fi The test-commands list is executed, and if its return status is zero, the consequent-commands list is executed. If test-commands returns a non-zero status,...
Basic Shell Features
Grouping Commands
210
1,202
Bash provides two ways to group a list of commands to be executed as a unit. When commands are grouped, redirections may be applied to the entire command list. For example, the output of all the commands in the list may be redirected to a single stream. () ( list ) Placing a list of commands between parentheses forces ...
Basic Shell Features
Coprocesses
387
2,330
A coprocess is a shell command preceded by the coproc reserved word. A coprocess is executed asynchronously 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 syntax for a coprocess is: coproc [NAME] comm...
Basic Shell Features
GNU Parallel
121
777
There are ways to run commands in parallel that are not built into Bash. GNU Parallel is a tool to do just that. GNU Parallel, as its name suggests, can be used to build and run commands in parallel. You may run the same command with different arguments, whether they are filenames, usernames, hostnames, or lines read f...
Basic Shell Features
Shell Functions
1,230
7,428
Shell functions are a way to group commands for later execution using a single name for the group. They are executed just like a "regular" simple command. When the name of a shell function is used as a simple command name, the shell executes the list of commands associated with that function name. Shell functions are e...
Basic Shell Features
Shell Parameters
677
4,121
A parameter is an entity that stores values. It can be a name, a number, or one of the special characters listed below. 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 the description of the declare builtin i...
Basic Shell Features
Positional Parameters
135
807
A positional parameter is a parameter denoted by one or more digits, other than the single digit 0. Positional parameters are assigned from the shell’s arguments when it is invoked, and may be reassigned using the set builtin command. Positional parameter N may be referenced as ${N}, or as $N when N consists of a singl...
Basic Shell Features
Special Parameters
486
2,844
The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed. Special parameters are denoted by one of the following characters. * ($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional ...
Basic Shell Features
Shell Expansions
178
1,187
Expansion is performed on the command line after it has been split into tokens. Bash performs these expansions: • brace expansion • tilde expansion • parameter and variable expansion • command substitution • arithmetic expansion • word splitting • filename expansion • quote removal The order of expansions is: brace ex...
Basic Shell Features
Brace Expansion
480
2,990
Brace expansion is a mechanism to generate arbitrary strings sharing a common prefix and suffix, either of which can be empty. This mechanism is similar to filename expansion , but the filenames generated need not exist. Patterns to be brace expanded are formed from an optional preamble, followed by either a series of ...
Basic Shell Features
Tilde Expansion
405
2,460
If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as ...
Basic Shell Features
Shell Parameter Expansion
2,859
17,201
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 protect the variable to be expanded from characters immediately following it which could be interpreted as part of the n...
Basic Shell Features
Command Substitution
493
3,169
Command substitution allows the output of a command to replace the command itself. The standard form of command substitution occurs when a command is enclosed as follows: $(command) or (deprecated) ‘command‘. Bash performs command substitution by executing command in a subshell environment and replacing the command sub...
Basic Shell Features
Arithmetic Expansion
140
943
Arithmetic expansion evaluates an arithmetic expression and substitutes the result. The format for arithmetic expansion is: $(( expression )) The expression undergoes the same expansions as if it were within double quotes, but unescaped double quote characters in expression are not treated specially and are removed. Al...
Basic Shell Features
Process Substitution
143
873
Process substitution allows a process’s input or output to be referred to using a filename. It takes the form of <(list) or >(list) The process list is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. If the...
Basic Shell Features
Word Splitting
342
2,134
The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting. Words that were not expanded are not split. The shell treats each character of $IFS as a delimiter, and splits the results of the other expansions into fields us...
Basic Shell Features
Filename Expansion
437
2,584
After word splitting, unless the -f option has been set, Bash scans each word for the characters ‘*’, ‘?’, and ‘[’. If one of these characters appears, and is not quoted, then the word is regarded as a pattern, and replaced with a sorted list of filenames matching the pattern, subject to the value of the GLOBSORT shell...
Basic Shell Features
Pattern Matching
774
4,939
Any character that appears in a pattern, other than the special pattern characters described below, matches itself. The nul character may not occur in a pattern. A backslash escapes the following character; the escaping backslash is discarded when matching. The special pattern characters must be quoted if they are to b...
Basic Shell Features
Quote Removal
26
158
After the preceding expansions, all unquoted occurrences of the characters ‘\’, ‘’’, and ‘"’ that did not result from one of the above expansions are removed.
Basic Shell Features
Redirections
529
3,334
Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. Redirection allows commands’ file handles to be duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and writes to. When used with the exec bui...
Basic Shell Features
Redirecting Input
39
231
Redirecting input opens the file whose name results from the expansion of word for reading on file descriptor n, or the standard input (file descriptor 0) if n is not specified. The general format for redirecting input is: [n]<word
Basic Shell Features
Redirecting Output
131
743
Redirecting output opens the file whose name results from the expansion of word for writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the file does not exist it is created; if it does exist it is truncated to zero size. The general format for redirecting output is: [n]>[...
Basic Shell Features
Appending Redirected Output
51
293
Redirecting output in this fashion opens the file whose name results from the expansion of word for appending on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the file does not exist it is created. The general format for appending output is: [n]>>word
Basic Shell Features
Redirecting Standard Output and Standard Error
86
530
This construct redirects both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to the file whose name is the expansion of word. There are two formats for redirecting standard output and standard error: &>word and >&word Of the two forms, the first is preferred. This is semantica...
Basic Shell Features
Appending Standard Output and Standard Error
51
327
This construct appends both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to the file whose name is the expansion of word. The format for appending standard output and standard error is: &>>word This is semantically equivalent to >>word 2>&1 (see Duplicating File Descriptors ...
Basic Shell Features
Here Documents
246
1,557
This type of redirection instructs the shell to read input from the current source until it reads a line containing only delimiter (with no trailing blanks). All of the lines read up to that point then become the standard input (or file descriptor n if n is specified) for a command. The format of here-documents is: [n]...
Basic Shell Features
Here Strings
61
392
A variant of here documents, the format is: [n]<<< word The word undergoes tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal. Filename expansion and word splitting are not performed. The result is supplied as a single string, with a newline appended, to the...
Basic Shell Features
Duplicating File Descriptors
158
884
The redirection operator [n]<&word is used to duplicate input file descriptors. If word expands to one or more digits, file descriptor n is made to be a copy of that file descriptor. It is a redirection error if the digits in word do not specify a file descriptor open for input. If word evaluates to ‘-’, file descripto...
Basic Shell Features
Moving File Descriptors
57
364
The redirection operator [n]<&digitmoves the file descriptor digit to file descriptor n, or the standard input (file descriptor 0) if n is not specified. digit is closed after being duplicated to n. Similarly, the redirection operator [n]>&digitmoves the file descriptor digit to file descriptor n, or the standard outpu...
Basic Shell Features
Opening File Descriptors for Reading and Writing
42
226
The redirection operator [n]<>word opens the file whose name is the expansion of word for both reading and writing on file descriptor n, or on file descriptor 0 if n is not specified. If the file does not exist, it is created.
Basic Shell Features
Simple Command Expansion
282
1,805
When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order. 1. The words that the parser has marked as variable assignments (those preceding the command name) and redirections are saved for later processing. 2. The words that...
Basic Shell Features
Command Search and Execution
348
1,982
After a command has been split into words, if it results in a simple command and an optional list of arguments, the shell performs the following actions. 1. If the command name contains no slashes, the shell attempts to locate it. If there exists a shell function by that name, that function is invoked. 2. If the name d...
Basic Shell Features
Command Execution Environment
466
2,808
The shell has an execution environment, which consists of the following: • Open files inherited by the shell at invocation, as modified by redirections supplied to the exec builtin. • The current working directory as set by cd, pushd, or popd, or inherited by the shell at invocation. • The file creation mode mask as se...
Basic Shell Features
Environment
256
1,587
When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value. Bash provides several ways to manipulate the environment. On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking i...
Basic Shell Features
Exit Status
311
1,808
The exit status of an executed command is the value returned by the waitpid system call or equivalent function. Exit statuses fall between 0 and 255, though, as explained below, the shell may use values above 125 specially. Exit statuses from shell builtins and compound commands are also limited to this range. Under ce...
Basic Shell Features
Signals
602
3,514
When Bash is interactive, in the absence of any traps, it ignores SIGTERM (so that ‘kill 0’ does not kill an interactive shell), and catches and handles SIGINT (so that the wait builtin is interruptible). When Bash receives a SIGINT, it breaks out of any executing loops. In all cases, Bash ignores SIGQUIT. If job contr...
Basic Shell Features
Shell Scripts
730
4,357
A shell script is a text file containing shell commands. When such a file is used as the first non-option argument when invoking Bash, and neither the -c nor -s option is supplied, Bash reads and executes commands from the file, then exits. This mode of operation creates a non-interactive shell. If the filename does no...
Basic Shell Features
Bourne Shell Builtins
3,821
21,987
The following shell builtin commands are inherited from the Bourne Shell. These commands are implemented as specified by the posix standard. : (a colon) : [arguments] Do nothing beyond expanding arguments and performing redirections. The return status is zero. . (a period) . [-p path] filename [arguments] The. command ...
Basic Shell Features
Bash Builtin Commands
4,958
29,771
This section describes builtin commands which are unique to or have been extended in Bash. Some of these commands are specified in the posix standard. alias alias [-p] [name[=value]...] Without arguments or with the -p option, alias prints the list of aliases on the standard output in a form that allows them to be reus...
Basic Shell Features
The Set Builtin
1,408
8,401
This builtin is so complicated that it deserves its own section. set allows you to change the values of shell options and set the positional parameters, or to display the names and values of shell variables. set set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [argument...] set [+abefhkmnptuvxBCEHPT] [+o option-nam...
End of preview. Expand in Data Studio

Bash Reference Manual — Cleaned Dataset

This dataset contains cleaned and structured text extracted from the GNU Bash Reference Manual, Edition 5.3.

The original manual was converted to plain text and processed to reduce PDF extraction artifacts, remove navigation references and page numbers, preserve paragraph structure, and split the content into topic-centered sections.

The dataset is intended primarily for language-model pretraining and continued pretraining, especially for models learning Bash, shell scripting, command-line usage, and Linux-related concepts.

Format

Each record contains metadata such as:

  • chapter title
  • section title
  • cleaned text
  • word and character counts

License

The source manual is published by the Free Software Foundation under the GNU Free Documentation License (GFDL) 1.3 or later, with no Invariant Sections, Front-Cover Texts, or Back-Cover Texts.

This dataset is a modified and reorganized derivative of the original manual and is distributed under the same license.

A copy of the GNU Free Documentation License is included with the dataset.

Downloads last month
11