Copyright(c) by Galaxy CD – http://www.galaxycd.com
22
$
ls
-l
appli
total 1
-rw-rw-r-- 2 user2 stagiair
71
Apr
5
17:05 file1
$
ls
-l
file.link
total 1
-rw-rw-r-- 2 user2 stagiair
71
Apr
5
17:05 file.link
4.4 Tìm kieám moät file
Leänh
find
cho pheùp tìm moät hay nhieàu file trong caây thö muïc. Ta coù theå:
-
Tìm theo teân:
$
find ñöôøng_daãn -name teân_file -print
-
Tìm theo soá i-node (i-num) cuûa file:
$
find ñöôøng_daãn -inum number -print
-
Tìm theo teân ngöôøi sôû höõu:
$
find pathname -user username -print
Ñeå traùnh caùc thoâng baùo loãi ñöa ra maøn hình, ta coù theå ñoåi höôùng ñaàu ra loãi chuaån
(standard error) tôùi moät file khoâng (/dev/null)
$
find / -name filename -print 2> /dev/null
Thí duï:
$
pwd
/users/user1
$
find / -name ttyc2d1 -print 2> /dev/null
/dev/ttyc2d1
$
ls -i /unix
2810 -r-xr--r-- 2
bin
bin
508516 Mar 10
1989 /unix
$
find / -inum 2810 -print 2> /dev/null
/unix
/makesys/root/unix
$
pwd
/users/user1
$
find /users -user -user1 -print
/users/user1
/users/user1/res1
/users/user1/res