LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-07-2005, 09:39 AM   #1
AndyMCR
Member
 
Registered: Apr 2005
Location: Manchester, UK
Distribution: Slackware Current
Posts: 39

Rep: Reputation: 15
Extract files in one easy step?


Hi All,

Been using Slack for a while now, all is going well....until I download source files. I am constantly having to refer to brunolinux.com for the correct syntax to extract the different file associations (tar.gz, tar.bz, tar.bz2 etc)

Is there a program I can install that will give me the ability to issue one command that will work out what type of file it is, then extract the files?

I tried googling, but couldn't express all the above in a query!

Thanks in advance,

Andy
 
Old 10-07-2005, 09:53 AM   #2
objorkum
Member
 
Registered: Aug 2003
Location: Norway
Distribution: Slackware 10.0
Posts: 231

Rep: Reputation: 30
You just have to remember to characters...

tar.gz/tgz:

tar -zxvf <file>

tar.bz2:

tar -jxvf <file>
 
Old 10-07-2005, 09:53 AM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Latest tar versions automatically checks which compression algoritthm to use, just run: tar xf file.tar.gz/bz2

And if you want to remain on console, you could use mc (midnight commander) it will allow you to decompress the files with a key and even see inside them before decompressing.

Last edited by gbonvehi; 10-07-2005 at 09:54 AM.
 
Old 10-07-2005, 10:03 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Sounds like this is a good candidate for a script.

Create yourself a file called "extractor" (or "billybob" or whatever you like). The file should contain something like:

#!/bin/bash
#
# Extractor script
#
# Usage: extractor <filename>
# Where filename is the name of the file from which you wish to do the extract.

INPUTFILE=$1
SUFFIX=`echo $INPUTFILE |awk -F\. '{$NF}'
BASEFILE=`echo $INPUTFILE | awk -F\. '{print $1"."$2}'

case $SUFFIX in
gz) gunzip $INPUTFILE ;;
bz) your command here ;;
bz2) your command here ;;
*) echo "Sorry I don't recognize the file type for $INPUTFILE "
esac

tar xvf $BASEFILE


The tar is the end of the script above. I'm too lazy to lookup up syntax for extracting the bz or bz2 so will let you do that - essentially just put it in those lines and use "$INPUTFILE" as the file you give the command (like the gz line).

The script would unzip your file (basically create one without the gz, bz or bz2 extension). It would then run the tar command to untar the unzipped file. The tar command actually has a gunzip flag built into it so you could modify it to do that instead - I put it at the bottom because the untar would be common action after each of the unzips.

NOTE: Above is informational only - no warranty expressed or implied - use it at your own risk.
 
Old 10-07-2005, 10:07 AM   #5
AndyMCR
Member
 
Registered: Apr 2005
Location: Manchester, UK
Distribution: Slackware Current
Posts: 39

Original Poster
Rep: Reputation: 15
Thanks all,

I'll try all of the suggestions. I like the idea of a script as I'm keen to learn a bit of bash.

I'll have a go at editting it, and get back to you.

Thanks again,

Andy
 
Old 10-07-2005, 11:51 AM   #6
noxious
Member
 
Registered: May 2004
Location: Ohio, USA
Distribution: LinuxMint Gloria, Ubuntu 9.10
Posts: 299

Rep: Reputation: 30
...sheesh...

1. right-click file,

2. choose "Extract Here"

3. done.
 
Old 10-07-2005, 12:22 PM   #7
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Really. I was thinking.... "Ark".... "FileRoller"..... Ofcourse, that only works if your at a GUI...
 
Old 10-07-2005, 02:14 PM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally posted by noxious
...sheesh...

1. right-click file,

2. choose "Extract Here"

3. done.
Real users don't use namby pamby GUIs

Seriously though didn't know that was an option in the GUI. I'd still do my script idea but its always interesting to learn something new.
 
Old 10-07-2005, 02:21 PM   #9
freakyg
Member
 
Registered: Apr 2005
Distribution: LFS 5.0 and 6.1
Posts: 705

Rep: Reputation: 30
Quote:
Originally posted by noxious
...sheesh...

1. right-click file,

2. choose "Extract Here"

3. done.




that would be too easy........

......some of us just have to do it the hard way.........LOL
 
Old 10-07-2005, 02:35 PM   #10
AndyMCR
Member
 
Registered: Apr 2005
Location: Manchester, UK
Distribution: Slackware Current
Posts: 39

Original Poster
Rep: Reputation: 15
I prefer the command line myself, Im using e17 so until Evidence has all the necessary functions I'll do it the longway.

PS in xffm, you can't extract to a generated folder of the file name, it has to be an existing folder, afaik
 
Old 10-07-2005, 02:43 PM   #11
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
GUI fronends to tar generally take considerably longer to extract stuff as well. If you omit verbosity at the prompt with tar then you can extract stuff way quicker than any other method. I generally use the prompt as well. depends on whether or not I feel like typing at the moment.

try extracting a kernel source with Ark or Fileroller and then execute tar (no -v) from the prompt at the same time. You'll be halfway done compiling the bzImage before the frontend completes...

Last edited by jong357; 10-07-2005 at 02:46 PM.
 
Old 10-15-2005, 03:19 AM   #12
fedix
Member
 
Registered: Oct 2005
Location: Mpumalanga, South Africa
Distribution: Fedora / CentOS 5 / Ubuntu
Posts: 104

Rep: Reputation: 17
Quote:
Originally posted by noxious
...sheesh...

1. right-click file,

2. choose "Extract Here"

3. done.

Some of us want to do it as root without logging in as root. Do you have a way to act as root, right click and Extract? Please tell me, would love to do it that way!
 
Old 10-15-2005, 06:07 AM   #13
mjjzf
Member
 
Registered: Feb 2004
Location: Valby, Denmark / Citizen of the Web
Distribution: Slackware 14.1
Posts: 879

Rep: Reputation: 39
If your system allows root actions for non-root users, it is a) somewhat unusual, and b) extremely insecure.
 
Old 10-15-2005, 06:18 AM   #14
fedix
Member
 
Registered: Oct 2005
Location: Mpumalanga, South Africa
Distribution: Fedora / CentOS 5 / Ubuntu
Posts: 104

Rep: Reputation: 17
Unhappy

Quote:
Originally posted by OSourceDiplomat
If your system allows root actions for non-root users, it is a) somewhat unusual, and b) extremely insecure.
No, my system doesn't; but that's my point. I would like to sometime, do things graphically as root, (like extracting, browsing, deleting obsolete files). I can't, unless thru terminal. Or I don;t know how?
 
Old 10-15-2005, 06:26 AM   #15
mjjzf
Member
 
Registered: Feb 2004
Location: Valby, Denmark / Citizen of the Web
Distribution: Slackware 14.1
Posts: 879

Rep: Reputation: 39
Ah.
You may want to use Gksu - it runs the program that follows as root. In other words, if you run the following:
gksu [path_to]/nautilus
- a window will pop up and prompt you to enter root password. After that, Nautilus will run as root until closed.
You may not have Gksu installed by default. It is good for making program buttons, too - because of the authentication box popping up. Nice UI feature.
 
  


Reply



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 to extract difference between two files? Marshalle Linux - General 8 01-05-2011 12:45 PM
extract files ust Linux - General 1 08-05-2005 01:16 AM
how to extract winrar files Paxmaster Linux - Software 1 11-04-2004 09:16 PM
Extract >1 files using WinRAR mib Linux - Software 11 06-29-2004 01:15 AM
Easy step by step Guied for Squid mobassir Linux - Software 15 05-22-2004 03:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:05 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