COMP 206: BASH and UNIX

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/226

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

227 Terms

1
New cards

System

set of interconnected components (also called artifacts)

2
New cards

OS

software that lets you interact with computer, manages resources, and provides libraries

3
New cards

POSIX Standard

Portable Operating System Interface

  • OS Application Programming Interface and System Interfaces

  • Utilities

  • Programming Libraries

  • Command Interpreter

4
New cards

Unix OS Components

kernel, file system, shell, utilities

5
New cards

Kernel

RAM: Login, runs programs, basic common interface, memory management

6
New cards

File System

part RAM, part disk: Defines the way the disk drive is formatted, file allocation table, data structure that makes files real, reads and writes to disk, interacts with files based on user commands.

7
New cards

Shell

A user interface, global memory, commands to interact with OS

8
New cards

Utilities

Additional OS commands and programs, third party commands and programs

9
New cards

RAM contains (3)

Kernel, File System, Login

10
New cards

Disk contains (2)

shell, utilities

11
New cards

Login on Failure

Failed Login is recorded in utilities

12
New cards

Login on Success

Access the shell and replaces login with bash

13
New cards

Shell Functions

get user input, display OS info, store session information

14
New cards

Home Directory

Top folder in users directory tree (~)

15
New cards

Root Directory

Top folder in OS (/)

16
New cards

Current Directory

Directory currently within (.)

17
New cards

Parent Directory

Directory above the current directory (..)

18
New cards

Absolute Path

String begins at root

19
New cards

Relative Path

String begins at current location

20
New cards

Command Format

<Program> <switches> <arguments>

21
New cards

echo

prints message to terminal and can be quoted

22
New cards

directory listing

(ls) lists items in dierctory

23
New cards

long form listing

(ls -l) <permissions> <links> <owner> <group> <size> <modification date>

24
New cards

ls -a

display all files including hidden files

25
New cards

ls -l <file list>

see particular long format file

26
New cards

pwd

displays current directory path

27
New cards

cd <directory name>

change directory, must be accessible from current directory (or have right path)

28
New cards

mkdir [switches] <directory name>

makes a new directory

29
New cards

rmdir [options] directory

removes a directory

30
New cards

touch [options] file

creates a new empty file

31
New cards

cp [options] file1 file2

copies file 1 (file or file path) to file 2 (path, file or filepath) (creates or overwrites file 2)

32
New cards

mv [options] file1 file2

move file 1 into file 2

33
New cards

rm [options] file

removes a file or directory (need switches for directory)

34
New cards

cp/mv/rm -i

interactive: prompts for confirmation before proceeding

35
New cards

cp/rm -r/R

recursively visits directory, first visitiing files and subdirectories beneath it

36
New cards

mv/rm -f

Force: don’t prompt for confirmation

37
New cards

cat [options] files

file concatenate and display result

38
New cards

less [options] file

page through a text file

39
New cards

[command] > path

redirects the output of command to file at path (overwritten)

40
New cards

[command] » path

redirect output of command, appending to file at path

41
New cards

command1 | command2

redirects output of command1 to input of command2

42
New cards

logout

closes shell and logs you out

43
New cards

exit

closes shell and sends you to shell used to start exited one

44
New cards

ctrl+C

Terminates Programs

45
New cards

ctrl+D

Stop waiting for input

46
New cards

*

replaces any pattern

47
New cards

?

Replaces single character

48
New cards

square brackets []

any character within the brackets

49
New cards

[x-y]

character range

50
New cards

[!x]

matches any single character except x

51
New cards

globbing

passing input to program and expands wildcard matching patterns within segments BEFORE calling the command (shell does the work)

52
New cards

result when globbing fails

literal wildcards sent to program

53
New cards

grep [option] <string> <file list>

searches for occurrences of the string (surround with single quotes to avoid expanding wildcard or variables)

54
New cards

sed [options] <file list>

stream editor for editing files

55
New cards

awk [options] <file list>

scans for patterns in a file and processes the results

56
New cards

grep -i

ignore case

57
New cards

grep -c

returns count of number of lines containing matches

58
New cards

grep -v

inverts the search (displays only ones that do not match)

59
New cards

grep -n

displays line number along with lines with matches

60
New cards

grep -l

lists filenames but not lines

61
New cards

grep -E

pattern uses extended syntax

62
New cards

grep -e

followed by pattern

63
New cards

grep ^

anchor: matches beginning of string/line

64
New cards

grep $

matches end of string/line

65
New cards

(?#…)

comment “…” is ignored

66
New cards

(?:…)

Matches but doesn’t return “…”

67
New cards

(?=…)

matches if expressions would match “…” next

68
New cards

(?!…)

Matches if expression wouldn’t match “…” next

69
New cards

?

match 0 or one occurrences of previous item (use backslash)

70
New cards

+

match one or more occurrences of previous item (use backlash)

71
New cards

*

match zero or more occurrences of the previous item (use backslash)

72
New cards

.

any character except newline

73
New cards

STDIN

Standard In: keys typed by user are gathered

74
New cards

STDOUT

Standard Out: normal application output

75
New cards

STDERR

Standard Error: error output

76
New cards

<

Content of file sent as input to program

77
New cards

2>

Redirects standard error

78
New cards

Nested Execution

$(…)

79
New cards

tee

redirects to 2 places: <command> | tee <destination1> | <destination2>

80
New cards

File

single document in disk storage

81
New cards

TAR

(.tar) Collection of files stored within a single document

82
New cards

ZIP

(.zip) Single compressed document in disk storage

83
New cards

Archive

(.gz) collection of zip files in a single file

84
New cards

tar tool

combines several files into single file

85
New cards

gzip tool

compress a single file

86
New cards

.tar

tar archive file

87
New cards

.tgz

compressed tar archive file

88
New cards

tar -c <archivename> <filename>

creates a new tar archive

89
New cards

tar -r <archivename> <filename>

updates tar archive

90
New cards

tar -x <archivename> <path>

extracts from tar archive

91
New cards

tar -f <archivename> <path>

specifies archive file name

92
New cards

tar -v

activates verbose mode

93
New cards

tar -z

allows you to compress the archive

94
New cards

diff [options] file1 file2

compares two files

95
New cards

ln <filepath> link_name

creates hard link to file/folder (like giving file another name- points to the same same in disk) (can only delete once all hard links are gone)

96
New cards

ln -s <filepath> link_name

creates symbolic link, new file that automatically redirects to target file (deletion does not affect target file)

97
New cards

sort [options] file

sorts the lines of the file

98
New cards

wc [options] [file(s)]

displays a word/character/line count

99
New cards

File Owner

each file is owned by a use and a group

100
New cards

File Permission Groups

user, group and other