Bash Flashcards
Shell
A (possibly interactive) command interpreter, acting as a layer between the user and the system.
Bash
The Bourne Again Shell, a Bourne compatible shell. It’s important to understand that BASH is only an interface for you to execute statements (using BASH syntax), either at the interactive BASH prompt or via BASH scripts.
interactive mode
A mode of operation where a prompt asks you for one command at a time.
non-interactive mode
execute scripts (list of commands) that are stored in a file. When a script is executed, all these commands are (generally) executed sequentially, one after another.
$ man
stands for “manual”. it opens documentation (so-called “man pages”) on various topics. You use it by running the command man [topic] at the BASH prompt, where [topic] is the name of the “page” you wish to read.
$ man bash
if you’re looking for information on BASH built-ins (commands provided by BASH, not by external applications) you should look in man bash instead. BASH’s manual is extensive and detailed.
$ help
Bash also offers a help command which contains brief summaries of its built-in commands
Bash commands
BASH reads commands from its input (which is usually either a terminal or a file). Each line of input that it reads is treated as a command — an instruction to be carried out.
$ ls
# List files in the current directory (no output, no files). Command ls prints out the names of the files in the current directory.
$ touch a b c
Create files ‘a’, ‘b’, and ‘c’.
$ mkdir test
makes an empty directory called test
$ cd test
enter the test directory
#
character at the start of a word indicates a comment. Any words following the comment are ignored by the shell, meant only for reading.
touch
an application that changes the Last Modified time of a file. If the filename that it is given does not exist yet, it creates a file of that name as a new and empty file.
$ rm *
Remove all files in the current directory. rm is an application that removes all the files that it was given. * is a glob. It basically means all and in this case means all files in the current directory. Takes filenames as arguments (if our filenames have spaces and we do not quote them, Bash thinks each word is a separate argument)