Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-24-2008, 01:34 PM   #1
Registered: Apr 2004
Distribution: CentOS6, CentOS5, F16, F15, Ubuntu, OpenSuse
Posts: 620

Rep: Reputation: 39
Archive dotfiles and dotdirectories only

I'm not exactly sure how to do this.
Is there a quick and easy way to archive ONLY .files and .directories only (i.e. only 'hidden' files)?

I guess I could pipe an ls output and grep for " ." and then incrementally add to an archive. Is there a easier/more reliable way?
Old 05-24-2008, 01:43 PM   #2
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
I was trying to do the same thing recently and had a pretty tough time finding any answers. With some help from board members I eventually settled on this command, which I incorporated into a simple script.

ls -A | egrep '^\.' | tar -cvf filename.tar -T -
Old 05-24-2008, 01:47 PM   #3
Registered: Apr 2004
Distribution: CentOS6, CentOS5, F16, F15, Ubuntu, OpenSuse
Posts: 620

Original Poster
Rep: Reputation: 39
That was fast. Thanks, it is perfect!
Old 05-28-2008, 11:01 PM   #4
LQ Newbie
Registered: May 2008
Posts: 1

Rep: Reputation: 0
i run your command i my home direktori, but i got this message in the end of line

ls -A | egrep '^\.' | tar -cvf filename.tar -T -
tar: Error exit delayed from previous errors

whats wrong with this?


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
Where is the Old-LQ archive? kFblind LQ Suggestions & Feedback 5 02-03-2006 09:51 AM
cp command can't do "dotfiles" netdemon Linux - Software 4 04-01-2005 04:50 AM
About a "dotfiles" section slackie1000 LQ Suggestions & Feedback 5 04-19-2004 01:40 PM
Command line: How do I filter for dotfiles only? unamiccia Linux - General 21 04-14-2004 07:10 PM
importing an MS Outlook archive archive.pst alloydog Linux - Software 2 08-29-2003 04:02 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:08 PM.

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