Linux Flashcards

1
Q

what does $pwd do

A

print working directory

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

what does $hostname do

A

my computer’s network name

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

what does $mkdir do?

A

make directory

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

what does $cd foo/ do

A

change directory to foo

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

what does $rmdir foo do

A

remove directory foo

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

what does $pushd do

A

push directory

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

what does $popd do

A

pop directory

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

what does $cp do?

A

copy file or directory

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

xargs

A

execute arguments

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

find

A

find files

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

grep

A

find things inside files

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

man

A

read a manual page

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

apropos

A

find what man page is appropriate

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

env

A

look at your environment

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

echo

A

print some arguments

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

export

A

export/set a new environment variable

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

what does $exit do?

A

exit the shell

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

sudo

A

DANGER! become super user root

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

What does Bash stand for?

A

Born again shell

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

what does $ls -a do?

A

list all files in the directory including hidden files.

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

what does $ls -l do?

A

list all files in the directory with detailed information

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

what does $ls -R do?

A

list all files recursively in directory and sub-directories

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

what does $ls -r do?

A

lists all files in the directory in reverse order

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

what does $ls -t do?

A

lists files by modification time

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

what does $touch foo do?

A

creates a new file foo

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

what does $file foo.bar do?

A

tells what type of file foo is

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

what does $cat foo.bar do

A

displays the contents of foo

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

what does $less foo.bar do?

A

allows navigation through file foo

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

what does $history do?

A

displays a history of commands

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

what does $clear do

A

clears the terminal

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

what does $cp foo.bar /new do?

A

copies foo.bar to directory new

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

what does $cp *.jpg Pictures/ do?

A

copies all files with the extension .jpg to the Pictures directory

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

what does $cp -r Pictures/ Downloads do?

A

copies all files from Pictures to Downloads overwrites any matching files

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

what does $cp -i foo.bar Documents/ do?

A

copies foo.bar to Documents directory but prompts before overwriting a similar file

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

what does $mv oldfile newfile do?

A

renames oldfile as newfile

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

what does $mv oldfile Stuff/ do?

A

moves oldfile to directory Stuff

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

what does $mv Things/ Stuff/ do?

A

renames Things to Stuff

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

what does $mkdir books paintings do?

A

makes a books directory and a paintings directory

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

what does $mkdir music/rock/punk/ do?

A

makes a directory music with a sub-directory rock which has a sub-directory punk

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

what does $rm file1 do?

A

permanently deletes file1

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

what does $rm -f file1 do?

A

force deletes file1 even if it is protected

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

what does $rm -r stuff/ do?

A

deletes the directory stuff and all of its files

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

what does rmdir stuff/ do?

A

removes the directory stuff only if it is empty

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

what does $find things/ file1 do?

A

finds a file named file1 in the things directory

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

what does $find -type d do?

A

finds all directories and sub directories

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

what does $help echo do?

A

displays a description and options for the echo command

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

what does $foo –help do?

A

displays a description and options for the executable foo

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

what does $man ls do?

A

displays a detailed manual for the ls command

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

what does $whatis ls do?

A

displays a brief description of the ls command

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

what does alias foobar=’ls -a’ do?

A

creates an alias that allows the commands ‘ls -la’ to be run by typing foobar

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

what does unalias foobar do?

A

removes the alias foobar

52
Q

what does echo Hello World > peanuts.txt do?

A

overwrites any existing peanuts.txt with Hello World

53
Q

what does echo Hello World&raquo_space; peanuts.txt do?

A

appends Hello World to the contents of peanuts.txt

54
Q

what does $ls /fake/directory 2> peanuts.txt do?

A

redirects the error message to peanuts.txt

55
Q

in bash what is the re-director for stdout

A

>

56
Q

in bash what is the redirect for stdin

A

<

57
Q

in bash what is the redirect for stderr

A

2>

58
Q

in bash what key represents the pipe operator

A

|

59
Q

what does $ls -la /etc | less do?

A

pipes the command to less

60
Q

what does $ ls | tee peanuts.txt do?

A

outputs ls to console and writes it to peanuts.txt

61
Q

what does $ env do?

A

displays your environment variables

62
Q

what does $ cut -c 5 sample.txt do?

A

outputs the 5th character of sample.txt

63
Q

what does cut -f 1 -d “;” sample.text do?

A

prints the text before the first semi-colon in sample.txt

64
Q

what does $ head foo do?

A

shows the first 10 lines of foo

65
Q

what does $ head -n 15 foo do?

A

shows the first 15 lines of foo

66
Q

what does $tail foo do?

A

displays the last 10 lines of foo

67
Q

what does $ tail -f foo do?

A

follows the last line of foo as it grows

68
Q

what does $ expand foo do?

A

prints the output of foo with each tab converted into a number of spaces

69
Q

what does $ join foo bar do?

A

joins an order list from foo with an ordered list from bar

70
Q

what does $split foo do?

A

splits foo into separate 1000 line files

71
Q

what does $ sort foo do?

A

sorts the contents of foo (i.e. alphabetical order)

72
Q

what does $ tr a-z A-Z do?

A

translates input to all caps

73
Q

what does $ wc foo do?

A

gets the word count of foo

74
Q

wat does $ nl foo do?

A

gets the line count for foo

75
Q

what does $grep foo bar.txt do?

A

finds instances of foo in bar

76
Q

what does $sudo foo do?

A

performs task foo with root privilages

77
Q

what does $ visudo do?

A

allows you to see and edit super users in the /etc/sudoers file

78
Q

what does $ chmod user2 +x myfile do?

A

adds executable permission for user2 to myfile.

79
Q

what does $ chmod user2 -w myflie do?

A

removes write permissions for user2 from myfile

80
Q

what does $ chmod user1user2 +r myfile do?

A

adds read permission for user1 and user2 to myfile

81
Q

what does $ sudo chown patty myfile do?

A

changes the owner of myfile to patty

82
Q

what does $ sudo chgrp whales myfile do?

A

changes group ownership of myfile to whales

83
Q

what does $ sudo chown patty:whales myfile do?

A

changes the ownership of myfile to patty and to the whales group

84
Q

what does $ umask do?

A

changes default permissions

85
Q

what does $ ps do?

A

shows a a quick snapshot of the current processes.

86
Q

what does $ ps a do?

A

lists all processes including those being run by other users

87
Q

what does $ ps u do?

A

show more detail about processes

88
Q

what does $ ps x do?

A

shows all process that don’t have a TTY associated with them?

89
Q

what does $ top do?

A

gives real time information about the processes being run

90
Q

what does tty2 in the TTY field mean

A

process controlled by second terminal device

91
Q

what does pts/* in the TTY field mean

A

process controlled by a pseudo terminal device

92
Q

what does ? in TTY field mean

A

process has no controlling device

93
Q

after the _exit system call what is the termination status for success

A

0

94
Q

what is the master process called

A

init

95
Q

when is an orphan process created

A

when a parent process dies before a child process

96
Q

when is a zombie process created

A

when a child process terminates and the parent process hasn’t called wait

97
Q

what is SIGHUP?

A

hangup, sent to a process when the controlling terminal is closed

98
Q

what is SIGINT

A

an interrupt signal sent when Ctrl-C is used to kill a process

99
Q

what is SIGTERM

A

signal to kill a process but allow it to do clean up first

100
Q

what is SIGKILL

A

signal to kill a process with no cleanup

101
Q

what is SIGSTOP?

A

signal to stop/suspend a process

102
Q

what is the default signal to kill a process?

A

SIGTERM

103
Q

how does a niceness number affect a process

A

a lower number gives the process a higher CPU priority

104
Q

what does $ nice -n 5 apt upgrade do?

A

sets the niceness of apt upgrade to 5

105
Q

What dos process STAT R mean

A

running or runable

106
Q

What does process STAT S mean

A

Interruptible sleep

107
Q

What does process STAT D mean

A

Uninterruptible sleep

108
Q

What does process STAT Z mean

A

Zombie

109
Q

What does process STAT T mean

A

suspended/stopped

110
Q

where in the file system are processes stored?

A

/proc

111
Q

what does $ sleep 1000 & do?

A

sends process 1000 to run as a background job

112
Q

what does $ jobs do?

A

lists the background jobs

113
Q

what does $ fg %1 do?

A

returns background job 1 to the foreground

114
Q

what does kill %1 do?

A

kills background job 1

115
Q

what does $ gzip myfile do?

A

compresses myfile

116
Q

what does $ gunzip myfile.gz do?

A

unzips myfile.gz

117
Q

what does $ tar cvf mytarfile.tar file1 file2 do?

A

creates an archive containing file1 and file2

118
Q

what does tar xvf mytarfile.tar do?

A

unpacks mytarfile

119
Q

what does $ tar czf myfile.tar.gz do?

A

creates a compressed tar file

120
Q

what does $ tar xzf file.tar do?

A

unpacks and extracts the contents of the tar file

121
Q

what does $ dpkg -i foo.deb do?

A

installs foo.deb package

122
Q

what does rpm -i foo.rpm do?

A

installs the foo.rpm package

123
Q

what does $ dpkg -r foo.deb do?

A

removes foo.deb package

124
Q

what does $ rpm -e foo.rpm do?

A

removes the foo.rpm package

125
Q
A