Topic3: GNU and Unix Commands Flashcards
South Columbus
1: Master Bathroom Toilet
effect of the egrep command when using the -v option
outputs non-matching lines
2 : Master Bathroom Bath
with FHS what directory are man pages found
/usr/share/man
3: Master Bath Round Mirror 1
file in user home directory used to store Bash history
.bash_history
4: Master Bath Sink 1
Bash env var defines in which file the user history is stored when the user history is stored when exiting a Bash process
HISTFILE
5: Master Bath Round Mirror 2
user accidentally created subdirectory \dir in his home directory. Which of the following commands will remove the directory?
rmdir ~/\dir
6: Master Bath Sink 2
signal sent to a process when the key combination CTRL+C is pressed on the keyboard
SIGINT
7: Master Bath Window
vi editor how can commands such as moving the cursor or copying lines into the buffer be issued multiple times or applied to multiple rows
by specifying the number right in front of a command such as 4l or 2yj.
8: Master Bath Radiator
Which grep command will print only the lines that do not ed with a / in the file foo.
grep -v ‘/$’ foo
9: Master Bath Door
commands that can be used to determine how long the system has been running
uptime
top
10: Landing outside Master Bath Door
which characters can be combined with a separator string in order to read from the current input source until the separator string, that is on a separate line and without and trailing spaces is reached
«
11: Master Bedroom Closet
cmd will NOT update the modify timestamp on the file /tmp/myfile.txt
file /tmp/myfile.txt
12: Master Bedroom Window
which commands replace each occurrence of ‘bob’ in the file letter with ‘Bob’ and writes the result to the file newsletter
sed ‘s/bob/Bob/g’ letter > newsletter
13: Master Bedroom Dresser
What does the + symbol mean in the following grep regular expression
grep ‘^d[aei]+d$’ /usr/share/dict/words
Match the preceeding character set ([aei]) one or more times
14: Master Bedroom Dresser
vi editor which cmd will copy the current line into the vi buffer
yy
15: Master Bedroom Master Bedroom Mirror
In Bash, inserting 1>&2 after a cmd redirects
standard output to standard error
16: Master Bedroom Window (facing street)
what command can be used to create a USB storaage media from a disk image
dd
17: Master Bedroom Computer Desk
which of the following commands prints all files and directories within the /tmp directory or its subdirectories that are also owned by the user root
find /tmp -user root -print
find /tmp -user root
18: Master Bedroom door
Command that determines the type of file by using a definition database file that contains information about all common file types
file
19: Crawl Space
default nice level when a process is started using the nice command
10
20: Washer Dryer
editing in vi and file changed due to another process. without exiting vi how can the file be reopened for editing with the new content
:e
21: Stairs
regarding nice -5 /usr/bin/prog what is the current nice level
5
- Living Room Couch 1
cmd searches down a particular number of subdirectories
-maxdepth
- Living Room Couch 2
max niceness level a regular user can assign to a process with the nice command when executing a new process
19
- Stairs (Down)
vi editor save opened document and exits the editor
esc ZZ
esc :wq!
- Bottom Floor Closet
what is true about cmd foo 1> bar
stdout from cmd foo overwrites file bar
26: Bottom Floor Door
character added to end of a cmd runs that cmd in background as a child process of current shell
&
27: Bottom Floor Futon
valid reason to run a command in the background of your shell
cmd has to be run immediately but the user needs to log out
- Bottom Floor TV Hutch
purpose of bash built in export cmd
sets up env vars for apps
29: Bottom Floor Window
cmd will print last 10 lines of a text file to standard output
tail -n 10 filename
30: Bottom Floor Crib
commands is used to change options and positional parameters
set
31: Bottom Floor Bathroom Window
diff between i and a cmds in vi
i (insert) inserts text BEFORE the current cursor position
a (append) inserts text AFTER the cursor
32: Bottom Floor Bathroom Shower
cmd moves and resumes in background that last stopped shell job
bg
- Bottom Floor Bathroom Toilet
for sed -e “s/a/b” /tmp/file > /tmp/file why is the /tmp/file empty afterwards
When the shell establishes the redirection it OVERWRITES the target file before the redirected cmd starts and opens it for reading
- Bottom Floor Sink
when starting a program with nice cmd without any additional params which nice level is set for the resulting process
10
- Bottom Floor Mirror
cmd prints a list of username (first column) and their primary group (fourth column) from the /etc/passwd file
cut -d : -f 1,4 /etc/passwd
- Bathroom Door
cmd reduce all consecutive spaces down to a single space
tr -s ‘’< a.txt > b.txt
- Bottom FLoor Walkin Closet
cmd displays list of all background tasks running in current shell
jobs
- Stairs (up)
var defines the directories that Bash shell searches for executable cmds
PATH
- Living Room Closet 1
immediately after deleted 3 lines of text in vi and moving cursor to diff line which single char cmd will insert deleted content below current line
p (lowercase)
- Living Room Closet 2
cmd will send output from the program myapp to both stdout and the file - file 1
myapp | tee file1.log
- Living Room Closet 3
valid stream redirection operators with Bash
<
«<
>
- Living Room Bathroom Mirror
when given cmd line echo “foo bar” | tee bar | cat. what output is created
foo bar
- Living Room Bathroom Sink
signal missing from following command that is commonly used to instruct a daemon to reinitialize itself including reading config files
killall -s ______ daemon
HUP
SIGHUP
1
- Living Room Bathroom Toilet
output of cmd.
echo “Hello World” | tr -d aieou
Hll Wrld
- Living RoomBig Door Right Side
following commands display contents of gzip compressed tar archive
tar ztf archive.tgz
- Living Room Big Door Left Side
shell directions will write standard output and standard error output to a file named filename
> filename 2>&1
- Living Room Big Window 1
? symbol with regular expression
match preceeding qualifier zero or one times
- Living Room Computer Desk
shell cmd used to continue background execution for a suspended cmd
bg
- Living Room Big Window 2
cmd will generate a list of user names from /etc/passwd with login shell
cut -d: -f1,7 /etc/passwd
- Living Room Radiator
default action of split cmd on input file
break the file into new files of 1,000 line pieces each
- Kitchen Refriferator
cmd kils process with PID 123 but allows the process to “clean up” before exiting
kill -TERM 123
- Kitchen Sink
/etc/_______ file lists currently mounted devices
mtab
- Kitchen Table
cmd used in linux env to create new directoor
mkdir
- Kitchen Chairs
from Bash shell which of the following cmds directly executes the instruction from the file /usr/local/bin/runme.sh without starting subshell
source /usr/local/bin/runme.sh
./usr/local/bin/runme.sh
- Living Room Table
cmd sets bash var TEST with content FOO
TEST=”FOO”
- Living Room Fire Place
what happens after issuing cmd vi without any additional params
vi starts in cmd mode and opens a new empty file
- Living Room Painting
your trying to make a hard link to an ordinary file bit ln returns error - what would cause that?
The source and target are on different file systems