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 Laboratorio Gennaio
Pages (4): « 1 [2] 3 4 »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
wizard
.artista.

User info:
Registered: Jan 2007
Posts: 18 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 4:02:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Rettifico, funziona anche con: tail -3 :-D

13-01-2009 15:41
Click Here to See the Profile for wizard Click here to Send wizard a Private Message Find more posts by wizard Add wizard to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
wizard
.artista.

User info:
Registered: Jan 2007
Posts: 18 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 4:02:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per trovare i file di testo il metodo che avrei utilizzato è quello.

Cercando in internet ho visto che si può anche usare quest'altro metodo:

test -x nome_file

che restituisce 0 se il file è eseguibile. Si tratta quindi di negare la condizione

13-01-2009 15:51
Click Here to See the Profile for wizard Click here to Send wizard a Private Message Find more posts by wizard Add wizard to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho provato il comando test ma non riesco a utilizzarlo boh

__________________
io Sofort e te che sei? un pupazzo?

13-01-2009 17:53
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
wizard
.artista.

User info:
Registered: Jan 2007
Posts: 18 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 4:02:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Svelato il mistero del comando: test -x <file>

si riferisce al permesso di esecuzione del file (i flag: rwx per intenderci)
Infatti se prendi un file qualsiasi e gli imposti il chmod +x, il file risulta OK a test -x

Quindi non va bene. La soluzione al momento rimane il comando: file

13-01-2009 20:56
Click Here to See the Profile for wizard Click here to Send wizard a Private Message Find more posts by wizard Add wizard to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

perfetto. grazie mille e già che ci siamo e ti vedo molto esperto, riesci a illuminarmi sul SUID?
e poi tu come risolveresti
"Per ogni utente trovare il processo che occupa piu memoria"
"per ogni utente calcolare il numero dei processi attivi e dire l'utente che ne ha di piu"

sono un po in difficolta su questi

__________________
io Sofort e te che sei? un pupazzo?

13-01-2009 21:23
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
francescoo
.primate.

User info:
Registered: Feb 2008
Posts: 75 (0.01 al dì)
Location: novara
Corso: informatica
Anno: secondo
Time Online: 20:29:29 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ciao java..
ieri sera non riuscivo ad accedere al dsy..
ma la procedura che hai scritto te per trovare il file di testo con piu righe per ogni utente l'hai provata e funziona?
perchè a me da comunque out of space...

14-01-2009 07:30
Click Here to See the Profile for francescoo Click here to Send francescoo a Private Message Find more posts by francescoo Add francescoo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

la versione che ho scritto da out of space anche a me

perchè io pirla non ho messo anche il secondo for in un file

oppure al posto del secondo for utilizza il comando che ti ho messo
find / -type f | xargs file | grep executable | cut -d : -f 1 | xargs wc -l | sort -n | tail -3 | head -1

secondo me funziona anche cosi

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 11:12
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
wizard
.artista.

User info:
Registered: Jan 2007
Posts: 18 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 4:02:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per quanto riguarda SUID so solo che è l'owner del file.

Per quanto riguarda:
"Per ogni utente trovare il processo che occupa piu memoria"
...mi risulta molto laborioso.

Con le mie conoscenze la vedo come:

1. legger il contenuto di: ps -alx
2. ordinarlo sul campo UID (campo 3): sort +3 -n
3. scorrere il risultato ottenuto riga per riga (comando sed - sintassi piuttosto incasinata) memorizzando lo user corrente ed estraendo ogni volta la dimensione del processo per fare un confronto con l'ultima dim. letta.

Piuttosto laborioso. Non ho trovato soluzioni più semplici (spero ce ne siano)

14-01-2009 12:49
Click Here to See the Profile for wizard Click here to Send wizard a Private Message Find more posts by wizard Add wizard to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
francescoo
.primate.

User info:
Registered: Feb 2008
Posts: 75 (0.01 al dì)
Location: novara
Corso: informatica
Anno: secondo
Time Online: 20:29:29 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ciao java..adesso provo quello che mi hai detto..ma xke metti tail -3 e poi head -1
non capisco prendi prima gli ultimi 3 e poi di questi prendi il primo?

14-01-2009 13:10
Click Here to See the Profile for francescoo Click here to Send francescoo a Private Message Find more posts by francescoo Add francescoo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

x' il comando wc alla fine mette anche il totale a quanto ho notato..e con quel comando che avevo provato me ne tirava fuori due di totali che veramente non capivo..quindi prendo gli ultimi tre
ultimo file, totale1, totale2
e prendo solo il primo cioè il file...

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 13:16
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
f3d386
.primate.

User info:
Registered: Oct 2005
Posts: 79 (0.01 al dì)
Location: Milano
Corso: Sicurezza Informatica
Anno: 1
Time Online: 6:36:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

scusate la domanda probabilmente stupida ma...
all'inizio di ogni script bisogna mettere #!/bin/bash o #!/bin/sh ??? e ke differenza c'è tra i due?

14-01-2009 13:41
Click Here to See the Profile for f3d386 Click here to Send f3d386 a Private Message Find more posts by f3d386 Add f3d386 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io uso #!/bin/sh

non so la differenza e non credo sia fondamentale :D

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 14:36
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
f3d386
.primate.

User info:
Registered: Oct 2005
Posts: 79 (0.01 al dì)
Location: Milano
Corso: Sicurezza Informatica
Anno: 1
Time Online: 6:36:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ah ok...ah scusami ancora...ma se volessi mettere i risultati di un echo in un file...
ho pensato di fare echo $i >> file.txt
ma se eseguo lo script più di una volta dentro troverò dei doppioni...come faccio a far sì che ogni volta che eseguo lo script il file sia sovrascritto?

14-01-2009 15:17
Click Here to See the Profile for f3d386 Click here to Send f3d386 a Private Message Find more posts by f3d386 Add f3d386 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Java
Informato

User info:
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

il >> inserisce in coda
il > scrive il file da zero

mentre se vuoi salvare tutti i dati e visualizzare i dati presi una sola volta usi il >> e fai cat file.txt | uniq

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 15:42
Click Here to See the Profile for Java Click here to Send Java a Private Message Find more posts by Java Add Java to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
f3d386
.primate.

User info:
Registered: Oct 2005
Posts: 79 (0.01 al dì)
Location: Milano
Corso: Sicurezza Informatica
Anno: 1
Time Online: 6:36:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

grazie mille...l'ultima cosa...mi spieghi perchè nello script seguente non funziona la parte count=$(($count +1)) ??

#!/bin/bash

trovati=$(find / ! -type d -mtime -X)
count=0

for myFile in $trovati; do
echo $myFile
count=$(($count+1)) ------> mi stampa tipo 0+1+1+1+1+ ma nn la somma totale
done

echo $count

14-01-2009 15:47
Click Here to See the Profile for f3d386 Click here to Send f3d386 a Private Message Find more posts by f3d386 Add f3d386 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 23:12.    Post New Thread    Post A Reply
Pages (4): « 1 [2] 3 4 »   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.323 seconds (69.07% PHP - 30.93% MySQL) con 23 query.