LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-27-2008, 08:25 AM   #1
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Rep: Reputation: 16
Smile finding hidden files


is there any other way i suppose to find out the hidden file in the system other than
ls -a
 
Old 03-27-2008, 08:30 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
find <path> -name '.*'
 
Old 03-27-2008, 08:34 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,458

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
The find command retrieves the hidden files, too. If you want to find ONLY the hidden files and directories, you can use the -regex option in this way
Code:
find . -regex '.*/\..*'
Edit: ...or the way pixellany suggested. Indeed, mine is useful when you want to exclude hidden files from the search, as in
Code:
find . \( ! -regex '.*/\..*' \)

Last edited by colucix; 03-27-2008 at 08:38 AM.
 
Old 03-27-2008, 07:57 PM   #4
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
Smile this works fine

Quote:
Originally Posted by colucix View Post
The find command retrieves the hidden files, too. If you want to find ONLY the hidden files and directories, you can use the -regex option in this way
Code:
find . -regex '.*/\..*'
Edit: ...or the way pixellany suggested. Indeed, mine is useful when you want to exclude hidden files from the search, as in
Code:
find . \( ! -regex '.*/\..*' \)
yha this works fine but i want to know that any other method or command so that i'll get the hidden file information.
 
Old 03-28-2008, 04:46 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,458

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
Once you have found the hidden files, you can execute any command on each entry. Suppose you have
Code:
$ find . -regex '.*/\..*'
./.hiddenfile_1
./.hiddenfile_2
You can add the -exec option to the find command and get for example
Code:
$ find . -regex '.*/\..*' -exec ls -l {} \;
-rw-r--r-- 1 colucix users 11 Mar 28 10:40 ./.hiddenfile_1
-rw-r--r-- 1 colucix users 20 Mar 28 10:43 ./.hiddenfile_2

$ find . -regex '.*/\..*' -exec file {} \;
./.hiddenfile_1: ASCII text
./.hiddenfile_2: ASCII text
See man find for details.
 
  


Reply

Tags
files, hidden


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 03:58 AM
Finding files and then finding content within those files... Maeltor Linux - Software 5 03-13-2007 12:06 PM
Hidden files? sonic04002 Linux - Newbie 2 11-09-2005 01:48 PM
hidden files Jeebizz Slackware 4 04-22-2005 07:18 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 08:23 PM


All times are GMT -5. The time now is 02:48 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration