|
|
|
¸®´ª½ºÆÁ Go Unix Power Tools Online Book
Go Bash Guide
|
|
Read No. 125 article |
2002-03-10 02:29:11 |
|
|
|
|
NickName |
Ç®ºñ´© [ȨÆäÀÌÁö] |
Subject |
[ÆÁ] find + xargs + ls ¸í·É¾î ¸î°¡Áö È°¿ë |
|
|
¿øº» : http://www.linuxchannel.net/docs/find-xargs-ls.txt
[ÆÁ] find + xargs + ls ¸í·É¾î ¸î°¡Áö È°¿ë
ÀÛ¼ºÀÚ : ±èÄ¥ºÀ <san2 at linuxchannel.net>
ÀÛ¼ºÀÏ : 2001.03.12
¸ñÂ÷
1. °¡Àå ÀϹÝÀûÀÎ find ¸í·É¾î
2. find ¸í·É¾î ÀϹÝÀûÀÎ ¿É¼Ç
2-1. »ç¿ë¹ý °³¿ä
2-2. ÀϹÝÀûÀ¸·Î Ç¥Çö½Ä ¿É¼Ç ±¸ºÐ
3-3. ÀÚÁÖ »ç¿ëµÇ´Â Ç¥Çö½Ä ¿É¼Ç
3-4. path(find ¸í·É¾î ´ÙÀ½ÀÇ path)
3-5. Ç¥Çö½Ä-¿¬»êÀÚ
3. ¿¹Á¦
3-1. ´Ù¸¥ ¸í·É¾î¿Í °áÇÕÇüÅÂ(ls,xargs)
3-2. ÆÛ¹Ì¼Ç °ü·Ã ¿¹Á¦
3-3. À¯Àú¿Í °ü·ÃµÈ ¿¹Á¦
3-4. ÆÁ
- ÃÖ±Ù ÇÏ·ç(1) µ¿¾È(-)¿¡ º¯°æ(change)µÈ ÆÄÀÏÀ» ãÀ»·Á¸é(-ctime)?
- ¿À·¡µÈ ÆÄÀÏÀ» ãÀ»·Á¸é(30ÀÏ ÀÌ»ó ¼öÁ¤(modify))µÇÁö ¾ÊÀº)?
- ÃÖ±Ù 30ÀÏ(30) ¾È¿¡(-) Á¢±Ù(access)ÇÏÁö ¾ÊÀº ÆÄÀÏ°ú µð·ºÅ丮¸¦ ¸®½ºÆ®
·Î ¸¸µé·Á¸é(-atime)?
- ÀÚ½ÅÀÇ È¨µð·ºÅ丮¿¡¼ ¸¸ °Ë»öÇÏ·Á¸é?
- ¼ºê µð·ºÅ丮·Î ³»·Á°¡Áö ¾Ê°í ÇöÀç µð·ºÅ丮¿¡¼¸¸ °Ë»öÇÏ·Á¸é?
- ƯÁ¤ À¯Àú(foobar) ¼ÒÀ¯ÀÇ ÆÄÀÏÀ» ãÀ»·Á¸é?
- Æ۹̼ÇÀÌ 777ÀÎ ÆÄÀÏÀ» ãÀ»·Á¸é ?
- others¿¡°Ô ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
- others¿¡°Ô ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀ» ã¾Æ ¾²±â ±ÇÇÑÀ» ¾ø¾Ö·Á¸é?
- À¯ÀúÀ̸§°ú ±×·ìÀ̸§ÀÌ ¾ø´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
- ºó ÆÄÀÏÀ» ãÀ»·Á¸é?
- ÆÄÀÏÅ©±â°¡ 100M ÀÌ»óµÈ ÆÄÀÏÀ» ãÀ»·Á¸é?
- *.bak ÆÄÀÏÀ» ã¾Æ Áö¿ï·Á¸é?
- *.bak ÆÄÀÏÀ» ã¾Æ ƯÁ¤ µð·ºÅ丮·Î ¿Å±æ·Á¸é?
- µð·ºÅ丮 ¸¸ ãÀ»·Á¸é?
- root±ÇÇÑÀ¸·Î ½ÇÇàµÇ´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
- ´Ù¸¥ ÆÄÀϽýºÅÛÀ» °Ë»öÇÏÁö ¾ÊÀ»·Á¸é?
- ÆÄÀÏÀ̸§¿¡ °ø¹éÀÌ µé¾î°£ ÆÄÀÏÀ» ãÀ»·Á¸é?
- ¼û°ÜÁø(hidden) ÆÄÀÏÀ» ãÀ»·Á¸é?
- °°Àº À̸§À» °¡Áø µð·ºÅ丮¸¦ ãÀ»·Á¸é?
- À߸øµÈ ¸µÅ©¸¦ ãÀ»·Á¸é?
4. find ¸í·É¾î¿¡ ´ëÇؼ Á»´õ ¾Ë¾Æº¸·Á¸é?
------------------------------------------------------------
1. °¡Àå ÀϹÝÀûÀÎ find ¸í·É¾î
# find /path -name "foobar" -print
Á¦ÀÏ ¸ÕÀú(?) ¹è¿ì´Â Çü½ÄÀÌ ¾Æ´Ñ°¡ ½±±º¿ä.
2. find ¸í·É¾î ÀϹÝÀûÀÎ ¿É¼Ç
2-1. »ç¿ë¹ý °³¿ä
find ¸í·É¾î »ç¿ë¹ý º¸±â :
# find --help
# man find (Á÷Á¢ ÀÔ·ÂÇØ º¸¼¼¿ä. ³»¿ëÀÌ ³Ê¹« ¸¹¾Æ¼..)
»ç¿ë¹ý : find [path...] [expression]
±âº»°ª : default path´Â ÇöÀç µð·ºÅ丮; default expressionÀº -print
Ç¥Çö½Ä(expression) ±¸¼º :
operators (decreasing precedence; -and is implicit where no others are
given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
options (always true): -daystart -depth -follow --help
-maxdepth LEVELS -mindepth LEVELS -mount -noleaf --version -xdev
tests (N can be +N or -N or N):
-amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -ipath PATTERN -iregex
PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-size N[bckw] -true -type [bcdpfls] -uid N -used N -user NAME
-xtype [bcdpfls]
actions:
-exec COMMAND ; -fprint FILE -fprint0 FILE -fprintf FILE FORMAT
-ok COMMAND ; -print -print0 -printf FORMAT -prune -ls
°£´ÜÇÏ°Ô ¸î°¡Áö¸¸ ¾Ë¾Æº¸ÁÒ...
(ÀÚ¼¼ÇÑ »ç¿ë¼³¸íÀº ²À man ÆäÀÌÁö¸¦ Àо¼¼¿ä....ÇѱÛÀº ¾ø±º¿ä..T.T)
2-2. ÀϹÝÀûÀ¸·Î Ç¥Çö½Ä ¿É¼Ç ±¸ºÐ
-a'xxxx'
'xxxx'¿¡ ´ëÇÑ Access(Á¢±Ù)
-c'xxxx'
'xxxx'¿¡ ´ëÇÑ Changes(º¯°æ), ¸¶Áö¸·À¸·Î AccessÇÑ °æ¿ì
º¯°æµÊ
-m'xxxx'
'xxxx'¿¡ ´ëÇÑ Modify(¼öÁ¤), ÆÄÀϳ»¿ë ÀÚü ¼öÁ¤ÇÑ °æ¿ì
-i'xxxx'
'xxxx'(inum Á¦¿Ü)¿¡ ´ëÇÑ Insensitive(´ë¼Ò¹®ÀÚ ±¸ºÐ¾ø
ÀÌ)
3-3. ÀÚÁÖ »ç¿ëµÇ´Â Ç¥Çö½Ä ¿É¼Ç
N
Á¤È®ÇÏ°Ô N°ú ÀÏÄ¡
+N
N º¸´Ù Å« °æ¿ì
-N
N º¸´Ù ÀÛÀº °æ¿ì
-name PATTERN
PATTERN¿¡ ÀÏÄ¡ÇÏ´Â ÆÄÀÏ Ã£±â, ¿ÍÀϵåÄ«µå ¹®ÀÚ »ç¿ë°¡´É
-iname PATTERN
PATTERN¿¡ ÀÏÄ¡ÇÏÁö ¾ÊÀº(insensitive) ÆÄÀÏ Ã£±â
-perm [+-]mode
PERMission('mode')¿¡ ÇØ´çµÇ´Â ÆÄÀÏ Ã£±â, ls¿Í °áÇÕ °¡
´É
-type [bcdpfls]
b(ºí·°ÆÄÀÏ), c(ƯÁ¤ ¹®ÀÚ), d(µð·ºÅ丮), p(ÆÄÀÌÇÁ),
f(Á¤±ÔÇ¥Çö ÀϹÝÆÄÀÏ), l(¸µÅ©), s(¼ÒÄÏ) À¯ÇüÀÇ ÆÄÀÏ Ã£
±â
-size N[bckw]
ÆÄÀÏ Å©±â°¡ N ÀÎ ÆÄÀÏ Ã£±â
b(ºí·°-±âº»°ª), c(bytes), k(kbytes),
w(2¹ÙÀÌÆ® ´Ü¾î)
-user NAME
NAMEÀº À¯ÀúÀ̸§À̰ųª UID
-atime N
N*24 ½Ã°£ µ¿¾È¿¡ Access ÇÑ ÆÄÀÏ
-ctime N
N*24 ½Ã°£ µ¿¾È¿¡ Changes ÇÑ ÆÄÀÏ(³»¿ë¼öÁ¤ÀÌ ¾Æ´Ï°í ÀÐ
±â¸ðµåµµ ChangesµÊ)
-mtime N
N*24 ½Ã°£ µ¿¾È¿¡ Modify ÇÑ ÆÄÀÏ
-empty
ÆÄÀÏÀÌ ºñ¾î ÀÖ°í(0 bytes), Á¤±Ô½Ä ÆÄÀÏÀ̰ųª µð·ºÅ丮
-newer FILE
FILE º¸´Ù ÃÖ±Ù¿¡ °»½ÅµÈ ÆÄÀÏ
-path PATTERN
path°¡ PATTERN°ú ÀÏÄ¡ÇÏ´Â path¿¡ ´ëÇؼ °Ë»ö
-regex PATTERN
ÆÄÀÏÀ̸§ÀÌ PATTERN¿¡ ÀÏÄ¡ÇÏ´Â Á¤±Ô½Ä¿¡ ´ëÇؼ °Ë»ö
-inum N
inode NÀ» °®´Â ÆÄÀÏ
-nouser,-nogroup
USER³ª GROUP¿¡ À̸§ÀÌ ¾ø´Â ÆÄÀÏ °Ë»ö(UID,GID¸¸ ÀÖ´Â ÆÄ
ÀÏ)
-exec COMMAND
°Ë»öµÈ ÆÄÀÏÀ» ãÀ¸¸é COMMAND ¸í·ÉÀ» ½ÇÇàÇÑ´Ù.
COMMAND ÀÎÀÚ(°Ë»öµÈ ÆÄÀÏ)´Â {}À¸·Î »ç¿ëÇϸç,
À̶§ COMMAND ³¡Àº \;(;ÀÌ ¾Æ´Ô)À» »ç¿ëÇØ¾ß ÇÑ´Ù. Áï ¸í
·É±¸ºÐ
¹®ÀÚÀÎ ';'À» Å»Ãâ(\)½ÃÄÑÁà¾ß ÇÑ´Ù.
-ok COMMAND
-exec COMMAND¿Í °°Áö¸¸ COMMAND¸¦ ½ÇÇàÇϱâ Àü¿¡ È®ÀÎÀ»
¿äûÇÑ´Ù.
3-4. path(find ¸í·É¾î ´ÙÀ½ÀÇ path)
.
ÇöÀç µð·ºÅ丮(±âº»°ªÀ̹ǷΠ»ý·«Çصµ µÊ)
`pwd`
ÇöÀç µð·ºÅ丮¿Í °áÇÕ(?) `Àº ~¹®ÀÚ°¡ ÀÖ´Â ÀÚÆÇ
$(pwd)
À§ÀÇ `pwd`¿Í °°°Å³ª ºñ½ÁÇÔ
/
ÃÖ»óÀ§ ·çÆ® µð·ºÅ丮¿¡¼ ÇÏÀ§ ¸ðµç µð·ºÅ丮
/home
ƯÁ¤ /home µð·ºÅ丮¿¡¼ ÇÏÀ§ ¸ðµç µð·ºÅ丮
/{usr,home/{aaa,san2},var}
/usr, /usr/home/aaa /usr/home/san2 /var
3-5. Ç¥Çö½Ä-¿¬»êÀÚ
\( Ç¥Çö½Ä \)
'Ç¥Çö½Ä'À» ¿ì¼±ÀûÀ¸·Î ¸ÕÀú ¼öÇà
(¿Í )¾Õ¿¡ \¸¦ ³Ö¾î¾ß Çϸç, 'Ç¥Çö½Ä'°ú °ø¹éÀ» °¢°¢ µÐ
´Ù.
\( A + B \) * \( C + D \) ¿Í °°ÀÌ \(, \)¾ÈÀ» ¿ì¼±ÀûÀ¸
·Î ¼öÇà
! Ç¥Çö½Ä , -not Ç¥Çö½Ä
'Ç¥Çö½Ä'À» ºÎÁ¤
Ç¥Çö½Ä1 -a Ç¥Çö½Ä2, Ç¥Çö½Ä1 -and Ç¥Çö½Ä2
Ç¥Çö½Ä1°ú Ç¥Çö½Ä2ÀÇ AND ¿¬»ê
Ç¥Çö½Ä1 -o Ç¥Çö½Ä2, Ç¥Çö½Ä1 -or Ç¥Çö½Ä2
Ç¥Çö½Ä1°ú Ç¥Çö½Ä2ÀÇ OR ¿¬»ê
3. ¿¹Á¦
3-1. ´Ù¸¥ ¸í·É¾î¿Í °áÇÕ ÇüÅÂ(ls,xargs)
ã´Â °Í ±× Â÷ü ¸¸À¸·Î ¸¸Á·(?) ÇÒ ¼ö µµ ÀÖÁö¸¸ ±× °á°ú¿¡ ´ëÇؼ
¾î¶² Çൿ(Actions)À» ÃëÇÒ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù.
ÇüÅÂ1. -exec ÀÌ¿ë½Ã
# find ..... -exec COMMAND {} \;
ÇüÅÂ2. xargs ¸í·É¾î·Î Ç¥ÁØ ÀÔ·Â¹Þ¾Æ COMMAND ¼öÇà
# find ..... | xargs COMMAND
ÇüÅÂ3. ls ¸í·É¾î·Î ÃÖÁ¾ °á°ú Ãâ·Â
# ls -l `find .....[COMMAND]`
¶Ç´Â
# find .... ls
(ls´Â ls -dils¿Í °°À½)
xargs
xargs rpm Á¤º¸º¸±â
# rpm -qi `rpm -qf $(which xargs)`
¶Ç´Â
# rpm -qf `which xargs` | xargs rpm -qi
Áï, find °á°ú¿¡ ´ëÇؼ,
ÇüÅÂ1Àº -exec¸¦ »ç¿ëÇÏ¿© ±× ÀÎÀÚ¸¦ {}·Î »ç¿ëÇÏ°í,
ÇüÅÂ2´Â xargs ¸í·É¾î·Î find¿¡¼ ³Ñ¾î¿Â °á°ú(Ç¥ÁØÃâ·Â)¿¡ ´ëÇؼ COMMAND¸¦
½ÇÇàÇÏ°í,
ÇüÅÂ3Àº ¿À¸¥ÂÊÀÇ find °á°ú¹°¿¡ ´ëÇؼ ls ¸í·É¾î¸¦ ½ÇÇàÇÕ´Ï´Ù.
°£È¤ '/bin/ls Argument list too long'À̶ó´Â ¿¡·¯¸¦ ³½ °æ¿ìµµ ÀÖ½À´Ï´Ù.
ÀÌ´Â °Ë»öÁ¶°Ç¿¡ ³Ê¹« ¸¹Àº ¿ÍÀϵåÄ«µå ¹®ÀڷΠãÀ» °æ¿ì¿¡ ±×·¸½À´Ï´Ù.
À̸¦ Å׸é /*/*/*.*/.*,
`Àº ~¹®ÀÚ°¡ ÀÖ´Â ÀÚÆÇ(¿ªÀοëºÎÈ£).
ls -l ¸í·É¾î¸¦ »ç¿ëÇÒ °æ¿ì, ã´Â °á°ú°¡ ¾ø´Ù¸é ¸ðµÎ Ãâ·ÂµË´Ï´Ù.
(ls -l¿Í °°±â ¶§¹®¿¡)
ls ¸í·É¾î¿Í ¸¶Âù°¡Áö·Î ´Ù¸¥ ¸í·É¾î(chmod, chmod)¸¦ °áÇÕÇÏ¿© »ç¿ëÇÒ °æ¿ì
±× ã´Â
°á°ú°¡ ¾ø´Ù¸é ¸í·É¾î¿¡ ´ëÇÑ ¿¡·¯¸¦ ³»°ÚÁÒ.
(chmod 'null')°ú °°Àº ¿¹..........
# find /{home,usr/{src,local/src}} -nouser -o -nogroup -exec ls -l {}
\; -print | more
# find /{home,usr/{src,local/src}} -nouser -o -nogroup -print | xargs
ls -l | more
À§ÀÇ 2°³ÀÇ ¸í·É¾î ´ëÇؼ Á÷Á¢ Å×½ºÆ® Çغ¸¼¼¿ä...
ÀüÀÚÀÇ °æ¿ì, ¾Æ¸¶ ¾Æ¹«°Íµµ Ãâ·ÂµÇÁö ¾ÊÀ» °Ì´Ï´Ù.
# find /{home,usr/{src,local/src}} \( -nouser -o -nogroup \) -exec ls -l
{} \; -print | more
À§¿Í °°ÀÌ ÇØ¾ß ¸Â°ÚÁÒ...(¿ì¼±¼øÀ§)
ÈÄÀÚÀÇ °æ¿ìµµ ¸¶Âù°¡Áö·Î ´ÙÀ½°ú °°ÀÌ ¿ì¼±¼øÀ§¸¦ Á¤Çسõ¾Æ¾ß °ÚÁö¿ä..
¾Æ¸¶ ¿øÇÏ´Â Ãâ·ÂÀÌ ÀÌ °æ¿ìÀÏ °Í °°±º¿ä.
# find /{home,usr/{src,local/src}} \( -nouser -o -nogroup \) -print |
xargs ls -l | more
3-2. ÆÛ¹Ì¼Ç °ü·Ã ¿¹Á¦
othesrs¿¡ ¾²±â(w:2) ±ÇÇÑÀÌ ÀÖ´Â ¸ðµç(-±âÈ£¸¦ ºÙÀÓ) ÆÄÀÏ ¸®½ºÆ®¸¦ ãÀ»·Á
¸é?
# find `pwd` -perm -2 -print | xargs ls -l
¿©±â¿¡¼ 2´Â
Æ۹̼ÇÀÌ -------w- ¿Í ÀÏÄ¡ÇÏ´Â ÆÄÀÏÀ̸ç -ÀÇ Àǹ̴ rwx-Áß Çϳª.
¿Ö 2Àΰ¡¿ä?
¸¸¾à Æ۹̼ÇÀÌ 755 À̶ó¸é,
700 : rwx------ : user
50 : ---r-x--- : group
5 : ------r-x : others
------------------------
755 : rwxr-xr-x : others´Â Àбâ¿Í ½ÇÇà ±ÇÇÑ
µû¶ó¼ othersÀÇ ±ÇÇÑÀº 8Áø¼ö·Î 5(r+x)ÀÌ´Ù.
±×·¸´Ù¸é, others°¡ ¾²±â(w:2) ±ÇÇÑÀº ´ç¿¬È÷ -------w-
±×·ìÀ̳ª others¿¡°Ô ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀÏ °æ¿ì
-perm -20 -o -perm -2
±×·ì°ú others¿¡°Ô ¸ðµÎ ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀÏ °æ¿ì
-perm -22
[others¿¡°Ô w ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏ¿¡ w ±ÇÇÑ ¾ø¾Ö±â]
¹æ¹ý1)
1. others¿¡°Ô w ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏ ¸®½ºÆ® Ãâ·Â
# find `pwd` -perm -2 -print | xargs ls -l | more
(¸¸¾à ¸ÅÄ¡µÇ´Â ¸®½ºÆ®°¡ ¾ø´Ù¸é ÀüºÎ Ãâ·ÂÇÔ)
2. others¿¡°Ô w ±ÇÇÑÀ» ¾ø¾Ö±â
# find `pwd` -perm -2 -print | xargs chmod o-w
(¸¸¾à ¸ÅÄ¡µÇ´Â ¸®½ºÆ®°¡ ¾ø´Ù¸é chmod¿¡ ¿¡·¯¸¦ ³¿)
¹æ¹ý2) ¹æ¹ý1)ÀÇ °úÁ¤À» ÇѲ¨¹ø¿¡ ÇÒ °æ¿ì
# find `pwd` -perm -2 -exec chmod o-w {} \; -print | xargs ls -l
¶Ç´Â
# ls -l `find $(pwd) -perm -2 -print | xargs chmod o-rwx` | more
ÀÌ °æ¿ì´Â Æ۹̼ÇÀÌ Á¶Á¤µÈ °á°ú¸¦ Ãâ·ÂÇÔ.
3-3. À¯Àú¿Í °ü·ÃµÈ ¿¹Á¦
UID¿Í GID¿¡ ´ëÇÑ À¯Àú°¡ ¾ø´Â ÆÄÀÏÀ» root.root·Î ¹Ù²Ù¾î º¸ÁÒ.
1) ¸ÕÀú ¸®½ºÆ®¸¦ Ãâ·ÂÇØ º¸ÀÚ.(È®ÀÎÇؾßÇϴϱñ)
# find . \( -nouser -o -nogroup \) -print | xargs ls -l | more
2) È®ÀÎÇßÀ¸¸é, chown root.root ¸í·ÉÀ» ³»¸®ÀÚ.
# find . \( -nouser -o -nogroup \) -print | xargs chown root.root |
more
¶Ç´Â
# find . \( -nouser -o -nogroup \) -exec chown root.root {} \; -print
| xargs ls -l
(chown root.root ÀÇ °á°ú¸¦ ls -l)
3-4. À¯¿ëÇÑ ÆÁ
*ÁÖÀÇ) ***********************************************
-a'xxxx'
'xxxx'¿¡ ´ëÇÑ Access(Á¢±Ù), Àбâ
-c'xxxx'
'xxxx'¿¡ ´ëÇÑ Changes(º¯°æ), ¸¶Áö¸·À¸·Î AccessÇÑ °æ¿ì
¿¡µµ º¯°æµÊ
-m'xxxx'
'xxxx'¿¡ ´ëÇÑ Modify(¼öÁ¤), ÆÄÀϳ»¿ë ÀÚü ¼öÁ¤ÇÑ °æ¿ì
*****************************************************
- ÃÖ±Ù ÇÏ·ç(1) µ¿¾È(-)¿¡ º¯°æ(change)µÈ ÆÄÀÏÀ» ãÀ»·Á¸é(-ctime)?
# find / -ctime -1 -a -type f | xargs ls -l | more
- ¿À·¡µÈ ÆÄÀÏÀ» ãÀ»·Á¸é(30ÀÏ ÀÌ»ó ¼öÁ¤(modify))µÇÁö ¾ÊÀº)?
# find / -mtime +30 -print | more
- ÃÖ±Ù 30ÀÏ(30) ¾È¿¡(-) Á¢±Ù(access)ÇÏÁö ¾ÊÀº ÆÄÀÏ°ú µð·ºÅ丮¸¦ ¸®½ºÆ®
·Î ¸¸µé·Á¸é(-atime)?
# find / ! \( -atime -30 -a \( -type d -o -type f \) \) |
xargs ls -l > not_access.list
- ÀÚ½ÅÀÇ È¨µð·ºÅ丮¿¡¼ ¸¸ °Ë»öÇÏ·Á¸é?
# find $HOM ...
¶Ç´Â
# find ~root ...
- ¼ºê µð·ºÅ丮·Î ³»·Á°¡Áö ¾Ê°í ÇöÀç µð·ºÅ丮¿¡¼¸¸ °Ë»öÇÏ·Á¸é?
# find . -prune ...
- ƯÁ¤ À¯Àú(foobar) ¼ÒÀ¯ÀÇ ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -user foobar -print | more
- Æ۹̼ÇÀÌ 777ÀÎ ÆÄÀÏÀ» ãÀ»·Á¸é ?
# find / -perm 777 -print | xargs ls -l | more
- others¿¡°Ô ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -perm -2 -print | xargs ls -l | more
- others¿¡°Ô ¾²±â ±ÇÇÑÀÌ ÀÖ´Â ÆÄÀÏÀ» ã¾Æ ¾²±â ±ÇÇÑÀ» ¾ø¾Ö·Á¸é?
# find / -perm -2 -print | xargs chmod o-w
¶Ç´Â
# find / -perm -2 -exec chmod o-w {} \; -print | xargs ls -l |
more
- À¯ÀúÀ̸§°ú ±×·ìÀ̸§ÀÌ ¾ø´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / \( -nouser -o -nogroup \) -print | more
- ºó ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -empty -print | more
¶Ç´Â
# find / -size 0 -print | more
- ÆÄÀÏÅ©±â°¡ 100M ÀÌ»óµÈ ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -size +102400k -print | xargs ls -hl
- *.bak ÆÄÀÏÀ» ã¾Æ Áö¿ï·Á¸é?
# find / -name "*.bak" -exec rm -rf {} \;
- *.bak ÆÄÀÏÀ» ã¾Æ ƯÁ¤ µð·ºÅ丮·Î ¿Å±æ·Á¸é?
# mv `find . -name "*.bak"` /home/bak/
- µð·ºÅ丮 ¸¸ ãÀ»·Á¸é?
# find . -type d ...
- root±ÇÇÑÀ¸·Î ½ÇÇàµÇ´Â ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / \( -user root -a -perm +4000 \) -print | xargs ls -l
| more
- ´Ù¸¥ ÆÄÀϽýºÅÛÀ» °Ë»öÇÏÁö ¾ÊÀ»·Á¸é?
# find / -xdev ...
- ÆÄÀÏÀ̸§¿¡ °ø¹éÀÌ µé¾î°£ ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -name "* *" -print
- ¼û°ÜÁø(hidden) ÆÄÀÏÀ» ãÀ»·Á¸é?
# find / -name ".*" -print | more
- °°Àº À̸§À» °¡Áø µð·ºÅ丮¸¦ ãÀ»·Á¸é?
# find / -type d -print | awk -F/ '{printf("%s\t%
s\n",$NF,$0);}' | sort| more
*ÁÖ)'O'Reilly Unix Power Tools' Âü°í
- À߸øµÈ ¸µÅ©¸¦ ãÀ»·Á¸é?
# find . -type l -print | perl -nle '-e || print' | xargs ls -l
*ÁÖ)'O'Reilly Unix Power Tools' Âü°í
|
|
Page Loading [ 0.04 Sec ]
SQL Time [ 0 Sec ]
|
|
|