[olug] Unix Tip: GET THE HIDDEN FILES

Brian Wiese bwiese at cotse.com
Wed Nov 20 20:10:19 UTC 2002


On Wed, 20 Nov 2002 11:19:58 -0800 (PST)
CM Miller <cmmiller1973 at yahoo.com> wrote:

|
|Can someone give an example on how to use this '.??*' 
|
|
|I'm familiar with find and slocate but not the command
|above. 
|
|thanks
|
|-Chris 

Sure thing Chris, but it's not a command, its used as a regular expression
here, for files that start with a dot, have at least 2 other characthers,
then anything else after that.  So you are dealing with those files. 
hence ...
----------------------
	/* create some files */
bob at liberty:~/testdir> touch .dotfile1 .dotfile2 .dotfile3 file1 file2
file3 dir1 dir2 dir3
	/* check out the common files */
bob at liberty:~/testdir> ls
dir1  dir2  dir3  file1  file2  file3
	/* show me all files, .(dot) files included */
bob at liberty:~/testdir> ls .*
.dotfile1  .dotfile2  .dotfile3

.:
dir1  dir2  dir3  file1  file2  file3

..:
KDesktop  Mail  public_html  testdir
	/* that showed me a little too much, it even revealed
	/* the files in my previous (..) directory, i.e. Mail
	/* so just so me the files that start with a dot 
bob at liberty:~/testdir> ls .??*
.dotfile1  .dotfile2  .dotfile3
-----------------------

this is especially good when you go about removing files, and make the
mistake of:
# rm -fr .*
compared to
# rm -fr .??*

is the most common mistake one may make and dearly regret.

peace
Brian

|
|
|--- Unix Guru Universe <listserv at ugu.com> wrote:
|> 
|>
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|> 
|> 			      UNIX GURU UNIVERSE 
|> 			         UNIX HOT TIP
|> 
|> 			Unix Tip 2150 - November 20, 2002
|> 
|> 		    http://www.ugu.com/sui/ugu/show?tip.today
|> 
|>
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|> 
|> 
|> GET THE HIDDEN FILES
|> 
|> A safe way of grabbing all "hidden" files is to use
|> '.??*'
|> rather than '.*' since this will only match 3 or
|> more
|> characters.  Admittedly, this will miss any hidden
|> files
|> that are only a single character after the ., but it
|> will always miss '.' & '..', which is probably more
|> important...
|> 
|> This tip generously supported by:
|> leopard at midwinter.com
|> 
|> 
|> 
|>
|--------------------------------------------------------------------------
|> To Subscribe:   
|> http://www.ugu.com/sui/ugu/show?tip.subscribe
|> To Unsubscribe: 
|> http://www.ugu.com/sui/ugu/show?tip.unsubscribe
|> To Submit A Tip:
|> http://www.ugu.com/sui/ugu/show?tip.today


  Brian Wiese | bwiese at cotse.com | aim: unolinuxguru
------------------------------------------------------
  GnuPG/PGP key 0x1E820A73 | "FREEDOM!" - Braveheart 
------------------------------------------------------  
This is not about Napster or DVDs. It's about your Freedom.
  I'll see your DMCA and raise you a First Amendment.
              http://www.anti-dmca.org



More information about the OLUG mailing list