Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-23-2004, 08:51 PM   #1
Registered: Aug 2003
Location: you dont want to know
Distribution: Gentoo 2004.2, Slackware 10, Windows XP, Windows 2003 Server
Posts: 348

Rep: Reputation: 30
I choose you wildcard!

2 questions

1. Simple ls command brings:
BlueX.tar.bz2 DeepBlue.tar.bz2 file.txt fluxbox-0.1.14-i386-1.tgz fluxbox-0.1.14.tar.gz fonts

Being lazy, I want to mv all the .tar.bz2 files (underlined) and .zip files to the directory fonts (bold). So how could i do this in one short sweet line from the cmd line? I would like to know in case something else BIGGER comes up with thousands of files in one directory.

I know i could do {mv *.tar.bz2 fonts;mv *.zip fonts} but thats not the point here. I want to do that by doing something like {mv *.bz2 & *.zip & .etc font} If there isn't an easy way then they should code it (or i could, but im to n00bie right now)

2. I have several files in a dir:
BlueX.tar.bz2 DeepBlue.tar.bz2 Lingo.tar.bz2

Now i would like to untar all them at the same time using tar -jxvf. But what ends up happening is >>

tear@/home$ tar -jxvf *.bz2 > file.txt
tar: DeepBlue.tar.bz2: Not found in archive
tar: Gentoo.tar.bz2: Not found in archive
etc etc etc till
tar: Error exit delayed from previous erros

How would I untar all these files in one command?

Just trying to be a more efficient recycable citizen :P

Last edited by tearinox; 01-23-2004 at 08:55 PM.
Old 01-23-2004, 09:00 PM   #2
Senior Member
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Rep: Reputation: 46
1. you can mkdir where u want, and then do a mv * to it. this is pretty much 2 lines.

or you can create a tarball and extract the tarball in the destination folder. this would be one command if you use &&.

2. you cant do this (yet), but u can use a script to. this was discussed here a while ago, though i dont remember which channel. just search here for scripts to unzip/untar, and you'll find exactly what ur looking for.
Old 01-23-2004, 09:44 PM   #3
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
1) mv *.bz2 *.zip /path/to/destination/


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
wildcard vs regular expression lido Linux - Newbie 6 09-02-2004 11:35 AM
how to find file using wildcard? huangyanfeng Linux - General 3 10-15-2003 10:21 PM
Wildcard Mail Aliases js_530 Linux - Networking 2 09-11-2003 12:15 AM
Recursive wildcard copying? meeshka Linux - Newbie 7 07-11-2003 02:44 AM
Help with wildcard searching in Perl AnthonyM Programming 2 06-17-2003 03:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:47 AM.

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