Thursday, November 6, 2014

How to Search for a file on Solaris 10


ls -l /etc/system* - this shows a long listing of file and directory attributes

drwxr-xr-x - The d at the beginning of this line shows this is a directory.

root@*****# cd /usr
root@*****# ls -l
total 242
drwxr-xr-x   2 root     bin         1024 Aug  6  2011 4lib
lrwxrwxrwx   1 root     root           5 Aug  6  2011 5bin -> ./bin
lrwxrwxrwx   1 root     root           9 Aug  6  2011 X -> ./openwin
drwxr-xr-x   6 root     bin          512 Aug  6  2011 X11
lrwxrwxrwx   1 root     root           3 Aug  6  2011 X11R6 -> X11
lrwxrwxrwx   1 root     root          10 Aug  6  2011 adm -> ../var/adm
drwxr-xr-x   2 radmin   reuters      512 Aug  6  2011 agent
drwxr-xr-x  11 root     bin          512 Aug  6  2011 apache
drwxr-xr-x   8 root     bin          512 Aug  6  2011 apache2
drwxr-xr-x   8 root     bin          512 Aug  6  2011 appserver
drwx------   8 root     bin          512 Aug  6  2011 aset
drwxr-xr-x   4 root     bin        18432 Oct 16 09:04 bin
drwxr-xr-x   4 root     bin          512 Aug  6  2011 ccs
drwxr-xr-x  18 root     bin          512 Aug  6  2011 demo
lrwxrwxrwx   1 root     root          16 Aug  6  2011 dict -> ./share/lib/dict
drwxr-xr-x  10 root     bin          512 Aug  6  2011 dt
drwxr-xr-x   2 root     bin          512 Aug  6  2011 games

 



 
find  command:

# find / -name "*.pdf"

.pdf - is the sample file that you are currently looking for.

# find / -name core

core - is the sample file that you are currently looking for.

# find / -name core -atime +10 -exec rm {} \;

It searches the system looking for core files that haven't been accessed for at least 10 days and once it finds one, it will remove it.