Linux Flashcards

(125 cards)

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
what does $touch foo do?
creates a new file foo
26
what does $file foo.bar do?
tells what type of file foo is
27
what does $cat foo.bar do
displays the contents of foo
28
what does $less foo.bar do?
allows navigation through file foo
29
what does $history do?
displays a history of commands
30
what does $clear do
clears the terminal
31
what does $cp foo.bar /new do?
copies foo.bar to directory new
32
what does $cp *.jpg Pictures/ do?
copies all files with the extension .jpg to the Pictures directory
33
what does $cp -r Pictures/ Downloads do?
copies all files from Pictures to Downloads overwrites any matching files
34
what does $cp -i foo.bar Documents/ do?
copies foo.bar to Documents directory but prompts before overwriting a similar file
35
what does $mv oldfile newfile do?
renames oldfile as newfile
36
what does $mv oldfile Stuff/ do?
moves oldfile to directory Stuff
37
what does $mv Things/ Stuff/ do?
renames Things to Stuff
38
what does $mkdir books paintings do?
makes a books directory and a paintings directory
39
what does $mkdir music/rock/punk/ do?
makes a directory music with a sub-directory rock which has a sub-directory punk
40
what does $rm file1 do?
permanently deletes file1
41
what does $rm -f file1 do?
force deletes file1 even if it is protected
42
what does $rm -r stuff/ do?
deletes the directory stuff and all of its files
43
what does rmdir stuff/ do?
removes the directory stuff only if it is empty
44
what does $find things/ file1 do?
finds a file named file1 in the things directory
45
what does $find -type d do?
finds all directories and sub directories
46
what does $help echo do?
displays a description and options for the echo command
47
what does $foo --help do?
displays a description and options for the executable foo
48
what does $man ls do?
displays a detailed manual for the ls command
49
what does $whatis ls do?
displays a brief description of the ls command
50
what does alias foobar='ls -a' do?
creates an alias that allows the commands 'ls -la' to be run by typing foobar
51
what does unalias foobar do?
removes the alias foobar
52
what does echo Hello World > peanuts.txt do?
overwrites any existing peanuts.txt with Hello World
53
what does echo Hello World >> peanuts.txt do?
appends Hello World to the contents of peanuts.txt
54
what does $ls /fake/directory 2> peanuts.txt do?
redirects the error message to peanuts.txt
55
in bash what is the re-director for stdout
>
56
in bash what is the redirect for stdin
<
57
in bash what is the redirect for stderr
2>
58
in bash what key represents the pipe operator
|
59
what does $ls -la /etc | less do?
pipes the command to less
60
what does $ ls | tee peanuts.txt do?
outputs ls to console and writes it to peanuts.txt
61
what does $ env do?
displays your environment variables
62
what does $ cut -c 5 sample.txt do?
outputs the 5th character of sample.txt
63
what does cut -f 1 -d ";" sample.text do?
prints the text before the first semi-colon in sample.txt
64
what does $ head foo do?
shows the first 10 lines of foo
65
what does $ head -n 15 foo do?
shows the first 15 lines of foo
66
what does $tail foo do?
displays the last 10 lines of foo
67
what does $ tail -f foo do?
follows the last line of foo as it grows
68
what does $ expand foo do?
prints the output of foo with each tab converted into a number of spaces
69
what does $ join foo bar do?
joins an order list from foo with an ordered list from bar
70
what does $split foo do?
splits foo into separate 1000 line files
71
what does $ sort foo do?
sorts the contents of foo (i.e. alphabetical order)
72
what does $ tr a-z A-Z do?
translates input to all caps
73
what does $ wc foo do?
gets the word count of foo
74
wat does $ nl foo do?
gets the line count for foo
75
what does $grep foo bar.txt do?
finds instances of foo in bar
76
what does $sudo foo do?
performs task foo with root privilages
77
what does $ visudo do?
allows you to see and edit super users in the /etc/sudoers file
78
what does $ chmod user2 +x myfile do?
adds executable permission for user2 to myfile.
79
what does $ chmod user2 -w myflie do?
removes write permissions for user2 from myfile
80
what does $ chmod user1user2 +r myfile do?
adds read permission for user1 and user2 to myfile
81
what does $ sudo chown patty myfile do?
changes the owner of myfile to patty
82
what does $ sudo chgrp whales myfile do?
changes group ownership of myfile to whales
83
what does $ sudo chown patty:whales myfile do?
changes the ownership of myfile to patty and to the whales group
84
what does $ umask do?
changes default permissions
85
what does $ ps do?
shows a a quick snapshot of the current processes.
86
what does $ ps a do?
lists all processes including those being run by other users
87
what does $ ps u do?
show more detail about processes
88
what does $ ps x do?
shows all process that don't have a TTY associated with them?
89
what does $ top do?
gives real time information about the processes being run
90
what does tty2 in the TTY field mean
process controlled by second terminal device
91
what does pts/* in the TTY field mean
process controlled by a pseudo terminal device
92
what does ? in TTY field mean
process has no controlling device
93
after the _exit system call what is the termination status for success
0
94
what is the master process called
init
95
when is an orphan process created
when a parent process dies before a child process
96
when is a zombie process created
when a child process terminates and the parent process hasn't called wait
97
what is SIGHUP?
hangup, sent to a process when the controlling terminal is closed
98
what is SIGINT
an interrupt signal sent when Ctrl-C is used to kill a process
99
what is SIGTERM
signal to kill a process but allow it to do clean up first
100
what is SIGKILL
signal to kill a process with no cleanup
101
what is SIGSTOP?
signal to stop/suspend a process
102
what is the default signal to kill a process?
SIGTERM
103
how does a niceness number affect a process
a lower number gives the process a higher CPU priority
104
what does $ nice -n 5 apt upgrade do?
sets the niceness of apt upgrade to 5
105
What dos process STAT R mean
running or runable
106
What does process STAT S mean
Interruptible sleep
107
What does process STAT D mean
Uninterruptible sleep
108
What does process STAT Z mean
Zombie
109
What does process STAT T mean
suspended/stopped
110
where in the file system are processes stored?
/proc
111
what does $ sleep 1000 & do?
sends process 1000 to run as a background job
112
what does $ jobs do?
lists the background jobs
113
what does $ fg %1 do?
returns background job 1 to the foreground
114
what does kill %1 do?
kills background job 1
115
what does $ gzip myfile do?
compresses myfile
116
what does $ gunzip myfile.gz do?
unzips myfile.gz
117
what does $ tar cvf mytarfile.tar file1 file2 do?
creates an archive containing file1 and file2
118
what does tar xvf mytarfile.tar do?
unpacks mytarfile
119
what does $ tar czf myfile.tar.gz do?
creates a compressed tar file
120
what does $ tar xzf file.tar do?
unpacks and extracts the contents of the tar file
121
what does $ dpkg -i foo.deb do?
installs foo.deb package
122
what does rpm -i foo.rpm do?
installs the foo.rpm package
123
what does $ dpkg -r foo.deb do?
removes foo.deb package
124
what does $ rpm -e foo.rpm do?
removes the foo.rpm package
125