Specifications

Administration Guide
172 VMware, Inc.
Finding and Viewing Files
Table 52!describes!some!common!Linux!commands!for!finding!and!viewing!files!that!
can!also!be!used!in!the!ESX Server!service!console.
rm Remove!a!file.
rm deadfile
Remove!the!file!deadfile!from!the!current!directory.
rmdir Remove!a!directory.
rmdir gone
Remove!the!directory!gone,!which!exists!beneath!the!current!directory.
Table 5-2. Linux commands used on the service console
Command Example and Explanation
cat Concatenate!the!contents!of!files!and!display!the!content!on!the!screen.
cat /proc/vmware/mem
Display!the!contents!of!the!file /proc/vmware/mem.
find Find!files!under!a!specified!directory!that!match!conditions!you!specify.
find / -name myfil*
Find!files!in!the!root!directory!and!all!directories!under!it!that!have!file!names!
beginning!with!myfil.!The!
*!is!a!wildcard!character!that!represents!any!
number!of!characters.!The!?!is!a!wildcard!character!that!represents!a!single!
character.
find -name '*.vmx' -print -exec chown User2 {} \;
Find!files!in!this!directory!and!subdirectories!that!end!with!.vmx,!display!the!
names!of!all!files!that!are!found!on!the!screen!and,!for!
each!file!(indicated!by!
curly!braces!{}),!change!its!owner!to!User2.
-print!is!not!necessary,!but!it!helps!to!track!the!progress!of!the!find!
command.!If!you!do!not!use!-print,!the!find!command!is!silent!except!for!
error!messages!from!find!or!from!chown.
find -name '*.vmx' -exec grep -il 'SOMETHING' {} \;
Find!all
!files!in!this!directory!and!all!subdirectories!that!end!with!.vmx!and!look!
for!the!pattern!SOMETHING!in!each!of!the!files.!The!-i!option!to!grep!makes!
the!search!caseinsensitive.!The!-l!option!to!grep!causes!grep!to!display!the!
names!of!the!files!that!have!SOMETHING!in!
them.!When!a!file!is!found!that!
contains!SOMETHING,!this!command!displays!the!full!path!to!the!file!from!the!
current!directory!(for!example,
./virtualmachines/Linux/RedHat71Test/redhat71.vmx).
Table 5-1. Linux commands used on the service console (Continued)
Command Example and Explanation