$ groups jacques $ su - Password: # groups root bin daemon sys adm disk wheel
$ grep david /etc/passwd david:*:500:100:David Jones:/home/david:/bin/bash
$ id uid=500(david) gid=100(users) groups=100(users) $ id root uid=0(root) gid=0(root) groups=0(root),1(bin), 2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy)
$ alo command not found $ ./alo Alo jacques $ PATH=$PATH:. $ alo Alo jacques
$ ps PID TTY TIME CMD 667 pts/0 00:00:00 bash 893 pts/0 00:00:00 ps $ ps x PID TTY STAT TIME COMMAND 592 tty1 SW 0:00 [bash] 603 tty1 SW 0:00 [startx] 610 tty1 SW 0:00 [xinit] 615 tty1 S 0:00 /usr/bin/gnome-session ..... some output deleted here... 667 pts/0 S 0:00 bash 669 tty1 SW 0:00 [gnome-pty-helpe] 670 pts/1 SW 0:00 [bash] 671 tty1 SW 0:00 [gnome-pty-helpe] 672 pts/2 SW 0:00 [bash] 675 tty1 SW 0:00 [gnome-pty-helpe] 676 tty1 SW 0:00 [gnome-pty-helpe] 677 tty1 SW 0:00 [gnome-pty-helpe] 678 pts/3 S 0:00 bash 679 pts/4 S 0:00 bash 680 pts/5 SW 0:00 [bash] 688 tty1 S 1:42 /home/david/Office51/bin/soffice.bin 707 tty1 S 0:41 /usr/lib/netscape/netscape-communicator -irix-session 720 tty1 S 0:00 (dns helper) 721 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 722 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 723 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 724 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 725 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 727 tty1 S 0:00 /home/david/Office51/bin/soffice.bin 795 pts/3 S 0:00 vi TODO 835 tty1 S 0:26 gtop 924 pts/0 R 0:00 ps x
$ 10:56am up 1:21, 7 users, load average: 1.32, 0.80, 0.41 95 processes: 92 sleeping, 2 running, 1 zombie, 0 stopped CPU states: 15.0% user, 3.6% system, 0.0% nice, 81.3% idle Mem: 127948K av, 124496K used, 3452K free, 58884K shrd, 2888K buff Swap: 72252K av, 21956K used, 50296K free 34528K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 974 david 12 0 428 428 348 R 0 79.0 0.3 4:00 yes 977 david 7 0 1044 1044 816 R 0 10.6 0.8 0:00 top 835 david 1 0 3912 3912 2876 S 0 9.7 3.0 1:55 gtop 611 root 0 0 34468 32M 1620 S 0 0.8 25.8 3:00 X 1 root 0 0 124 72 52 S 0 0.0 0.0 0:04 init 2 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kflushd 3 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kupdate 4 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kpiod 5 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kswapd 6 root -20 -20 0 0 0 SW< 0 0.0 0.0 0:00 mdrecoveryd 253 bin 0 0 80 0 0 SW 0 0.0 0.0 0:00 portmap 269 root 0 0 380 368 324 S 0 0.0 0.2 0:00 apmd 322 root 0 0 200 148 104 S 0 0.0 0.1 0:00 syslogd 333 root 0 0 504 160 112 S 0 0.0 0.1 0:00 klogd 349 daemon 0 0 144 104 76 S 0 0.0 0.0 0:00 atd 365 root 0 0 240 188 144 S 0 0.0 0.1 0:00 crond 380 root 0 0 140 0 0 SW 0 0.0 0.0 0:00 cardmgr
$ yes > /dev/null & [4] 1187 $ yes > /dev/null & [4] 1188 $ yes > /dev/null & [4] 1189 $ ps a PID TTY STAT TIME COMMAND 678 pts/3 S 0:00 bash 1187 pts/3 R 0:13 yes 1188 pts/3 R 0:11 yes 1189 pts/3 R 0:11 yes 1190 pts/3 R 0:00 ps a $ kill 1187 $ ps a PID TTY STAT TIME COMMAND 678 pts/3 S 0:00 bash 1188 pts/3 R 0:40 yes 1189 pts/3 R 0:39 yes 1193 pts/3 R 0:00 ps a [2] Terminated yes >/dev/null
Tipo |
Significado |
- |
normal |
d |
diretório |
l |
ligação simbólica |
b |
dispositivo especial bloco |
c |
dispositivo especial caractere |
p |
pipe |
Operação |
Efeito num arquivo |
Efeito num diretório |
read |
ler conteúdo do arquivo |
examinar diretório (ls -l) |
write |
alterar arquivo ou adicionar informação |
criar ou remover arquivo de um diretório |
execute |
habilidade de executar um programa |
acessar arquivo num diretório |
$ chmod u+rwx temp.dat adicionar permissão rwx para o dono do arquivo (mantendo demais permissões) $ chmod go-rwx temp.dat remover todas as permissões para grupo e outros $ chmod -R a-rwx /etc remover todas as permissões recursivamente $ chmod 770 temp.dat atribui permissões rwxrwx---
$ $ chown david /home/david $ chown -R root / $ chown david.users /home/david altera dono para david e grupo para users $ chgrp users /home/david
$ ln /etc/passwd passwd $ ln /etc/passwd fred $ ls -il * /etc/passwd 308647 -rw-r--r-- 3 root root 681 Jan 3 08:37 /etc/passwd 308647 -rw-r--r-- 3 root root 681 Jan 3 08:37 fred 308647 -rw-r--r-- 3 root root 681 Jan 3 08:37 passwd
$ find /etc /usr/share -name magic -o -name passwd /etc/passwd /etc/pam.d/passwd /etc/uucp/passwd /usr/share/magic $ find . ./iAm ./iAm.c ./parameters ./numbers ./pass ./func ./func2 ./func3 ./pattern ./Adirectory ./Adirectory/oneFile $ find . -user david achar todos os arquivos de david abaixo do diretório corrente $ find / -name \*.html achar todos os arquivos com terminação .html $ find /home -size +2500k -mtime -7 achar arquivos grandes modificados recentemente $ find . -exec grep hello \{\} \; fazer grep em todos os arquivos $ find / -name \*.bak -ok rm \{\} \; perguntar se usuario quer remover cada um dos arquivos terminando em .bak