Introduction: Grading/attandance rules, Lab tests on the exam server, Course website
ssh username@linux.scs.ubbcluj.ro (then input password)
It is the most powerful and flexible way to get things done in an operating system, provided that you know what you are doing.
a. Linux: Sh, Bash, Ksh, ...
b. Windows: Cmd (remember from assembly, building, linking and executing code), Powershell, ...
c. MacOS: Terminal (actually Bash)
ls list content of current directorymkdir creates new directorycd changes the current directoryecho displays textps display running processes
Grouping/separating comds with:
; | && || () {}
Redirecting:
0 - stdin
1 - stdout
2 - stderr
output: > ... (redirect output to... and overwrite) >> ... (append to ...)
input: ... < (provide input to ...) ... << DELIMITER (read input continuously until the specified DELIMITER comes up)
error: 2>... (redirect standsrd error to ..)
>&1 >&2
pipe: cmd1 | cmd2 (the output from cmd1 will be input for cmd2); eaxmple: cat fis.txt | sort
Homework 1: ls, cd, mkdir, pwd, man, head, tail, cut, clear, kill, echo, less, cp, find, zip, unzip, tar, gzip, gunzip, write, who, finger, ping, cat, sort, wc, rm, chmod, passwd, ps, fg, bg, file, w, mv, df, du, comm, diff, mesg, date, cal, nohup, ssh, scp, pine/mutt/alpine (for email), mesg n, whatis, apropos
Ctrl+S locks the console => Ctrl+Q to unlock
Ctrl+C terminates the current process
Ctrl+Z send the current process in background (Ctrl+L to restore or fg command)
Ctrl+D exit (runs the exit command)
man ls )
vim editor
syntax on
set tabstop=4
set expandtab
Homework 2: learn vi (or a similar editor)
VIM interactive tutorial: http://www.openvim.com/tutorial.html
Practice recovering a file in VIM: https://www.zachpfeffer.com/single-post/Practice-Recovering-a-File-in-Vim
To open the code editor:
>> vi helloworld.c
or
>> joe helloworld.c
etc.
To compile (this will create the output executable file names hello or print on the screen the compiling errors):
>> gcc -Wall -o hello helloworld.c
To execute:
>> ./hello
Hello world example program:
| helloworld.c |
-------------------------------------------- |
Homework 3: Learn/remember C (not C++). Ex. Write a C program that reads 10 real numbers, stores them into an array and computes the average, min and max.