Topic3: GNU and Unix Commands Flashcards

1
Q

South Columbus

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

1: Master Bathroom Toilet

effect of the egrep command when using the -v option

A

outputs non-matching lines

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

2 : Master Bathroom Bath

with FHS what directory are man pages found

A

/usr/share/man

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

3: Master Bath Round Mirror 1

file in user home directory used to store Bash history

A

.bash_history

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

HISTFILE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

5: Master Bath Round Mirror 2

user accidentally created subdirectory \dir in his home directory. Which of the following commands will remove the directory?

A

rmdir ~/\dir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

6: Master Bath Sink 2

signal sent to a process when the key combination CTRL+C is pressed on the keyboard

A

SIGINT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

by specifying the number right in front of a command such as 4l or 2yj.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

8: Master Bath Radiator

Which grep command will print only the lines that do not ed with a / in the file foo.

A

grep -v ‘/$’ foo

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

9: Master Bath Door

commands that can be used to determine how long the system has been running

A

uptime

top

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

«

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

11: Master Bedroom Closet

cmd will NOT update the modify timestamp on the file /tmp/myfile.txt

A

file /tmp/myfile.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

sed ‘s/bob/Bob/g’ letter > newsletter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

13: Master Bedroom Dresser

What does the + symbol mean in the following grep regular expression

grep ‘^d[aei]+d$’ /usr/share/dict/words

A

Match the preceeding character set ([aei]) one or more times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

14: Master Bedroom Dresser

vi editor which cmd will copy the current line into the vi buffer

A

yy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

15: Master Bedroom Master Bedroom Mirror

In Bash, inserting 1>&2 after a cmd redirects

A

standard output to standard error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

16: Master Bedroom Window (facing street)

what command can be used to create a USB storaage media from a disk image

A

dd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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

A

find /tmp -user root -print

find /tmp -user root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

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

A

file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

19: Crawl Space

default nice level when a process is started using the nice command

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

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

A

:e

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

21: Stairs

regarding nice -5 /usr/bin/prog what is the current nice level

A

5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
  1. Living Room Couch 1

cmd searches down a particular number of subdirectories

A

-maxdepth

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q
  1. Living Room Couch 2

max niceness level a regular user can assign to a process with the nice command when executing a new process

A

19

25
Q
  1. Stairs (Down)

vi editor save opened document and exits the editor

A

esc ZZ

esc :wq!

26
Q
  1. Bottom Floor Closet

what is true about cmd foo 1> bar

A

stdout from cmd foo overwrites file bar

27
Q

26: Bottom Floor Door

character added to end of a cmd runs that cmd in background as a child process of current shell

A

&

28
Q

27: Bottom Floor Futon

valid reason to run a command in the background of your shell

A

cmd has to be run immediately but the user needs to log out

29
Q
  1. Bottom Floor TV Hutch

purpose of bash built in export cmd

A

sets up env vars for apps

30
Q

29: Bottom Floor Window

cmd will print last 10 lines of a text file to standard output

A

tail -n 10 filename

31
Q

30: Bottom Floor Crib

commands is used to change options and positional parameters

A

set

32
Q

31: Bottom Floor Bathroom Window

diff between i and a cmds in vi

A

i (insert) inserts text BEFORE the current cursor position

a (append) inserts text AFTER the cursor

33
Q

32: Bottom Floor Bathroom Shower

cmd moves and resumes in background that last stopped shell job

A

bg

34
Q
  1. Bottom Floor Bathroom Toilet

for sed -e “s/a/b” /tmp/file > /tmp/file why is the /tmp/file empty afterwards

A

When the shell establishes the redirection it OVERWRITES the target file before the redirected cmd starts and opens it for reading

35
Q
  1. Bottom Floor Sink

when starting a program with nice cmd without any additional params which nice level is set for the resulting process

A

10

36
Q
  1. Bottom Floor Mirror

cmd prints a list of username (first column) and their primary group (fourth column) from the /etc/passwd file

A

cut -d : -f 1,4 /etc/passwd

37
Q
  1. Bathroom Door

cmd reduce all consecutive spaces down to a single space

A

tr -s ‘’< a.txt > b.txt

38
Q
  1. Bottom FLoor Walkin Closet

cmd displays list of all background tasks running in current shell

A

jobs

39
Q
  1. Stairs (up)

var defines the directories that Bash shell searches for executable cmds

A

PATH

40
Q
  1. 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

A

p (lowercase)

41
Q
  1. Living Room Closet 2

cmd will send output from the program myapp to both stdout and the file - file 1

A

myapp | tee file1.log

42
Q
  1. Living Room Closet 3

valid stream redirection operators with Bash

A

<

«<

>

43
Q
  1. Living Room Bathroom Mirror

when given cmd line echo “foo bar” | tee bar | cat. what output is created

A

foo bar

44
Q
  1. 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

A

HUP

SIGHUP

1

45
Q
  1. Living Room Bathroom Toilet

output of cmd.

echo “Hello World” | tr -d aieou

A

Hll Wrld

46
Q
  1. Living RoomBig Door Right Side

following commands display contents of gzip compressed tar archive

A

tar ztf archive.tgz

47
Q
  1. Living Room Big Door Left Side

shell directions will write standard output and standard error output to a file named filename

A

> filename 2>&1

48
Q
  1. Living Room Big Window 1

? symbol with regular expression

A

match preceeding qualifier zero or one times

49
Q
  1. Living Room Computer Desk

shell cmd used to continue background execution for a suspended cmd

A

bg

50
Q
  1. Living Room Big Window 2

cmd will generate a list of user names from /etc/passwd with login shell

A

cut -d: -f1,7 /etc/passwd

51
Q
  1. Living Room Radiator

default action of split cmd on input file

A

break the file into new files of 1,000 line pieces each

52
Q
  1. Kitchen Refriferator

cmd kils process with PID 123 but allows the process to “clean up” before exiting

A

kill -TERM 123

53
Q
  1. Kitchen Sink

/etc/_______ file lists currently mounted devices

A

mtab

54
Q
  1. Kitchen Table

cmd used in linux env to create new directoor

A

mkdir

55
Q
  1. 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

A

source /usr/local/bin/runme.sh

./usr/local/bin/runme.sh

56
Q
  1. Living Room Table

cmd sets bash var TEST with content FOO

A

TEST=”FOO”

57
Q
  1. Living Room Fire Place

what happens after issuing cmd vi without any additional params

A

vi starts in cmd mode and opens a new empty file

58
Q
  1. Living Room Painting

your trying to make a hard link to an ordinary file bit ln returns error - what would cause that?

A

The source and target are on different file systems