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
cd /
goes to root directory
26
cd ..
goes up one folder
27
cd ../../../
goes up three folders
28
pwd
prints current working directory or path
29
man [some command]
explains the command and any options it might have
30
cat [file name]
shows the contents of a file
31
cat > [some filename]
opens up text editor to add text to that file, or create a new file it that name doesn't exist
32
head [file name]
prints only the top lines (use "head -n #" where # is number of lines from top)
33
tail [file name]
prints only the last lines (use "tail -n #" where # is number of lines from bottom)
34
mkdir [file name]
creates a new folder
35
mkdir [1stFolder/2ndFolder/file name] ..
creates new folder in the specific path
36
cp [file] [newfilename]
copies and renames file
37
cp [file] [path]
copies a file to that path
38
cp -R [folder] [newFolder]
copies and renames a folder
39
cp *.txt somePath/
copies all files of that type to that folder
40
mv [file] somePath/
moves a file to a folder
41
mv [folder] [newFolder]
moves a folder inside another folder
42
mv [file name] [new file name]
renames a file
43
mv [folder name]
moves the folder up one in the hierarchy
44
rm [file]
deletes the file
45
rm -i [file]
asks for permission before deleting file
46
rm -f [file]
forces the deletion of a file
47
rm -r [directory/]
deletes a folder
48
touch [file name]
creates or updates a file
49
ln file1 file2
physically links two files
50
ln -s file1 file2
symbolically (weak) links two files
51
find someText
searches all the CONTENTS of all the files in the current folder for that text
52
find -name [file name] someText
searches for that text in that specific file
53
find -name "text"
searches for files who start with the word text
54
find -type d someText
searches only directories
55
find -type f
searches only files
56
grep someText [file name]
searches for text in a file (-i = doesn't consider case) and returns any line that matches that text
57
cd ~/someFolder
move back to this folder relative to anything (used if you don't know where you are at)
58
chmod 777 [file name]
changes permissiono so anyone can read, write, and execute file
59
chmod 755 [file name]
changes permissions so that files can be readable and executable by others, but only changeable by user
60
chmod 700 [file name]
only the user can do anything to the file
61
grep -r text folderName/
searches file names for that text
62
grep -E ^text folderName/
searches fileNames that BEGIN with that text
63
grep -E <0-4> fileName
show lines containing the numbers 0-4
64
grep -E fileName
retrieves all lines with alphabetical letters
65
grep -r text
searches for tha ttext recursively throughout the files in the folders and parent folders
66
grep texts *.txt
searches that text in every .txt file
67
grep "sometext.someothertext"
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
grep "someText*"
searches for the someText any number of consecutive times (so grep ".*" searches for anything that repeats any number of times)
69
grep -i "sometext"
searches for that text where case doesn't matter
70
grep "text$"
searches for that text at the END of a line
71
grep "\
searches for text at beginning of word
72
grep "text\>"
searches for text at end of word
73
grep "text?"
searches for text at most once
74
grep "text*"
searches for text zero or more times
75
grep "text+"
searches for text one or more times
76
grep "text{n}"
searches for text exactly n times
77
grep "text{n,}"
searches for text at least n times
78
grep "text{n,m}"
searches for text at least n times, and at most m times
79
someCommand | nextCommand
pipes the output of first command into the second
80
sort fileName
sorts the contents of the file
81
sort -r fileName
sorts in reverse
82
sort -n
sorts numbers
83
wc
prints word count (-l for lines, -w for words, -c for characters)
84
date
view and modify the time on your computer
85
at [specific date and time] someCommand
performs that command or can run an executable at that specific time
86
chrontab
execute a command regularly
87
w
prints who is logged on
88
tload
graphic representation of system load
89
ps -u accountName | grep programName
get a list of processes from user using a particular program
90
kill [PID#]
kills a process with that ID #
91
chmod
``` u = user g = group o = other ``` ``` d = directory l = link r = read w = write x = executable ``` ``` + = add a permission - = take away a permission ```
92
someCommand > fileName
at the end of a command, redirect the results as text into a file
93
someCommand >> fileName
at the end of a command, redirect the results as text inside and at the END of the file
94
someCommand 2> fileName
at the end of a command, redirect the error messages into a file
95
gzip myFile.tar
compresses a file
96
gunzip myFile.tar.gz
decompresses a file
97
sudo apt-get install nameOfSoftware
downloads and installs software in a repository
98
ssh
connects to a remote server
99
alias
gives a new name to another command
100
history
all the past commands typed into the shell
101
rmdir folderName
removes the folder
102
uniq
strips duplicated lines
103
locate fileName
searches for file on entire system
104
hostname
outputs the name of current computer/server
105
w, finger
see who is logged into this computer
106
wget someURL
download from a url and save it to current directory
107
vim
complicated text editor
108
nano
simple text editor
109
emacs
complicated text editor
110
sed 's/oldText/newText/' fileName
replaces all strings old to the new
111
sed 's/old/new/' file1 > file2
replaces all strings from old to new and makes a new file
112
echo somethingHere
print function
113
*
matches any file
114
Up arrow
repeats previous commands(s)