Progweek1 Flashcards
Unix was born in _
1973
Unix provides a _ between the _ and the _.
simple-to-use and powerful interface
user (the programmer)
hardware (the computer)
Unix was based on simple ideas:
1
2
3
4
- simple interface
- simple instructions that can be combined
- hierarchical file system
- independent from specific computer architectures
Since its development, Unix served as a _
base to develop operating systems
structure of systems developed by Unix:
⥐⥐⥐
1 ⇋ 2 ⇋ 3 ⇋ 4
1: user
2: shell
3: kernel
4: Hardware
2&&4: OS
The Unix shell is _.
It allows _.
an interface between the user and the operating system.
to run system commands.
why a shell?
- powerful: Allows to solve
many simple problems in a few
lines. - Fast && flexible: offers
a scripting language which
often results in faster solutions
to problems.
syntax of commands
<options><parameters>
</parameters></options>
what is the command to list ll the file and directories in my desktop
l s −a
command that shows you the manual of the
specific command
+give eg
man
eg: man ls)
To work with objects in the file system we use their paths. There are two
ways of expressing the path of a file:
- Absolute: Starting from the root, e.g.: /Users/Lorenzo/Desktop
- Relative: Starting from the current
position in the file system,
e.g.: ./Lorenzo/Desktop
“..”
meaning on the shell?
“the parent directory”
“.” meaning on the shell?
“this directory”
def of Files:
A sequence of bytes.
def of Path: (+eg)
The position in the file
system,e.g., /Users/Lorenzo/Desktop
def of Permission:
What can a user do with
the file read/write/execute for the owner,
owner group, everyone
hox to see permission on the shell?
use option ls -l
def of Directories:
A file that indexes other
files.
main ingredients of the file system:
- files
- path
- permission
- owner
- dimension
- last modified
- directories
list the files in dir
ls dir
count words in file
wc file
count characters in file
mc file
count lines in file
lc file
look for all the lines in the file that match the expression
grep expression file
redirects the output of the command to a file
command > file
edirects the output of the command to a file with append
command»_space; file
use the ouput of command1 as input of command2
command1 | command2
command1 is executed successfully
executes command2
command1 && command2
Vim is a _ yet quite _ file _.
minimal
powerful
file editor
In a few words, C is:
- Imperative
- Typed
- Low level
pros of C
- Efficient (you have full control
on use of resources) - Fast (you can usually
implement very fast programs,
e.g., using bit manipulation) - Good if you want to implement
low level applications
cons of C
Limited degree of abstraction
Limited run time support
Limited portability
Low level of security
what is “int main()” ?
declares a function which is called “main” and returns an
integer.
def of Interpreter:
Program that executes code written in the high-level language. This is the typical approach of functional and scripting languages, standard in Python.
def of compiler
The compiler translates the code to the target language
producing an executable file. This is the standard approach in most
imperative languages, standard in C.
C programs are complied:
hello.c → 1 → 2 → 3 ⇒ 4
- preprocessor
- compiler
- linker
- executable code
Preprocessing:
takes care of lines that start with “#”
Compiling:
takes the code obtained from the preprocessor and
produces code that can be executed by the hardware