Fox Chapter 9 & 16

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

1/97

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.

98 Terms

1
New cards
Shell
An interpreted environment where commands are entered and executed line by line.
2
New cards
Interpreted program
A program that is translated and executed line by line.
3
New cards
Compiled program
A program that is translated entirely before execution.
4
New cards
Bourne Shell
One of the earliest Unix shells created in 1977.
5
New cards
Bash
A shell that includes features from the Bourne shell and simplifies syntax for user-friendliness.
6
New cards
History list
A record of commands entered in the current Bash session.
7
New cards
Control+p
Command to retrieve the previous instruction from the history list.
8
New cards
Control+n
Command to display the next command from the history list.
9
New cards
Tab completion
A feature that completes directory or filename inputs automatically.
10
New cards
Alias
A shortcut command that represents a longer command in the shell.
11
New cards

Tilde expansion ~

A shorthand for referencing the user's home directory in commands.
12
New cards

Brace expansion {}

Used to create a series of items or commands by enclosing them in braces.
13
New cards
Wildcard

Can act as anything , * “match anything”

14
New cards
Environment variable
A variable defined by the operating system or applications, capitalized.
15
New cards
User variable
A variable defined by the user and used for command-line operations.
16
New cards
echo command

A command that prints text or variable values to the terminal. You can also view the contents of a variable using this command.

17
New cards
Redirection
The process of changing the standard input/output of commands.
18
New cards
Pipe
A method to redirect the output of one command as input to another.
19
New cards
Manual pages
Documentation for commands accessed using the 'man' command.
20
New cards
Text editor
A program used to edit plain text files, e.g., vi and emacs.
21
New cards
Conditional statement
A statement that executes based on whether a specified condition is true.
22
New cards
Iteration
The repetition of a process in programming, exemplified by loops.
23
New cards
While loop
A loop that executes while a given condition remains true.
24
New cards
If-then statement
A control structure that executes actions based on a condition.
25
New cards
Parameter
A value passed to the script or function for processing.
26
New cards
Script
An interpreted program that can accept parameters and has executable code.
27
New cards
Arithmetic operation
Basic math operations performed with numerical inputs in scripts.
28
New cards
exit status
A numerical representation of a command's success or failure, typically `0` for success.
29
New cards

What does typing !number where number is the number of the entry in the history list do?

Recalls an instruction from the history list

30
New cards

control+f

move cursor forward one character

31
New cards

control+b

move cursor backward one character

32
New cards

Escape key+f

move cursor forward one word

33
New cards

escape key+b

move cursor backward one word

34
New cards

control+a

move cursor to the beginning of the line

35
New cards

control+e

move cursor to the end of the line

36
New cards

control+d

delete the character where the cursor is at

37
New cards

control+k

 kill(delete) the contents from the cursor to the end of the line

38
New cards

control+w

delete all the characters before the cursor to the beginning of the word

39
New cards

control+y

take whatever was recently deleted and yank it back put it in current cursor position

40
New cards

control+_

undo the last editing operation (delete or paste) 

41
New cards

(T/F) Bash will treat any number as a string unless you specify that it should be a number

True

42
New cards

How do we change a number to a number and not a string in bash?

Enclose in parantheses

43
New cards

How would we obtain a value stored in a variable?

Add $ before variable name

44
New cards

How would we reference the command date ?

` date `

45
New cards

What does the PATH variable store

 a list of directories, whenever you enter a Linux command or file name, if the item is not found in the current working directory, then the Linux interpreter checks for the item in every directory

46
New cards

How to add to your PATH variable?

PATH=$PATH:/home/nameofdirectory

47
New cards

< redirection

redirect the input to come from an input file

48
New cards

> redirection

redirect the output to go to an output file, overwriting the file if it already exists.

49
New cards

>> redirection

redirect the output to be appended to an already existing file, or create the file if it does not exist

50
New cards

<< redirection

redirect the input to come from keyboard where input will terminate with a special keyword that you specify after

51
New cards

| redirection

redirect the output of one command to be the input of another

52
New cards

Most common form of help; use this command for knowing about an instruction

man command

53
New cards

How does the find command differ from the man command?

Includes list of examples

54
New cards

Apropos

allows us to search for a command based on what it accomplishes/does.

55
New cards

3 common text editors

  • GUI editor : Text Editor

  • vi

  • emacs

56
New cards

3 different modes of vi

command mode, insert mode and replace mode.

57
New cards

Command mode

 is the default mode in vi so keystrokes are interpreted as commands, a command preceded by a number means that command is performed that many times

58
New cards

Insert Mode

 is the mode in vi similar to a word processor, with each keypress the cursor advances to the next position. The only keystroke command in this mode is the escape key, which exits the mode returning you to command mode. 

59
New cards

Replace mode

mode in vi that as you enter keystrokes the characters overwrite the characters already present. 

60
New cards

o (vi text editor mode command)

insert a blank line after the current line and enter insert mode

61
New cards

O (vi text editor mode command)

insert a blank line before the current line and enter insert mode

62
New cards

I (vi text editor mode command)

Enter insert mode at the beginning of current line

63
New cards

A (vi text editor mode command)

Enter insert mode at the end of the current line

64
New cards

r (vi text editor mode command)

Replace one character with the next character entered

65
New cards

R (vi text editor mode command)

Enter replace mode and continue to replace (overwrite) characters (until escape

66
New cards

u (vi text editor mode command)

 undo the previous command

67
New cards

. (vi text editor mode command)

Repeat the last edit

68
New cards

n. (vi text editor mode command)

Repeat the last edit command n times

69
New cards

nk (vi text editor mode command)

Repeat command k n times

70
New cards

x (vi text editor mode command)

delete the next character

71
New cards

dw (vi text editor mode command)

delete the next word

72
New cards

dd (vi text editor mode command)

delete this line

73
New cards

D (vi text editor mode command)

delete from the cursor to the end of the line

74
New cards

yy (vi text editor mode command)

copy the current line into a buffer

75
New cards

p (vi text editor mode command)

paste any lines below current lines

76
New cards

:w <enter> (vi text editor mode command)

save the file

77
New cards

:w name <enter> (vi text editor mode command)

 save the file as name

78
New cards

:q <enter> (vi text editor mode command)

exit vi

79
New cards

:q! <enter> (vi text editor mode command)

exit vi without saving

80
New cards

:wq <enter> (vi text editor mode command)

save file and exit vi

81
New cards

Shell scripts are stored in text files that must be both ___ ___

readable and executable

82
New cards

All bash shell scripts should start with the following line, which alerts the bash interpreter to execute

 #!/bin/bash

83
New cards

Input is accomplished through the ____ statement, which is usually followed by a variable. It will result in the cursor blinking on a blank line.

read

84
New cards

Two common forms of conditional statements

variable comparison value and filetest filename

85
New cards

-eq

equal to

86
New cards

-ne

not equal to

87
New cards

-gt

greater than

88
New cards

-lt

less than

89
New cards

-ge

greater than or equal to

90
New cards

-le

less than or equal to

91
New cards

-d (filetest condition)

item is a directory

92
New cards

-e (filetest condition)

file exists

93
New cards

-f (filetest condition)

file exists and is a regular file

94
New cards

-h (filetest condition)

item is a symbolic link

95
New cards

-r (filetest condition)

file exists and is readable

96
New cards

-w (filetest condition)

file exists and is writable

97
New cards

-x (filetest condition)

file exists and is executable

98
New cards

What is the notation for executing a script

./script <enter>