Udemy Linux Flashcards

1
Q

Open Terminal

A

Ctrl + Alt + D

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

Close Terminal

A

Ctrl + D

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

echo

A

Prints out what you give it

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

cal

A

Calendar

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

date

A

today’s date & time

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

clear

A

clear screen

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

history

A

all previous commands

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

to run command in history

A

! + line #

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

!!

A

run most recent command

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

history -c; history -w

A

clears history and makes changes permanent

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

exit

A

terminal closes

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

echo $PATH

A

current path

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

which

A

which folder a command is in

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

operand

A

input

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

man

A

man pages

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

man “-k” “which”

A

man page ; search ; for term “which” –> man (section number) “result title”

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

>

A

standard output; #1; also 1>; will truncate

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

> >

A

output; append file

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

tty

A

see path of terminal

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

<

A

standard INPUT

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

cut

A

cuts files and returns specific columns (“fields”); –delimiter –> give it what divides the columns; –fields –> how many to output

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

|

A

pipe data from standard input to next command for standard input

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

tee

A

causes data to flow in two directions; saves to file as directed; allows file to be saved to continue piping

24
Q

xargs

A

(not all commands accept standard input, some only accept command line arguments) converts data from standard input and puts it into command line argument; can use command | xargs; command such as “echo”; command such as “cat” | xargs “rm”

25
Q

rm

A

delete

26
Q

.bash_aliases

A

file in home folder for aliases –> alias aliasName=”command1 -options args | command 2 -options args …” (make sure first command can be piped to, using xargs, if needed) –> restart terminal

27
Q

pwd

A

print working directory; ~ –> home directory

28
Q

absolute path

A

full path

29
Q

ls -F

A

classiFy –> slash at the end is a directory (folder);

30
Q

cd

A

change directory; ~(start at Home Directory)/; .=current directory; ..=parent folder or folder above

31
Q

ls -a

A

show hidden files; hidden files start with .

32
Q

touch

A

creates new empty files; touch // to create files inside directories / “folders”

33
Q

create file with content inside

A

echo “” > ___fiel name_____.txt

34
Q

mkdir

A

make directory; mkdir -p –> to create entire PATH; mkdir / –> will create folders inside folder

35
Q

rm

A

remove file or directory

36
Q

rm -r

A

delete recursively…delete the item and everything inside it; rm -ri (interactive, to have the r option ask for permission for each deletion)

37
Q

rmdir

A

remove empty directory

38
Q

cp

A

copy; cp -r –> copy the folder & everything inside (recursively)

39
Q

locate

A

locate files; locate -i –> search in case insensitive way; locate –limit # –> limit to number of files; locate -S –> get information about database itself; locate -e –> check to see if files existed before reporting them / locate –existing; locate –follow / locate -L –> check links; (ONLY LISTS FILES)

40
Q

updatedb

A

update database

41
Q

find

A

DEFAULT BEHAVIOR: list every file & folder that is inside the current folder & lower down in the file system; always up-to-date (doesn’t use database); use “/” to list all files & folders in system; can be used to list all contents in folders by using file path; file -maxdepth # to control number of levels find command searches; find . (current directory) -type f (for type: file) d (for type: directory/ “folder”) –> can be combined with maxdepth option using maxdepth FIRST; find . -name “” –> place name in quotes; find . -maxdepth 10 -iname “?.TXT” –> ignore case in name search (case insensitive); sudo find / (starting at root directory, so use sudo command to avoid permission denied from getting access to files requiring administrative privileges) -type f -size +100k –> searches for files larger than 100 kilobytes in size; pipe output to | wc -l to count how many lines there are; chain together requirements -size +100k -size -5M (larger than 100 kilobytes but less than 5 megabytes, -o for the “or” option in-between sizes

42
Q

-exec // -ok (OPTIONS)

A

execute OPTION; after command –> -exec __command to execute__ {} (every file) \; (to complete execution); using -ok will ask you each time if it is “ok” to do something

43
Q

ctrl + L

A

clear the screen

44
Q

cat

A

concatenate - “stick together”; or just read contents;

45
Q

tac // rev (OPTIONS)

A

tac: reverse input; vertically – keeps lines intact across columns; rev: reverses lines horizontally – across the rows

46
Q

less

A

paging program - page through large amounts of output

47
Q

head

A

first # of lines; head -n #

48
Q

sort

A

default: sort smallest first (a-z, 0-9); sort | tac (read backwards) OR sort -r (reverse) ; SORTING NUMBERS: sort using the value number give the “n” option –> sort -n (allows the sort command to sort numerically, instead of just by the digit); SORT FOR UNIQUE RESULTS: sort -q –> only get unique results; | sort -k (KEY DEFinition use for column) #column(+any other options, such as n, r, or u with no space…use h option to sort human-readable data – h can NOT be used with n); M for month

49
Q

grep

A

search for specific text; grep ___text_to_search_for____ ; use -c option for number of lines withs specific text (grep -c __texttosearch____ ; -i option for the search to be case insensitive; -v option finds all the lines that do NOT have a certain letter/term…grep -v / –> finds all files (not directories with / in folder name) v= invert search (do the opposite)

50
Q

ls

A

ls -lF –> gives slash around directories and nothing for files

51
Q

tar

A

compress file; tar -c(create a new archive)v(verbose - don’t so this silently)f(accept files) ; tar -x(extract)vf; to create gzip file: tar -cvzf ; tar -cvjf; to extract gzip: tar -xvzf ; to extract bzip: tar -xvjf ;

52
Q

gzip // bzip

A

gzip - faster but has less compression power; gzip (archive_name.tar) –> will see .gz file extension added; gunzip (“g unzip”) to undo gzip
bzip - can compress smaller but requires more time; bzip2 –> will see bz2 file extension added (best for really large files); to undo –> bunzip2 (“b unzip 2”)

53
Q

zip

A

create zip file; zip .zip ; to undo unzip

54
Q

bash script (Bourne-Again shell script)

A

nano .sh
#!(she-bang)/bin/bash(path to interpreter - to know words are commands) (verify with “which bash” at command prompt to retrieve interpreter’s file path)
python3 to run python script (“which python3”) /usr/bin/python3
bash to run bash script

55
Q

add path to be found by running bash script in new directory

A

nano .bashrc
PATH=”$PATH:$HOME/bin” if bin is created to hold bash scripts
PATH=”$PATH:$HOME/”
new directory is now added to $PATH
*remember to make executable –> chmod +x *

56
Q

cron utility

A

crontab -e –> open crontab editor (nano)

ls -a from ~ –> hidden file with selected editor (.selected_editor) or command “select-editor”