1 Principali comandi del Sistema Operativo Unix Christian: The Unix Operating System Redivo – Zaglia: Unix Bourne: The Unix System Quartiroli – Fusaro.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

1 ZonicBook/618EZ-Analyst Resonance Testing & Data Recording.
AP STUDY SESSION 2.
1
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 2 Getting Started.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Custom Statutory Programs Chapter 3. Customary Statutory Programs and Titles 3-2 Objectives Add Local Statutory Programs Create Customer Application For.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt BlendsDigraphsShort.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Photo Slideshow Instructions (delete before presenting or this page will show when slideshow loops) 1.Set PowerPoint to work in Outline. View/Normal click.
Break Time Remaining 10:00.
Turing Machines.
PP Test Review Sections 6-1 to 6-6
Bellwork Do the following problem on a ½ sheet of paper and turn in.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Chapter 6 File Systems 6.1 Files 6.2 Directories
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
RH030 Linux Computing Essentials
Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
: 3 00.
5 minutes.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Analyzing Genes and Genomes
Essential Cell Biology
Clock will move after 1 minute
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Physics for Scientists & Engineers, 3rd Edition
Energy Generation in Mitochondria and Chlorplasts
Select a time to count down from the clock above
Murach’s OS/390 and z/OS JCLChapter 16, Slide 1 © 2002, Mike Murach & Associates, Inc.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
The UNIX development environment CS 400/600 – Data Structures.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Text Editing February 2 nd, 2004 Class Meeting 3.
Introduction to Programming Using C An Introduction to Operating Systems.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Laboratory 1.2a1 First steps with Unix - Lab Boris Steipe Department of Biochemistry Department.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Quality Thought Technologies
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
C151 Multi-User Operating Systems
Vi Editor.
CSE 374 Programming Concepts & Tools
Basic UNIX OLC Training.
Andy Wang Object Oriented Programming in C++ COP 3330
January 26th, 2004 Class Meeting 2
Presentation transcript:

1 Principali comandi del Sistema Operativo Unix Christian: The Unix Operating System Redivo – Zaglia: Unix Bourne: The Unix System Quartiroli – Fusaro – Smareglia: Unix

2 Uso del manuale in linea $> man who WHO (1) USER COMMANDS WHO (1) NAME who – who is logged in on the system SYNOPSIS: who [ who-file ] [ am i ] DESCRIPTION:

3 Uso del manuale in linea $> apropos who who - who's logged in whoami - display current user w- what everyone is doing $> apropos logged logname-get the name you are using w- what everyone is doing

4 Il file system delle macchine Unix per la didattica / docenti... local home... usr lib bin st labgroup st tecnici tesisti studenti

5 Come muoversi nel File System $> pwd /* path to current directory */ /usr/home/studenti/st93302 $> cd mydir /* change directory */ $> pwd /usr/home/studenti/st93302/mydir

6 Come muoversi nel File System $> cd /usr/home/studenti /* change dir with */ $> pwd /* with absolute path */ /usr/home/studenti $> cd st93302/mydir /* change dir with */ $> pwd /* with relative path */ /usr/home/studenti/st93302/mydir $> cd /* change to home directory */

7 Come muoversi nel File System $> pwd /usr/home/studenti/st93302 $> cd.. /* change to parent directory */ $> pwd /usr/home/studenti $> pwd /usr/home/studenti/st93302 $> cd. /*. is the current directory */ $> pwd /usr/home/studenti/st93302

8 Manipolazione dei file $> ls/* list current directory */ pippoplutoprogram.c $> ls /usr/home/* list specified directory */ docentistudentitecnicitesisti /usr/home/studenti $> ls -l/* list protections, owner and size */ -rw-r--r--st30221 lab Nov 12 13:15 pippo.c -r-xr-xr-xst30221 lab Nov 11 10:10 pluto.c

9 Manipolazione dei file $> ls -la/* list also current and parent dir */ -rw-r--r--st30221 lab01 81 Oct 10 23:05. -rw-r--r--st30221 lab01 75 Oct 10 09:12.. -rw-r--r--st30221 lab Nov 12 13:15 pippo.c -r-xr-xr-xst30221 lab Nov 11 10:10 pluto.c

10 Manipolazione dei file $> cat pippo.c /* show content of file */ #include main() int i1 = 0; char c1,c2; $> more pippo.c /* show content of file in pages use "space" or "enter" to advance */

11 Manipolazione dei file $> cp pluto pippo/* copy pluto onto pippo */ /* old pluto – if any – is lost */ $> mv pluto pippo/* change name of pluto */ /* old pippo – if any – is lost */ $> rm pluto pippo/* remove specified files */ $> mkdir new-dir/* make new directory */

12 Manipolazione dei file $> rmdir new-dir/* remove new-dir */ /* only if empty */ $> rm –r new-dir/* recursively remove */ /* new-dir */ $> wc file /* counts lines words, chars in file */ $> wc -l file /* counts lines in file */

13 Manipolazione dei file $> diff f1 f2/* lists diffs between f1 and f2 */ $> grep STR file(s)/* search STR in file(s) */ $> file prog.c /* file type */ prova.c : c program text $>find DIR -name FILE -print/* search FILE */ /* in DIR recursively */

14 Manipolazione dei file $>find DIR -name "*STR*" -print /* search for file names containing STR */ /* in DIR recursively */ $> du /* disk usage (in blocks) */

15 Protezione dei file in Unix Tre tipi di protezione: –lettura: r –scrittura: w –esecuzione: x Tre livelli di protezione: –utente: u –gruppo: g –gli altri: o –utente + gruppo + gli altri: a

16 Protezione dei file in Unix $> ls -l pippo -rw-r--r-- st pippo $> chmod u+x pippo /* allows execution to owner */ $> ls -l pippo -rwxr--r-- st pippo

17 Protezione dei file in Unix $> ls -l pippo -rwxr----- st pippo $> chmod go+rx pippo /* allows read and execution to */ /* group and others */ $> ls -l pippo -rwxr-xr-x st pippo

18 Protezione dei file in Unix $> ls -l new-dir drwxrwxrwx st new-dir $> chmod a-rw new-dir /* forbids read and write */ /* to everyone */ $> ls -l new-dir d--x--x--x st new-dir

19 cambiamento di appartenenza dei file in Unix $> ls -l -rw-r--r--st30221 lab Nov 12 13:15 pippo.c -r-xr-xr-xst30221 lab Nov 11 10:10 pluto.c $> chown st96932 pippo.c /*change owner of file */ $> ls -l -rw-r--r--st96932 lab Nov 12 13:15 pippo.c -r-xr-xr-xst30221 lab Nov 11 10:10 pluto.c

20 Gestione dei processi in Unix $> ps /* show Process Status of terminal */ PIDTTSTAT TIMECOMMAND 1418 p0S 0:01-csh (csh) 1423p0R 0:00ps $> ps agx /*shows all processes */ $> ctrl-C/* kills a running process */ $> ctrl-Z/* suspends a running process */

21 Foreground e Background Normalmente, quando lanciate un comando o un eseguibile, il controllo del terminale (il prompt) ritorna solo alla terminazione del processo corrispondente: myprompt> sleep 10; echo "ciao!"/* waits 10 seconds */... for 10 seconds nothing happens no other commands can be run until 10 sec. expire ciao! myprompt> Questa e' l'esecuzione dei processi in foreground

22 Foreground e Background Tuttavia e' possibile lanciare un comando o un programma, e mentre il processo relativo e' in esecuzione eseguire altri comandi/programmi myprompt> sleep 10; echo "ciao!" &/* waits 10 seconds * myprompt> date Mon Nov 12 16:31: myprompt> cp pippo pluto myprompt>... /* and 10 seconds later: */ ciao! Questa e' l'esecuzione dei processi in background

23 Foreground e Background $> ctrl-Z/* suspends a foreground running process */ $> fg /* resume in foreground a suspended process */ $> bg /* resume in background a suspended process */ $> jobs /* shows background processes */

24 Uccisione di un processo in Unix $> ps /* show Process Status of terminal */ PIDTTSTAT TIMECOMMAND 1418 p0S 0:01-csh (csh) 1419 p0R 0:50a.out 1234 p0R 0:00ps $> kill 1419/* kill the specified process */ $> kill /* 1419 cannot ignore kill */ SIGKILL

25 Alcuni metacaratteri C-Shell $> !! /* re-executes last issued command */ $> !w/* re-executes last command starting with "w" */ $> ls *.c /* asterisk = subsitute for everything */ $> ls > pippo /* output redirection */ $> cat pippo prova.c prog.c

26 Alcuni metacaratteri C-Shell \METACHAR/* escape for METACHARS */ $> cp pippo <> /* error of redirection */ $> cp pippo \ /* creates a file called <> */

27 File speciali C-Shell.login/* configures login session */.cshrc /* set aliases, seraching paths,... */ alias ll "ls -l"/* renames "ls -l" as ll */ $> source.cshrc /* re-read.cshrc – useful if searching paths are changed */

28 File speciali C-Shell.history/* remembers last issued commands */ $> history [n] /* shows last n issued commands */ 41ls 42date 43vi pippo.c 44lpr pippo.c 45pwd $> !44/* re-issues command n. 44 */ lpr pippo.c

29 File speciali C-Shell $> history [n] /* shows last n issued commands */ 41ls mydir 42date 43vi pippo.c $> !ls/* re-issues last "ls" command */ ls mydir $> cd !$/* !$ is the last arg. of previous command */ cd mydir

30 Text editor "vi" Per scrivere un file in Unix potete usare uno degli editor disponibili: "pico", "gvi", "vi". pico e gvi sono editor moderni, in cui potete manipolare il testo usando mouse e frecce. gvi accetta anche tutti i comandi di vi. vi e' l'editor di default in Unix. E' difficile da usare, perche' e' stato sviluppato quando non esistevano le moderne interfacce grafiche, e il mouse non era ancora stato inventato. vi e' molto potente, e i suoi comandi possono persino essere messi in un file ed eseguiti separatamente.

31 Text editor "vi" In vi esistono due modalita': COMANDO, usata per spostarsi nel testo, cancellare, duplicare, sostituire, cercare, etc. INSERZIONE, per inserire testo. Si passa da una modalita' all'altra con opportuni comandi $> vi prova.c /* creates or open prova.c */ quando editate un file, inizialmente siete in modalita' COMANDO

32 Text editor "vi" MODO "COMANDO": come uscire dall'editor :wq /* quit editor saving changes */ ZZ /* quit editor saving changes */ :w/* save changes without quitting */ :q/* quit editor without saving changes */ :q! /* quit editor without saving changes */

33 Text editor "vi" MODO "COMANDO": come spostarsi nel file h /* moves left of one character */ l /* moves right of one character */ j/* moves down of one line */ k/* moves up of one line */ ctrl-U /* moves up of a few lines */ ctrl-D/* moves down of a few lines */ G/* goes to the end of file */ nG/* goes to line number n of file */

34 Text editor "vi" MODO "COMANDO": come cancellare x /* deletes current character */ dd /* deletes current line */ dw/* deletes current word */ nx/* deletes n chars from cursor to the right */ ndd/* deletes n lines downward */ ndw/* deletes n words from cursor to the right */

35 Text editor "vi" MODO "COMANDO": altri comandi utili rx /* replaces current char with char x */. /* repeats last command */ u/* undo last command */ /string/* searches first occurence of string in file downward */ ?string/* searches first occurence of string in file upward */ n/* after a search command, repeats search */

36 Text editor "vi" MODO "COMANDO": altri comandi utili nyy /* copies n lines in a local buffer. Useful to copy lines in different parts of the text */ p /* puts content of buffer starting at the cursor position */ il comando "p" puo' essere usato per inserire il contenuto del buffer locale del vi. Questo buffer viene riempito non solo dal comando "yy", ma anche, ogni qual volta si usa un comando di cancellazione, con la parte di testo cancellata. Cosi' e' possibile spostare porzioni di testo da una parte all'altra del file.

37 Text editor "vi" MODO "COMANDO": altri comandi utili % /* if cursor is on a parenthesis, it goes to the corresponding balancing parenthesis */ "%" e' utile quando si scrivono programmi in C per controllare il bilanciamento delle parentesi dei costrutti :s/OLD/NEW/g /* replaces every occurence of OLD string with NEW string in file */ mLETTER /* mark the current line with LETTER */ :'a,'bw FILE/* writes the part of file between the two marker letters "a" and "b" in a new FILE */

38 Text editor "vi" MODO "COMANDO": altri comandi utili :r FILENAME /* insert the content of FILENAME in the current file starting at cursor position */ :set number /* sets line numbering of file */ :set nonumber /* removes line numbering of file */

39 Text editor "vi" passaggio dal modo "COMANDO"al modo "INSERZIONE" i /* to insert text from the cursor position */ a /* to append text from char next to cursor position. Useful to append text at the end of lines */ o /* open a new line for text insertion below the cursor */ O /* open a new line for text insertion above the cursor */ s /* substitutes current char with new text */ ns /* substitutes n chars from cursor with new text */ cw /* change word */

40 Text editor "vi" passaggio dal modo "INSERZIONE"al modo "COMANDO" In ogni momento, per passare dalla modalita' INSERZIONE a quella di comando, basta digitare il tasto ESCAPE.

41 Uso del compilatore C $> gcc file.c /* creates an executable program called a.out */ $>a.out/* runs a.out */ $> gcc file.c -o myprogram /* creates an executable called myprogram */