101 exam - terms Flashcards
Other shells
Bash (Boutne again shell)
Dash (Debian Almquist shell, smaller without comman-line editing or command history, faster script execution)
KornShell (compatible with bash, supports advanced programming features)
tcsh (TENEX C shell - upgraded version of C shell, incorporates elements from the C languages into shell scripts)
Z shell (incorporates features from bash, tcsh, KornShell, adv. prog. features, and many others)
Metacharacter $
Indicates a variable, with echo command it tries to retrieve the value and display it.
Shell quoting
Shell quoting allows you to use metacharacters as regular characters. \ for single metacharacter or ‘ and “ for multiple metacharacters
How to tell it’s internal (to the sell) or external command
type -command-
ex:
$ type pwd
pwd is a shell builtin
$ type uname
uname is /usr/bin/uname
Environment variables
Environment variables track specific system information, such as the name of the user
logged into the shell, the default home directory for the user, the search path the shell uses to find executable programs, and so on.
Executing a program outside the PATH directories
provide the absolute path
ex:
$ /home/Christine/Hello.sh
Hello World
which utility
It searches through the PATH directories to
find the program. If it locates the program, it displays its absolute directory reference.
$ which Hello.sh
/usr/bin/which: no Hello.sh in (/usr/local/bin:/usr/bin:
/usr/local/sbin:/usr/sbin:/home/Christine/.local/bin:/home/Christine/bin)
changing the environment variable
enter the variable’s name, followed by an equal sign (=), and then type the new value (this setting will not survive entering into a subshell)
ex. of changing PS1 (shell promt):
$ PS1=”My new prompt: “
My new prompt:
To preserve an environment variable’s setting
export -variable name-
Using the grep command and a digit character class
grep [[:digit:]] random.txt
Matches any uppercase alphabetic characters, and is equal to using the [A-Z] bracket expression
[:upper:]
Redirect STDIN from specified file into command.
Redirect STDOUT and STDERR to specified file. If file exists, overwrite it. If it does not exist, create it.
&>
Redirect STDIN from specified file into command and redirect STDOUT to specified file.
<>
Redirect STDOUT to specified file. If file exists, overwrite it. If it does not exist, create it.
>