Linux / Bash Flashcards

1
Q

[your app/program] –version

A

returns the version of the program you have installed

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

touch [file name].[file type is optional]

A

creates that file in current directory

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

in vim:

i

A

enters INSERT mode where you can edit the file

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

in vim:

:wq

A

exits INSERT mode and saves the file changes

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

in vim:

:q

A

exits INSERT mode and does not save file changes

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

what kind of file is .md ?

A

markdown file

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

clear

A

clears the shell

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

CTRL L

A

clears the shell

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

CTRL D

A

logs out

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

open .

A

opens the current directory into a new graphical window (in Finder)

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

CTRL A

A

brings cursor to START of line

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

CTRL E

A

brings cursor to the END of line

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

CTRL U

A

delete LEFT of cursor

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

CTRL K

A

delete RIGHT of cursor

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

CTRL W

A

delete WORD on LEFT

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

CTRL Y

A

PASTE (after U, K, or W)

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

TAB

A

autocomplete

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

!!

A

REPEAT last command

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

CTRL Z

A

STOPS current command or process

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

ls

A

lists files in current directory

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

ls -all

A

lists all files in current directory with all permisions and all metadata

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

ls -a

A

lists all files and folders (even hidden ones)

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

ls [some directory]

A

lists files in specific directory

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

cd [some directory]

A

changes directory

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

cd /

A

goes to root directory

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

cd ..

A

goes up one folder

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

cd ../../../

A

goes up three folders

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

pwd

A

prints current working directory or path

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

man [some command]

A

explains the command and any options it might have

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

cat [file name]

A

shows the contents of a file

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

cat > [some filename]

A

opens up text editor to add text to that file, or create a new file it that name doesn’t exist

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

head [file name]

A

prints only the top lines (use “head -n #” where # is number of lines from top)

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

tail [file name]

A

prints only the last lines (use “tail -n #” where # is number of lines from bottom)

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

mkdir [file name]

A

creates a new folder

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

mkdir [1stFolder/2ndFolder/file name] ..

A

creates new folder in the specific path

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

cp [file] [newfilename]

A

copies and renames file

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

cp [file] [path]

A

copies a file to that path

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

cp -R [folder] [newFolder]

A

copies and renames a folder

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

cp *.txt somePath/

A

copies all files of that type to that folder

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

mv [file] somePath/

A

moves a file to a folder

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

mv [folder] [newFolder]

A

moves a folder inside another folder

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

mv [file name] [new file name]

A

renames a file

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

mv [folder name]

A

moves the folder up one in the hierarchy

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

rm [file]

A

deletes the file

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

rm -i [file]

A

asks for permission before deleting file

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

rm -f [file]

A

forces the deletion of a file

47
Q

rm -r [directory/]

A

deletes a folder

48
Q

touch [file name]

A

creates or updates a file

49
Q

ln file1 file2

A

physically links two files

50
Q

ln -s file1 file2

A

symbolically (weak) links two files

51
Q

find someText

A

searches all the CONTENTS of all the files in the current folder for that text

52
Q

find -name [file name] someText

A

searches for that text in that specific file

53
Q

find -name “text”

A

searches for files who start with the word text

54
Q

find -type d someText

A

searches only directories

55
Q

find -type f

A

searches only files

56
Q

grep someText [file name]

A

searches for text in a file (-i = doesn’t consider case) and returns any line that matches that text

57
Q

cd ~/someFolder

A

move back to this folder relative to anything (used if you don’t know where you are at)

58
Q

chmod 777 [file name]

A

changes permissiono so anyone can read, write, and execute file

59
Q

chmod 755 [file name]

A

changes permissions so that files can be readable and executable by others, but only changeable by user

60
Q

chmod 700 [file name]

A

only the user can do anything to the file

61
Q

grep -r text folderName/

A

searches file names for that text

62
Q

grep -E ^text folderName/

A

searches fileNames that BEGIN with that text

63
Q

grep -E <0-4> fileName

A

show lines containing the numbers 0-4

64
Q

grep -E fileName

A

retrieves all lines with alphabetical letters

65
Q

grep -r text

A

searches for tha ttext recursively throughout the files in the folders and parent folders

66
Q

grep texts *.txt

A

searches that text in every .txt file

67
Q

grep “sometext.someothertext”

A

searches for the beginning text, then any single character can be placed in the middle, and then the exact some other text after it

68
Q

grep “someText*”

A

searches for the someText any number of consecutive times (so grep “.*” searches for anything that repeats any number of times)

69
Q

grep -i “sometext”

A

searches for that text where case doesn’t matter

70
Q

grep “text$”

A

searches for that text at the END of a line

71
Q

grep “\

A

searches for text at beginning of word

72
Q

grep “text>”

A

searches for text at end of word

73
Q

grep “text?”

A

searches for text at most once

74
Q

grep “text*”

A

searches for text zero or more times

75
Q

grep “text+”

A

searches for text one or more times

76
Q

grep “text{n}”

A

searches for text exactly n times

77
Q

grep “text{n,}”

A

searches for text at least n times

78
Q

grep “text{n,m}”

A

searches for text at least n times, and at most m times

79
Q

someCommand | nextCommand

A

pipes the output of first command into the second

80
Q

sort fileName

A

sorts the contents of the file

81
Q

sort -r fileName

A

sorts in reverse

82
Q

sort -n

A

sorts numbers

83
Q

wc

A

prints word count (-l for lines, -w for words, -c for characters)

84
Q

date

A

view and modify the time on your computer

85
Q

at [specific date and time] someCommand

A

performs that command or can run an executable at that specific time

86
Q

chrontab

A

execute a command regularly

87
Q

w

A

prints who is logged on

88
Q

tload

A

graphic representation of system load

89
Q

ps -u accountName | grep programName

A

get a list of processes from user using a particular program

90
Q

kill [PID#]

A

kills a process with that ID #

91
Q

chmod

A
u = user
g = group
o = other
d = directory
l = link
r = read
w = write
x = executable
\+ = add a permission
- = take away a permission
92
Q

someCommand > fileName

A

at the end of a command, redirect the results as text into a file

93
Q

someCommand&raquo_space; fileName

A

at the end of a command, redirect the results as text inside and at the END of the file

94
Q

someCommand 2> fileName

A

at the end of a command, redirect the error messages into a file

95
Q

gzip myFile.tar

A

compresses a file

96
Q

gunzip myFile.tar.gz

A

decompresses a file

97
Q

sudo apt-get install nameOfSoftware

A

downloads and installs software in a repository

98
Q

ssh

A

connects to a remote server

99
Q

alias

A

gives a new name to another command

100
Q

history

A

all the past commands typed into the shell

101
Q

rmdir folderName

A

removes the folder

102
Q

uniq

A

strips duplicated lines

103
Q

locate fileName

A

searches for file on entire system

104
Q

hostname

A

outputs the name of current computer/server

105
Q

w, finger

A

see who is logged into this computer

106
Q

wget someURL

A

download from a url and save it to current directory

107
Q

vim

A

complicated text editor

108
Q

nano

A

simple text editor

109
Q

emacs

A

complicated text editor

110
Q

sed ‘s/oldText/newText/’ fileName

A

replaces all strings old to the new

111
Q

sed ‘s/old/new/’ file1 > file2

A

replaces all strings from old to new and makes a new file

112
Q

echo somethingHere

A

print function

113
Q

*

A

matches any file

114
Q

Up arrow

A

repeats previous commands(s)