Test 2 Flashcards
Explain what a file descriptor does in Linux?
File descriptors are data channels, they read input for the keyboard standard input(channel 0), send normal output to the terminal standard output(channel 1), and sends error messages to the terminal standard error (channel 2)
Stdin
standard input, from a keyboard
Stdout
standard output whatever processes
Redirection
output and error cant be captured as file contents, sent to a device, or discarded
Pipeline
a sequence of one or more commands separated by |
Stderr
standard error where all the errors go
Pipe
connects the standard output of the first command to the standard input of the next command
tee
pipe and redirect at the same time
> file
redirect stdout to overwrite a file
> > file
redirect stdout to append a file
> file 2> file2
redirect stdout to overwrite file2
2> /dev/null
discard stderr error messages by redirecting to /dev/null
&> file
redirect stdout and stderr to overwrite the same file
&» file
redirect stdout and stderr to append to the same file
What is vim?
Improved version of the vi editor, vim is highly configurable and efficient for practiced users
Define the three modes of vim?
Edit, command, visual edit
What is the default mode in vim?
Command mode
What is the keystroke to enter insert mode?
i
What is the keystroke to go from insert mode to command mode?
esc
What is the keystroke to enter visual mode for a block of text?
v
What is the keystroke to save your files and exit vim?
wq
Define and compare what a shell variable is versus an environment variable
Shell variables run commands or to modify behavior of the shell. Environment variables automatically copy to programs run from that shell when they start.
How do you expand a bash shell variable?
Use the following syntax variableName=value
Define these files, directories, variables, and commands?
a. PS1 changes the appearance of your shell prompt
b. EDITOR displays what editor is used
c. HOME users home directory
d. LANG default language, dates, currency, and character set
e. PATH contains a list of colon-separated directories that contain programs
f. env list all the environment variables for a particular shell
g. set changes something in a file
h. export changes the default in the shell
i. unset unsets something that was already set
j. unexport changes the shell back to default
k. .bashrc changes your user account that affects all interactive shell prompts at startup
l. /etc/profile.d changes the profile of the d user