LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-24-2008, 12:34 PM   #1
mjmwired
Member
 
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, 12:43 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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.

Code:
ls -A | egrep '^\.' | tar -cvf filename.tar -T -
 
Old 05-24-2008, 12:47 PM   #3
mjmwired
Member
 
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, 10:01 PM   #4
amfpg
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

Code:
ls -A | egrep '^\.' | tar -cvf filename.tar -T -
.Xauthority
.xine/
.xine/catalog.cache
.xsession-errors
.zshrc
tar: Error exit delayed from previous errors

whats wrong with this?
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:15 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration