Shared Flashcard Set

Details

rhel 5 training guide ch 05
The Shells
85
Computer Science
Professional
04/13/2010

Additional Computer Science Flashcards

 


 

Cards

Term
in the shell what are the two types of variables
Definition
local and environment(AKA global)
Term
In the shell, what type of variable can't be passed to a sub-shell
Definition
local variables are limited to the current shell
Term
In the shell, what type of variable can't be passed to a sub-shell
Definition
local variables are limited to the current shell
Term
what is a global variable
Definition
an environment variable, can be passed from the current process or shell to a child process or shell
Term
set a global variable V1 to "college"
Definition
export V1=college
or
V1=college; export V1
Term
echo the variable V1
Definition
echo $V1
Term
unset the V1 variable
Definition
unset V1
Term
set the variable
Definition
Term
set a local variable V1 to college
Definition
V1=college
Term
set V2 global variable to "a lovely bunch of coconuts"
Definition
export V2="a lovely bunch of coconuts"
or
V2="a lovely bunch of coconuts"; export V2
Term
set local variable V2 to "gabba gabba"
Definition
V2="gabba gabba"
Term
variable V2 was set, undo this
Definition
unset V2
Term
set environment variable V2 to "hey hey"
Definition
export V2="hey hey"
or
V2="hey hey"; export V2
Term
pre-defined environment variable
Definition
defined by the shell at login
Term
pre-defined environment variable DISPLAY
Definition
stores the hostname or IP address to display graphics
Term
pre-defined environment variable HISTFILE
Definition
where the command history is saved
Term
pre-defined environment variable HISTSIZE
Definition
defines the maximum size of the histfile
Term
pre-defined environment variable HOME
Definition
home dir path
Term
pre-defined environment variable LOGNAME
Definition
stores the login name
Term
pre-defined environment variable MAIL
Definition
mail directory path, ex: /var/spool/mail/user1
Term
pre-defined environment variable PATH
Definition
the command paths, shown separated by colons
Term
pre-defined environment variable PS1
Definition
primary command prompt - default for root is #
Term
pre-defined environment variable PS2
Definition
secondary command prompt - default is >
Term
pre-defined environment variable PWD
Definition
stores the current directory location
Term
pre-defined environment variable SHELL
Definition
holds the absolute path of the primary shell
Term
pre-defined environment variable TERM
Definition
hold the terminal type value
Term
why should variables be in upper case
Definition
so they don't conflict with commands
Term
change the primary command prompt be the current directory
Definition
export PS1="<$PWD>" - test this
Term
set PS1 to include logname, hostname, and PWD
Definition
export PS1="<$LOGNAME@$HOSTNAME:\$PWD>"
Term
What is the symbol for stdin?
What is the digit for stdin?
Definition
<
0
Term
what is the symbol for stdout?
and digit for stdout?
Definition
>
1
Term
standard out, what is the file descriptor, symbol, and digit?
Definition
stdout, >, 1
Term
standard in, what is the file descriptor, symbol, and digit?
Definition
stdin, <, 0
Term
standard error, what is the file descriptor, symbol, and digit?
Definition
stderr, >, 2
Term
what is the symbol and digit of stdout?
Definition
>, 1
Term
what is the symbol for stderr?
and digit for stderr?
Definition
>, 2
Term
use input redirection to send file1 to user2 using mailx
Definition
mailx user2
Term
sort file1 and send it to sort.out
Definition
sort file1 > sort.out
Term
sort file1 and append it to sort.out
Definition
sort file1>>sort.out
Term
ls /etc and /cdr redirect output to file1 but don't show the error for the made-up /cdr directory
Definition
ls /etc /cdr 1>file1 2>&1
or
ls /etc /cdr &>file1
Term
you hit up-arrow and want to take that to vi. What do you have to do first. And how is it done
Definition
set -o vi
up-arrow, to the command esc, then v takes it into vi
Term
display the last 20 commands you entered
Definition
history 20
Term
re-execute a command by line number 17
Definition
!17
Term
reenter the last command that started with a ch , two answers
Definition
!ch
!?ch
Term
repeat the last command, two answers
Definition
!!
!$
Term
alias
Definition
create shortcuts for lengthy commands
Term
make is so that when you enter cp it really runs cp -i
Definition
alias cp='cp -i'
Term
what command to unset an alias
Definition
unalias
Term
show all the current aliases
Definition
alias
Term
make it so that every time you run rm it prompts you before removing a file
Definition
alias rm='rm -i'
Term
what is tilde in: cd ~
Definition
use ~ for $HOME, the current user's home directory
Term
echo ~+ , what do you get
Definition
$PWD, the current directory
Term
echo ~- , what do you get
Definition
the previous directory
Term
echo ~user2 , what do you get
Definition
the home directory of user2
Term
display the previous directory
Definition
echo ~-
Term
display the home directory of user2
Definition
echo ~user2
Term
display the current directory using the tilde
Definition
echo ~+
Term
list files file1, file2, file3, and file4 in one command, don't list fileindex.txt
Definition
ls file?
Term
ls [af]* , what does this mean
Definition
list files that start with a or f
Term
list files that start with a through f
Definition
ls [a-f]*
Term
put multiple commands on the same line, how
Definition
put a semicolon in between
;
Term
cd to your home directory and show the contents, put the commands on one line
Definition
cd ; ls
Term
what does echo \\ show
Definition
\
Term
what does rm \* do
Definition
removes the file *
Term
remove a file named *
three answers
Definition
rm \*
rm '*'
rm "*"
Term
echo $$
Definition
echo '$$'
echo \$$
Term
what is the difference between echo '$HOME' and echo "$HOME"
Definition
echo '$HOME' displays $HOME
echo "$HOME" displays /home/username
Term
what three characters will not lose special meaning if put in double quotes
Definition
', $, \
Term
split the output of "ll /etc" to number the lines on the screen, and put that in /tmp/ll.out
Definition
ll /etc | nl | tee /tmp/ll.out
Term
tee filter
Definition
puts the output in more than one destination
Term
common use of tee
Definition
| tee file.out
pipe the output to a file and also to the screen
Term
cut filter
Definition
used to extract columns from a file
Term
cut /etc/group use : as the delimiter, show fields 1 and 4
Definition
cut -d: -f1,4 /etc/group
Term
show columns 1 and 5 from /etc/passwd
Definition
cut -d: -f1,5 /etc/passwd
Term
pr
Definition
pr filter, prints a file, formats and displays text file output.
Term
print starting at page two /etc/group
Definition
pr +2 /etc/group
Term
print /etc/group and /etc/passwd side by side in separate columns
Definition
pr -m /etc/group /etc/passwd
Term
print /etc/group add line numbers
Definition
pr -n /etc/group
Term
print /etc/group with the header "my file"
Definition
pr -h "my file" /etc/group
Term
print /etc/passwd in two columns with double line spacing
Definition
pr -2d /etc/passwd
Term
run what, but display everything in uppercase
Definition
w | tr '[a-z]' '[A-Z]'
Term
run what, but leave one space removing the extra spaces
Definition
w | tr -s " "
Term
tr
Definition
tr filter, translate, sqeeze, or delete characters from standard input
Term
show /etc/passwd but don't display any numbers
Definition
cat /etc/passwd | tr -d '[0-9]'
Term
tr, squeeze all the extra spaces out the the w output
Definition
w | tr -s " "
Supporting users have an ad free experience!