Bash is a command-line language that stands for Bourne Again Shell. It follows the Unix core-philosophy: Tools should do one thing, and do it well. Unix Bash script follows the following basic syntax
command option(s) argument(s)
Where command
is a specific function, option(s)
modify that function
and argument(s)
are the data used as an input
- Common Bash Commands
- Flags
- Standard Input, Standard Output, and Standard Error
- Wildcards (
*
,?
) - Expansions
- Variables
- String Manipulation
- Arrays
- Navigation and Editing Shortcuts
- File Permissions
- File Browsing and Editing
- User Profiles
- Environmental Variables
- Bash Scripting
- Control Structures
- Functions
- Coloring and Styling Text
- Here Documents
- Super Users
- Quotes in Bash
- Miscellaneous
- Acknowledgments
The following are lists of common useful commands in Bash, which is in no way a complete or definitive list. But, I have found these commands useful in my experience using Bash.
cd <path>
: change directory topath
cd ..
: change up one directory (i.e., parent directory)cd
: change to home directorycd -
: change to last directory
chmod
: change file mode bits.perm
permission options includer
for read,w
for write andx
for executable. A+
adds these permissions, while-
removes them.chown
: change ownership of a file (or directory w/-R
). Example:chown -R $USER /media/kDubs/Backup
changes all files withinBackup
to be owned by the current$USER
.clear
: clear’s command terminal recordscp <path/to/file.txt> <target/dirORfile>
: copyfile
to another file or a new directory. E.g.,cp filename.txt
(…additional files…)file2.txt
: copies the contents offilename.txt
tofile2.txt
.cp dir1/filename.txt (...additional files...) dir2/
: copiesfilename.txt
todir2
directory.scp <path/to/file> <path>
: secure version ofcp
for remote transfer.
env
: list environmental variablesexit
: end terminal sessionhelp
: a summarizedbash
command directory for syntactical reference.history
: list history of used commandsls
: list files in working directory- Options:
-a
(all files),-l
(long format), &-t
(order by time last modified)
- Options:
ln
: create a link to another directory (symbolic links only) or file. By default,ln
creates a hard link to a file (directories are not applicable for hard links), which is indistinguishable from the original (i.e., changes to one affect both) --s/--symbolic
: makes the link symbolic, and is distinguishable from the original directory or file. This is mandaman
: manual pages, e.g.man ls
opens the manual for thels
command.mkdir
: make directorymkdir dir1
creates a directory,dir1
.
mv
: move or rename a filemv file.txt dir1/
: movesfile.txt
in CWD todir1
ORmv file1.txt file2.txt
: changes the name offile1.txt
tofile2.txt
pbcopy
(OSX only) - copy to clipboardpbpaste
(OSX only) - paste from clipboardpwd
: print the current working directoryrm
: remove file or directory. For examplerm file1.txt
removes ‘file1.txt’ from current directory.-R
: recursively delete all files and directories within the directory-i
: interactive mode that asks for confirmation before each file is deleted.
rmdir
: remove an empty directoryshutdown
: logout or shutdown.sudo
: super user do. This command gives the user temporary super user privileges. Pronounced ‘sue-doo’.- e.g.,
sudo /root
accesses the system’s root directory.
- e.g.,
touch
: create new filetouch file_name.ext
: createsfile_name.ext
in the current directory.
wc
: counting lines, words or bites
find <dir> <expression>
: findexpression
indir
directory. E.g.,find . -name '*.pdf'
: finds all files in the current directory (.
) that end with the extension.pdf
grep
‘global regular expression print’, for example,grep Mount mountains.txt
.- Options:
-i
: case insensitive,-R
: recursive (directory),-l
: files with matches (rather than matches themselves),-n
: shows line of match,i
: case insensitive
- Options:
locate <name>
: find files and directories that matchname
whereis <command>
: locate binary, source and man-page files for acommand
, e.g.,whereis whereis
.which <command>
: locate a Bash binary on the system
bg [job_#]
: restart a suspended job and send to the backgrounddf
: report (-h
human-readable) file system storage space usage. Disks must be mounted.du
: report (-h
human readable) disk usage by directory. For example,sudo du / -hd1
reports the sizes of each subdirectory under the root, whered1
indicates the level of detail (i.e., depth of directory) to display.fdisk
: manipulate disk partition table. Example:fdisk -l
lists all volumes with partition tables, regardless of whether they are mounted.fg [job#]
: send to the foreground a job running in the backgroundfree
: returns a (-h
: human-readable) memory report.htop
: Human read-abletop
command. Shows current CPU core and memory usagejobs
: show jobs running in the background, sent by&
.kill
: end processes running on the system. For examplekill -1 1234
kills process ID1234
with the lowest priority (i.e.,-1
, ‘hang-up’).lsblk
: list information about all available block devices. Example:lsblk -f
outputs all known blocks an information about their file systems.mkfs
: Create a file system on a specified partition. Example:mkfs -t ext4 /dev/sba1
creates anext4
file system on the first partition ofsba
.parted
: Create and destroy partitions. Does not make file system. Has interactive mode.ps
: list processes running on computer. Example:ps -ax -o pid -o ucomm
prints out a list of names for processes and their respective process ID numbers (PID).tar
: Tape archive utility, creates and unpacks archive files out of one or many file and supports compression.- Create Archive:
tar -cf myArchive.tar dir1 dir2
: creates (c
) and archive file (f
, rather than tape) from all files indir1
anddir2
- Extract Archive:
tar -xfv myArchive.tgz dir1
: extract files (-xf
) frommyArchive
(compressed withgzip
) and place indir1
with verbose option (-v
).
- Create Archive:
Note that much system information is stored in /proc/cpuinfo
on Linux
machines or in the sysctl
tool on MacOS.
awk
: pattern scanning and text processing. Used to manipulate data files, text retrieval and processing.awk
is structured inpattern {action}
statements. e.g.,awk '{print $2 \t $1}' text.txt
: prints the 2nd and 1st column of data in text.txtFNR
: Filter specific rows, for example:awk 'FNR==2 {print $2}'
prints the second field from the send row.
cat
: output contents of file to terminaltac
: prints file in reverse line orderrev
: prints file out in reverse character order
column [-t -s,]
: formats a text file in to columns. May be used with*.csv
to display data in a clearer format, and piped throughless
pager to enable scrolling. E.g.,cat data.csv | column -t -s, | less -S
.-t
: tab separations<char>
: file input separator character<char>
cut
: Remove or ‘cut-out’ sections of each line of a file or files. For example,file.txt
with the following information:
one two three four five
alpha beta gamma delta epsilon
May be cut with cut -f (--fields) 2 file.txt
. This will produce:
two
beta
-
date
: return the date-time to the standard out. For example:date +"%d-%m-%Y"
returned28-06-2017
when I wrote it just now. -
echo
: print to terminal -
jq
: formats.json
files prettily. Pipe in withcat
and out to a pager for scrolling. -
printf
: format printed output. For exampleprintf "Name:\t%s\nID:\t%04d\n" "kDubs" "12"
, where%s
is a provided string and%04d
is a digit. prints the following:Name: kDubs ID: 0012
-
sed
: stream editor. Useful for exchanging some data with another. For example,s/str1/str2
substitutesstr1
withstr2
. Specifically,sed s/snow/rain snowforests.txt
changes the first instance of ‘snow’ in each line to ‘rain’.- global
g
option - addingg/str1/str2
makes the substitute command global
- global
-
sort
: sorts data in a file. Default is to use the first column.- options:
-n
: sorts numeric data,-k#
: sorts column number#
(default is 1),-u
only displays unique rows.
- options:
-
tr
: translate or delete characters from standard input.- e.g.,
cat text.txt | tr [:lower:] [:upper:]
: prints all the lowercase characters in text.txt as uppercase characters.
- e.g.,
-
uniq
: Filters out matching lines from (standard) input and writes it to (standard) output
ip [-a/addr/address]
: list out various network addressesping
: send, receive and time packages to a specific server. For exampleping -c 5 google.com
sends and receives 5 packets from the nearest google.com server. Then, it produces timing statistics based on that.wget
: Download of files from target URL on the web. It supports HTTP, HTTPS, and FTP protocols. For example,wget https://example.com/dumbo.csv
downloadsdumbo.csv
to the current directory.
bash
: interpret script file(s) with Bashexport
: set environmental variable, accessible to sub-processes. E.g.,export name=value
.imgcat
: Like cat but for images. An add-in commandread
: read user input, e.g.,read name
stores the next user input in a variablename
. Thes
(silent) option hides the user input, such as for passwords.select
: Select options from an array, automatically formatted in a numbered list. For example,select option in "cat" "dog" "bird"
.
Flags (AKA options) modify Bash commands. There are two syntactical
types of flags: short-form and long-form. Short-form flags follow
-
, may be strung together under one -
and are a case-sensitive,
single-letter abbreviation of the flag (e.g., -ar
for all
and
recursive
). Long-form flags follow --
and may not be strung together
(e.g., --all --recursive
).
To create a flag in a script use the getopts
operator and the
following syntax:
while getopts a:u:b: option; do
case $option in
u) user=$OPTARG;;
a) echo "The 'a' option is accompanied by a value: $OPTARG (followed by ':')";;
b) echo "The 'b' option has no value"
?) echo "Option $OPTARG is not valid"
esac
done
echo "User: $user"
If a :
precedes the arguments after getopts (e.g., :a:b:
), then any
flag may be entered and caught in the case
statement with ?)
.
What are these
Name | What is it? | Descriptor |
---|---|---|
Standard input (stdin) | Keyboard input | 0 |
Standard output (stdout) | Text on screen | 1 |
Standard error (stderr) | Error text on screen | 2 |
|
: piping operator - standard output from left into standard input on right. E.g.,cat file1.txt | sort > sorted-file1.txt
: lists contents offile1.txt
, sorts it and then saves it to a new filesorted-file1.txt
>
: redirector to file. E.g.,echo 'Hello' > hello.txt
: redirects the standard output ofecho 'Hello'
tohello.txt
. Note that the simple command> file.txt
will zero outfile.txt
.1>
is implicit if no descriptor is given.&>
redirects standard output and error (i.e., 1 & 2)
>>
: appender to file. E.g.,cat file1.txt >> file2.txt
: appends the contents offile1.txt
tofile2.txt
<
: redirector (right to left). E.g.,cat < file1.txt
redirects the standard input,file1.txt
to the commandcat
. The standard output is printed to the terminal.
Note, redirects to /dev/null
disappear, a place to get rid of output
or error.
- Star Wildcard (
*
) - Zero or more characters matched. For example:cp * /dir1
copies all files in the CWD to/dir1
cp m*.txt /dir1
copies all files in the CWD that start withm
to/dir1
- Question Mark Wildcard (
?
) - Matches exactly one character. For example:rm ???5
will remove all files in the current directly with 3 characters, followed by a5
. - Bracket Wildcard (
[]
) - Matches one or more characters specified within the brackets. For example:cp *.[jp]*
copies all files with extensions starting with j or p. The bracket wild card can handle ranges, such as[a-g]
. Very similar toRegEx
.
Expansions are Bash devices denoted with ~
or {
, and }
. They are
used to save keystrokes in Unix scripting.
The ~
expansion is commonly used to reference $HOME
. Other uses
include:
~-
: the prior directory
Used to fill in multiple parameters for Bash commands. For example
touch file_{1..1000}
creates 1000 files numbered from 1 to 1000. Cool right?
..
: Specifies a range. E.g.,echo {01..10..}
prints01 03 05 07 09
.;
: A command seperator that does not change if the first command has zero exit status.&&
: Run the second command only if the first command had non-zero exit status. E.g.,true && echo "Things went well"
printsThings went well
.||
: Run the second command only if the first command had zero exit status. E.g.,false || echo "Oops, fail"
printsOops, fail
.
Variables may be defined with the following syntax
a=Hello
b="Good Morning"
c=16
Note the required lack of space around the equal sign. Common built-in variables:
HOME
: user home directoryPWD
: current working directoryMACHTYPE
: machine type (handy for determining locations of files across platforms)HOSTNAME
: system nameBASH_VERSION
: Bash versionSECONDS
: number of seconds a Bash session has been running0
: name of the script?
: exit status of last command@
: argument array, usually used in a script for-loop. e.g.,for f in $@
#
: number of arguments passed, used in a script like"There were $# arguments."
With the declare
command, some useful attributes may be added to
variables:
-i
: variable is an integer. E.g.,declare -i d=123
-r
: variable is an read-only. E.g.,declare -r e=456
-l
: variable is lowercase. E.g,declare -l f=LOLCatz
#lolcatz-u
: variable is uppercase.
Command substitution executes a command and returns the standard output. It allows the result of commands to be saved as variables. The basic syntax is:
x=$(cmd) # backticks also work: `cmd`
Where cmd
is a Bash command.
Integer arithmetic may be performed in bash with $((arithmetic))
. For
example:
x=$((1+2))
echo x
Prints 3 to the console. Bash supports 6 standard arithmetic operations:
exponentiation - **
, multiplication - *
, division - /
, modulo -
%
, addition - +
and subtraction - -
. Also, variable arithmetic
supports increment and decrement operators, ++
and --
. For example:
$((x++))
echo x #prints 4
Additionally, plus-equals operators are supported:
+=
: add right integer to left variable and save variable, e.g.,((e+=5))
-=
: subtract right integer from left variable and save variable*=
: multiply right integer into left variable and save variable/=
: divide right integer into left variable and save variable
For floating point arithmetic, check out the bc
tool
- Concatenation - done simply by combining string variables. If
there is spaces in the new string,
""
are required.
a="hello"
b="world"
c="$a $b"
- Length (
#
) - calculate the length of a string. For exampleecho ${#a}
prints5
. - Replacement - replace the first matching
pattern
with areplacement
string using the following notation:${string_var/pattern/replacement}
wherestring_var
is a pre-defined string variable. There are some options to place beforepattern
://
: double slash before thepattern
replaces all strings matching thepattern
, rather than the first instance.#
: replacespattern
only if it is the start of the string%
: replacespattern
only if it is the end of the string*
: matching wildcard
- Substrings (
:
) - returns a substring to standard output. The first (and required) integer argument specifies the starting position. A second:
and integer the number of characters past the start to return. For example:
d=${c:3:4}
echo $d
returns lowo
. Further, negative numbers specify starting character
from the back of the string. For example :
e=${c: -4:3}
echo $e
returns orl
(Note: the required space between :
and -
).
Arrays are denoted with parentheses as follows:
a=("apple" "banana" "orange")
. Note the lack of commas in between
elements. Elements may be accessed with zero-based index notation such
as ${a[2]}
returns orange
. Note the use of {
and }
.
+=
: Add an element to the end of an array. For example,a+="mango"
@
: Access all elements of an array. For example,echo ${a[@]}
prints all element of the thea
array. Without this option, only the first element is printed.- Subset arrays with
... ${a[@]:s:e}
, wheres
ande
are integers denoting staring and ending points.e
may be omitted and the subset include all the remaining elements. -1
: Access elements in backwards order, similar to string manipulation in Bash. For example,echo ${a[@]: -1}
printsmango
(note required space between:
and-
).
In Bash 4+, key-value elements may be added to arrays. For example:
declare -A myarray
myarray[color]=blue
myarray["office building"]="HQ West"
echo ${myarray["office building"]} is ${myarray[color]}
- Ctrl+
a
: start of line - Ctrl+
e
: end of line - Ctrl+Left-Arrow - Move backward a word (or Meta +
b
) - Ctrl+Right-Arrow - Move forward a word (or Meta +
f
) - Ctrl+
u
: deletes from the cursor to the beginning of the line - Ctrl+
k
: deletes from the cursor to the end of the line - Ctrl+
w
: deletes from the cursor to the beginning of the start of the last word. - Ctrl+Shift+
c
: copy to clipboard (note addition of ‘Shift’)
The textual representation of file permission is 10 digits long, as my
be seen with ls -l
command and may look like
-rwxr--r--
0123456789
- Symbols in position
0
are the file type.d
indicates directory,l
for link and-
for general file.
The following 9 positions contain three permission types per user type:
r
for readable, w
for writable and x
for executable, in that
order. -
indicates the user does not have this permission type.
- Symbols in position
1
to3
(rwx
) are permissions for the owner of the file. - Symbols in position
4
to6
(r--
) are permissions for the group that the owner belongs to. - Symbols in position
7
to9
(r--
) are permissions for others.
head
: view the first few lines of a filetail
: view the last few lines of a file
There are at least two methods for viewing file contents, other than the
simple cat
command: more
and less
Displays as much of files contents in the open terminal window, then
holds for user input. space
pages down but there is no ‘page-up’
command other than scrolling back in the terminal window.
Instead use…
Displays a files contents on the screen until no more space remains. It
has the extended capability of forward and backward navigations,
unlike more
. The following are shortcut commands for the terminal
viewer less
. Notably, manual pages are viewed with less
.
f
: forwardb
: backq
: quith
: help
A commandline text editor (that I happen to never use in favor of
vim
). nano 'file.txt'
: opens file.txt
for editing
A command-line text editor with more traditional features than nano
.
It has two modes: insert and command modes.
a
: enter Insert Mode once character over from cursoro
: enter Insert Mode in new line below cursor.i
: enter Insert Modeshift + i
: insert at the beginning of the lineEsc
: exit insert mode
Shift + Right
: move right one wordShift + Left
: move left one wordShift + g
: move cursor to bottom of filegg
: move cursor to the top of the filej
: Jump forward one line.k
: Jump backward one line.0/^
: move to the beginning of the line$
: move to the end of the linen
: next match in search(
: back one sentence (requiresshift
))
: forward one sentence (requiresshift
)/
: search
p
: paste after cursorP
: paste before cursorCtrl-R
: redou
: undov
: select multiple charactersx
,X
: delete character under, before cursory
: copy (‘yank’) selected characters
d
: cut/delete characterdd
: cut/delete rowdW
: delete word
set number
: display line numberssyntax on
/off
: turn on/off syntax highlighting
Writing and commands require :
and may be strung together (much like
Unix command options).
:w
: write. An optionalfilename
may be included to save as a new file.:q
: quit, add!
to force quit without saving.
The user may access ~/.bash_profile
or ~/.bash_rc
files to make
unique adaptations to their bash profile.
- Aliases - set alias commands for other commonly used commands
- e.g.,
alias pd='pwd'
- e.g.,
export USER='Kirkwood Paul Donavin'
- e.g.,
$PATH
: lists directories that the command line may use for scripts
All environmental variables may be displayed with env
or individually
with echo $VARIABLE_NAME
.
PS1
: Prompt String One, controls the prompt in the terminal the displays each line before commands.USER
: The user who is logged in
Bash scripts begin with a Shebang line (AKA Hashbang), this line followed by the type tells the how to interpret the file. For example,
# ! /bin/bash
Tells the shell this script may be interpreted with bin/bash
. Or, for
a python script.
# ! /usr/bin/env python
Tells a Unix based system that this is a python file.
Keywords that control flow and iterate
Bash compares values with the test
command (or between double
comparison brackets, [[ EXPRESSION ]]
). It is important to keep spaces
between the double brackets and the EXPRESSION
. These set the $?
env
variable to 0
if the comparison inside the brackets is true, and set
it to 1
otherwise. The syntax is as follows:
VAR_A=1
VAR_B=3
[[ $VAR_A == $VAR_B ]]
echo $? #0 - note that $? is the 'most recent exit status of the foreground pipeline' ... whatever the means.
The following operators may be used to compare any 2 values:
<
: less than, e.g.,[[ 'a' < 'b' ]]
returns0
for true>
: greater than<=
: greater than or equal to>=
: less than or equal to==
(or=
) - equal to!=
: not equal to
Here is an example of a string test:
STR_A='hello world'
STR_B='Hello World'
test $STR_A = $STR_B && echo “true” || echo “false”
There are a few additional operators that may be used to compare strings or evaluate
=~
: contains a regular expression pattern. For example,[[ 'My 1st String' =~ [0-9]+ ]]
returns0
for true- Standard ‘double’ logical operators include
&&
,||
and!
as in[[ ! $a ]] && echo 'true' || echo 'false'
. This willecho
'true'
if$a
does not exist. -z
: Test for null value-n
: Non-null value
a=""
b="cat"
[[ -z $a && -n $b ]]; echo $? #prints 0
If the user compares integers with the string comparators, they do not behave as one would expect because they are treated as strings. Instead, integer values may be compared with the following values:
[[ $a -lt ]]
:a
less thanb
[[ $a -gt $b ]]
:a
greater thanb
[[ $a -le $b ]]
:a
less than or equal tob
[[ $a -ge $b ]]
:a
greater than or equal tob
[[ $a -eq $b ]]
:a
equal tob
[[ $a -ne $b ]]
:a
not equal tob
Alternatively, the user may use double parenthesis and the usual
comparators. For example ((5<6))
returns 0
for true.
These are analogous to those in other languages and may follow 1 of 4 following syntaxes
if expression
: basic syntaxif [ expression ]
: test brackets (note spaces)if [[ expression ]]
: extended (new) test brackets (note spaces)if ((expression))
: integer comparison (may use standard comparators==
,<=
, etc.)
An if
-statement may take the following syntax
if expression; then #may also place on next line without ';'
echo 'True'
elif expression2; then
echo 'ex is False, e2 is True'
else
echo 'Nothing'
fi
while
loops run while a condition is true. until
loops run until a
condition is true. For instance:
i=0
while [ $i -le 10 ]; do
echo i:$i
((i+=1))
done
prints the numbers 0 through 10, while:
j=0
until [ $j -ge 10 ]; do
echo j:$j
((j+=1))
done
stops at 9. Note that either of these loops can create an infinite loop, so the user should be careful with their logic.
For loops iterate over a list of things. The list may be specified by
hand such as for i in 1 2 3
, or with brace expansion such as:
for i in {1..100..2}; do
echo i:$i
done
The syntax is very similar to while
and until
loops. An alternative
syntax is such as the following:
for (( i=1; i<=10; i++ ))
do
echo $i
done
similar to C-style syntax. We may also loop through an array.
arr=("apple" "banana" "cherry")
for i in ${arr[@]}; do #uses parameter expansion
echo $i
done
It is also possible to loop through an associative array (Bash 4+).
declare -A arr #declare associated array 'arr'
arr[name]="Kirkwood"
arr[id]=1234
for i in "${!arr[@]}"; do
echo "$i: ${arr[$i]}" #quotes used to handle spaces in key and value strings.
done
Finally, for
loops may be used with command substitution. For example,
for i in $(ls); do
echo "$i"
done
Case statements may be used to select behavior between a finite number of options. For example,
a="dog"
case $a in
cat) echo "Feline";;
dog|puppy) echo "Canine";;
*) echo "No Match!";; #catch for no match
esac
Custom script functions may be created in Bash. For example,
function greet {
echo "Hi, $1! What a nice $2."
}
$1
, $2
, … are use to access parameter arguments, up to $9
, then
use ${10}
etc. Alternatively, an arbitrary amount of arguments may be
represented with $@
. For example
function NumberThings {
i=1
for f in $@; do #for all the input argument
echo $i: $f
((i+=1))
done
}
numberthings $(ls)
numberthings pine birch maple
$1, $2, ...
: Numbered function arguments$*
: All function arguments
Text may be colored with escaped ANSI characters. For example,
echo -e '\033[34;42mColor Text\033[0m'
produces blue text (‘Color
Text’) with a green background. \033[
and m
indicate the beginning
and end of the ANSI escape sequence. Numbers represent styles or colors,
separated by ;
. Here is a table of ANSI values for text color:
And for style:
styled textAnother option for formatting that is more verbose, but less horrible to
read is tput
. Must use command substitution for tput
commands. For
example, $(tput blink)
turns on blink. Here are a list of options:
With colors:
styled textMore commands for tput
may be found in the man
pages for terminfo
.
Bash allows the input of multiple commands into a single standard input. It only requires the use of a limit string to indicate the beginning and end of the argument. For example.
COMMAND <<InputComesFromHERE
...
...
...
InputComesFromHERE
With Great Power Comes Great Responsibility
Super users have root administrative privileges meaning they can perform
any action on the computer. It is bad practice to log in to the root
super user account for regular functions (i.e., su root
). Use
sudo -k
to exit super user privileges.
Unlike other languages, Bash interprets different types of quotes in different ways.
- no quotes, in which Bash interprets non-escaped special characters and variables
greeting="hello"
echo $greeting, world \(planet\)
# hello, world (planet)
- strong (single) quotes where nothing is interpreted within the single quote.
echo '$greeting, world \(planet\)'
# $greeting, world \(planet\)
- weak (double) quotes, where variables are interpreted, special characters are not.
echo "$greeting, world (planet)"
# hello, world
- back ticks, execute and replace the output of the command with the
result (AKA command substitution). For example,
cd `pbpaste`
changes directory to that which is stored on the clipboard and accessed with thepbpaste
command.
~
used in a directory represents the user’s home directory- e.g.,
~/.bash_profile
- e.g.,
.
before a filename indicates a hidden file.- e.g.,
.bash_profile
- e.g.,
cat /etc/*-release
on a Linux machine prints out distribution information- Red Hat, Fedora and CentOS use
dnf
package manager
The material in this guide and my understanding of Bash scripting owes much to Scott Simpson’s Learning Bash Scripting course on Lynda.com.