Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > Esame di laboratorio (Giugno 2007) - Domande Thread Rating: 3 votes, 5.00 average.
Pages (39): « First ... « 19 20 21 22 [23] 24 25 26 27 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

a ok ok, senti ne approfitto per chiederti una cosa, quando si fa la parte kernel bisogna sempre ricompilare immagino, ma si ricompila sempre allo stesso modo oppure varia in base alla richiesta??

se mi puoi anche scrivere i comandi mi faresti un piacere(in questo momento non ho voglia di cercare nel thread :) )

12-07-2008 11:01
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
alexn1
Dott.

User info:
Registered: Oct 2004
Posts: 71 (0.01 al dì)
Location: Milano
Corso: Informatica (sera)
Anno: Finito!
Time Online: 2 Days, 6:14:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ho trovato sul wiki del corso di laboratorio questo esercizio:

- quante dir hanno meno di 5 sottodir?

Voi come lo fareste?

19-07-2008 17:02
Click Here to See the Profile for alexn1 Click here to Send alexn1 a Private Message Find more posts by alexn1 Add alexn1 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

allora ho visto che per scoprire se un file è una directory basta usare ls -p, in questo modo le directory vengono indicate con lo "/"

sicuramente bisogna fare un script, solo che adesso non saprei come controllare tutte le directory presenti

Last edited by Gehur on 20-07-2008 at 09:44

20-07-2008 08:49
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

allora un metodo ci può essere

con un find si trovano tutte le directory, poi per ogni stringa che ti stampa a video si contano i numero di "/" presenti..se è minore di 5 incrementa contatore..
solo che adesso bisogna trovare un modo per contare gli "/"

20-07-2008 09:00
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

allora ho scritto questo comando:

find / -type d | xargs tr '[a-z][A-Z]01234567890.-_' ''

in pratica cercami tutti i file directory e per ogni file trovato trasforma i vari caratteri scritti sopra in ''(cioè li cancello), in questo modo mi stampa a video una lista di /, adesso bisogna solo contare, se sai il modo e me lo dici :)

20-07-2008 09:52
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
alexn1
Dott.

User info:
Registered: Oct 2004
Posts: 71 (0.01 al dì)
Location: Milano
Corso: Informatica (sera)
Anno: Finito!
Time Online: 2 Days, 6:14:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Io in parallelo stavo provando un'altra strada: visto che con il comando "ls -l" il secondo campo che viene restituito è il numero delle sottodirectory di una directory (compreso . e .. ) stavo cercando di stampare il numero ed il nome della directory.
Al momento sono riuscito ad impostarlo ma c'è ancora qualcosa da affinare...

Il find che eseguo è il seguente:

find / -type d -exec ls -ld {} \; | cut -f 2,12 -d " " | sort -n

Il risultato è ancora un po' confuso... :razz: ma spero di metterlo a posto

20-07-2008 11:45
Click Here to See the Profile for alexn1 Click here to Send alexn1 a Private Message Find more posts by alexn1 Add alexn1 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

a cavoli non ci avevo fatto caso, la tua soluzione è meglio, non bisogna contare ma solo confrontare :D

ma perchè il cut fatto cosi cut -f 12 non funziona..

poi si potrebbe usare in qualche modo un grep[1234] per scegliere solo le righe che contengono meno di 5 directory, in ultimo basterebbe contare le righe e via, solo che non riesco a dusare sto grep :arg:

Last edited by Gehur on 20-07-2008 at 13:22

20-07-2008 13:16
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
alexn1
Dott.

User info:
Registered: Oct 2004
Posts: 71 (0.01 al dì)
Location: Milano
Corso: Informatica (sera)
Anno: Finito!
Time Online: 2 Days, 6:14:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ci siamo quasi... Mi manca "solo" da restringere la scelta alle dir con meno di 5 subdir

find / -type d | xargs ls -ld | tr -s ' ' ' ' | cut -f 2,9 -d ' '


[Edit 17.38]

Bingo! Ecco la "formula magica":

find / -type d | xargs ls -ld | tr -s ' ' ' ' | cut -f 2,9 -d ' ' | grep "^[2-6] " | wc -l

Nota: scelgo solo quelle che risultano avere da 2 a 6 sottodir perchè il valore che viene mostrato da "ls -l" comprende sempre . e .. quindi tutte le dir hanno almeno 2 sottodir e siccome la richiesta è di trovare quelle che hanno meno di 5 sottodir considero quelle che ne hanno da 2 a 6

Last edited by alexn1 on 20-07-2008 at 16:42

20-07-2008 16:06
Click Here to See the Profile for alexn1 Click here to Send alexn1 a Private Message Find more posts by alexn1 Add alexn1 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

cavoli perfetto

senti e riguardo al cut non mi sai dire nulla, come se scrivo semplicemente cut -f 12 funziona male, mi stampa le prime colonne con i permessi e basta..

ma il cut che hai scritto adesso cosa fa?? io ho eseguito questo comando find / -type d | xargs ls -ld | tr -s ' ' ' ' | cut -f 2,9 -d ' '
ma non noto differenze..cosa taglia??

ultima cosa, quanto ci mette ad eseguire il comando..a me è svenuto..:)

20-07-2008 16:58
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
alexn1
Dott.

User info:
Registered: Oct 2004
Posts: 71 (0.01 al dì)
Location: Milano
Corso: Informatica (sera)
Anno: Finito!
Time Online: 2 Days, 6:14:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Il cut mi ha fatto dannare un bel po'...
Allora la cosa più importante è il delimitatore che gli specifichi (-d) perchè in base a quello lui seleziona i campi che gli chiedi (-f). Il tr che viene eseguito prima è fondamentale perchè ti sostituisce tutti gli spazi consecutivi (-s) con un solo spazio e siccome uso lo spazio come delimitatore del cut bisogna che ce ne sia soltanto uno tra un campo e l'altro altrimenti l'output non risulta corretto.

Prova per esempio a lanciare un ls -l e dopo prova ls -l | tr -s ' ' ' ' (solo per chiarire il comando è tr -s '(spazio)' (spazio) '(spazio)')

A questo punto prova a selezionare i campi usando prima il tr vedrai che il cut lavora correttamente...

Spero di essermi spiegato chiaramente

20-07-2008 17:08
Click Here to See the Profile for alexn1 Click here to Send alexn1 a Private Message Find more posts by alexn1 Add alexn1 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si dovrei aver capito, proverò grazie tante

20-07-2008 17:25
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

una cosa ragazzi, io sulla parte kernel non so nulla, vorrei sapere una volta che sono riuscito a modificare il/i file, quali sono i procedimenti per ricomplilare in maniera corretta..

21-07-2008 14:09
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ste182
.arcimaestro.

User info:
Registered: Oct 2004
Posts: 258 (0.03 al dì)
Location:
Corso: informatica
Anno:
Time Online: 2 Days, 5:06:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

raga non ho capito una piccola cosa:

il processo che occupa più memoria:
ps -ef | sort -n + 7 | tail -1

non capisco il +7 che cazzzzz*** centra ahahaha

ps -ef lista tutti i processi, sort -n li ordina in modo crescente e tail -1 mi da l'ultimo elemento... ma il 7 da dove esce??

__________________
Live Fast, Die Fun

21-07-2008 15:28
Click Here to See the Profile for ste182 Click here to Send ste182 a Private Message Find more posts by ste182 Add ste182 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.08 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

il 7 se non mi sbaglio è la colonna size..vengono ordinati in base alla size


per la mia domanda mi rispondo da solo; ho visto che a pagina 3 è spiegato tutto..:D

anzi mi servirebbe una precisazione, quando capisco di aver modificato una libreria e quindi fare make libraries??

Last edited by Gehur on 21-07-2008 at 16:12

21-07-2008 15:39
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
jaguaro
.consigliere.

User info:
Registered: Jun 2006
Posts: 108 (0.02 al dì)
Location: Milano
Corso: STCM
Anno:
Time Online: 11:05:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Una mia soluzione per trovare tutte le dir che abbiano meno di 5 sottodirs:
file dirs.sh

code:
#!/bin/sh echo "Script per stampare le dir che hanno meno di 5 sottodir"; for dir in $(find / -type d); do ls -F -1 $dir | grep '/' | wc -w > a.tmp if [ $(cat a.tmp) -lt 6 ]; then echo $dir; cat a.tmp; else echo ''; fi; rm a.tmp; done;

__________________
Carlo Boni
Rappresentante Studenti
Sinistra Universitaria

22-07-2008 11:25
Click Here to See the Profile for jaguaro Click here to Send jaguaro a Private Message Visit jaguaro's homepage! Find more posts by jaguaro Add jaguaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 12:26.    Post New Thread    Post A Reply
Pages (39): « First ... « 19 20 21 22 [23] 24 25 26 27 » ... Last »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.050 seconds (77.60% PHP - 22.40% MySQL) con 26 query.