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
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

Metti uno spazio prima e dopo il piu

count=$(expr $count + 1)

dovrebbe andare è solo questione di spazi

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 16:10
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

ho visto sul wiki l'es per trovare i tre utenti che occupano più spazio sul sistema...ma non mi convince...non esiste una maniera più semplice?io col du ho provato...il problema è ke lo spazio occupato dai file di ogni utente è sempre lo stesso...anche per utenti con 4 file scarsi...
qualche idea in merito???

14-01-2009 18:35
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
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..ho provato a fare come mi hai detto..cioè
a mettere tutti e 2 i for in file di nn va
allora ho provato a fare il secondo senza for
find / -type f | xargs file | grep executable | cut -d : -f 1 | xargs wc -l | sort -n | tail -3 | head -1
il problema è che appena metto il sort è lo faccio partire mi da per ogni file wc nnot open ...
invece se nn metto il sort nn da questo problema..
pero a me il sort rve per forza perke devo prendere quello maggiore..
lo da anche a te qst errore??

14-01-2009 20:40
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

il cannot open te lo da sui file protetti credo :D

infatti ho provato a lasciare andare e vedo mille wc cannot open e dopo quelli ci sono altri file con la lunghezza corretta...l'unica cosa è che con il sort li vedi tutti all'inizio :D

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 20:56
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

scusami..è vero..l'ho notato ora..

14-01-2009 21:02
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
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

java..
per ora ho provato il comando da solo e va..ora lo provo nel programma..ma a me funziona gia mettendo sort -n | tail -1 senza fare anche tail3 | head -1..non so..

14-01-2009 21:17
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

eh allora il tail -3 head -1 lo avevo fatto perchè il wc tira fuori anche i totali di non so cosa e me li ritrovavo alla fine della lista, sarebbe stato piu corretto filtrare le righe che non contenevano ' total' per dire

boh
io sono in ansia per venerdi comunque...è il mio ultimo esame e c'è in gioco molto...

__________________
io Sofort e te che sei? un pupazzo?

14-01-2009 21:30
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

ifnatti..gli ultimi file si chiamano total..ma dici quindi non sono file??e cosa sono?
stessa cosa per ..se non lo passo devo rifare tutto..
ufff

14-01-2009 21:52
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

per ogni utente trovare il processo che occupa piu spazio in memoria

#!/bin/sh
echo $(cat /etc/passwd | cut -d ' ' -f 3) > utenti.txt
echo "" > processi.txt
for uid in $(cat utenti.txt);do
echo "$uid -> $(ps -axl| tr -s ' ' ' ' | cut -d ' ' -f 4, 8-15 | grep "^$uid"|cut -d ' ' -f 2-8 | sort -n | tail -1)" >> processi.txt
done;
cat processi.txt



Trovare i tre utenti che occupano piu spazio sul sistema

#!/bin/sh
echo "" > utentisize.txt
echo $(cat /etc/passwd | cut -d ':' -f 3) > utenti.txt
for uid in $(cat utenti.txt);do
echo $(find / -type f -user $uid | xargs du -s | cut -f 1) > file utente.txt
SOMMA=0
for dim in $(cat fileutente.txt);do
SOMMA=$(expr $SOMMA + $dim)
done;
echo "$uid $SOMMA" >> utentisize.txt
done;
cat utentisize.txt | sort +1 | tail -3

__________________
io Sofort e te che sei? un pupazzo?

Last edited by Java on 15-01-2009 at 10:18

15-01-2009 09:24
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
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

Originally posted by f3d386
ho visto sul wiki l'es per trovare i tre utenti che occupano più spazio sul sistema...ma non mi convince...non esiste una maniera più semplice?io col du ho provato...il problema è ke lo spazio occupato dai file di ogni utente è sempre lo stesso...anche per utenti con 4 file scarsi...
qualche idea in merito???


prova a postare la soluzione che hai provato, che ci guardiamo

__________________
io Sofort e te che sei? un pupazzo?

15-01-2009 09:25
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..
quello delle righe l'ho risolto fialmente..come dicevi tu..quindi invece di fare un secondo for ho fatto un comando unico..
mi è venuto un dubbio:
c'è qualche comando che mi dice di che utente è un determinato file?
cioè ad es: trovare il file piu grosso del sistema e dire di che utente è..??

15-01-2009 11:40
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

si si

l'ho scoperto ieri notte

è il comando stat con il parametro -uid

oppure soluzione piu complicata, passare dal ls -l e agire di cut e mille balle

riesci a postare il tuo esercizio delle righe completo e funzionante ?

__________________
io Sofort e te che sei? un pupazzo?

Last edited by Java on 15-01-2009 at 11:57

15-01-2009 11:51
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..scusa se ti rispondo ora ma oggi ero fuori..la mia sol. funzionante è:
for uid in $(cat /etc/passwd | cut -d ':' -f 3 | sort -n | uniq ); do
echo "utente $uid"
find / -type f -user $uid | xargs file | grep -v 'executable' |cut -d ':' -f 1 | xargs wc -l | grep -v 'total' | sort -nr | head -1
done

#come hai visto nel find ho fatto il grep su total xke ogni tot stampa a video le righe totali di tutti i file e quindi le tolgo

15-01-2009 18:12
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
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

guarda questo:
calcolare lo spazio occupato da un utente ( dai suoi files)
questo è quello che ho fatto io:

procsize=0
sum=0
for uid in $(cut etc/passwd -d ':' -f 3 | sort -n | uniq); do
echo "utente $uid"
for procsize in $(find / -type f -user $uid | xargs du | cut -f 1); do
sum=$(expr $sum + $procsize)
done
echo "$sum"
sum=0
done


essendoci 2 for mi da out of space..ho provato a metterli nei file ma da lo stesso errore..
tu riesco a trovare una soluzione?

15-01-2009 18:18
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

guarda che poco sopra cè una soluzione funzionante per Trovare i tre utenti che occupano piu spazio sul sistema

basta togliere l'ultima istruzione :P

__________________
io Sofort e te che sei? un pupazzo?

15-01-2009 18:44
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
All times are GMT. The time now is 06:38.    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.042 seconds (82.36% PHP - 17.64% MySQL) con 26 query.