LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-19-2007, 08:40 PM   #1
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Rep: Reputation: 0
ls -al [regexp] and .tar.gz files


i downloaded the latest version of lshw from ezix.org to
~/home/hodgson

so, when i type <ls -al | less>, i get a list which includes the line:

-rw-r--r-- 1 hodgson hodgson 1165673 2007-09-11 01:26 lshw-B.02.11.01.tar.gz

BUT when i type <ls -al lshw* | less>, i get a huge list of files and
directories: here's a few lines from the list:

drwxr-xr-x 0/0 0 2007-08-05 16:12 lshw-B.02.11.01/
drwxr-xr-x 0/0 0 2007-08-05 16:12 lshw-B.02.11.01/docs/
-rw-r--r-- 0/0 491 2007-08-05 16:11 lshw-B.02.11.01/docs/TODO
-rw-r--r-- 0/0 6287 2007-08-05 16:11 lshw-B.02.11.01/docs/Changelog
-rw-r--r-- 0/0 3063 2007-08-05 16:11 lshw-B.02.11.01/docs/IODC.txt
-rw-r--r-- 0/0 10107 2007-08-05 16:11 lshw-B.02.11.01/docs/proc_usb_info.txt
-rw-r--r-- 0/0 2928 2007-08-05 16:11 lshw-B.02.11.01/docs/lshw.xsd
-rw-r--r-- 0/0 111 2007-08-05 16:11 lshw-B.02.11.01/Makefile
-rw-r--r-- 0/0 2965 2007-08-05 16:12 lshw-B.02.11.01/lshw.spec
-rw-r--r-- 0/0 2008 2007-08-05 16:11 lshw-B.02.11.01/README

does that mean ls can read inside a tar.gz file?
 
Old 09-19-2007, 09:36 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
No. It means that you've probably already detarred the file.
 
Old 09-19-2007, 09:37 PM   #3
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
my guess would be that you had previously extracted the tarball. Notice that the paths are "lshw-B.02.11.01/" not "lshw-B.02.11.01.tar.gz/". A tarball extracts to a folder with the same name, minus the .tar.gz
 
Old 09-19-2007, 11:36 PM   #4
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
your helpful tutorial on source install says:

Code:
$ tar xvf gaim-0.59.8.tar.gz
This should extract the files into a new directory usually named the same as the file without the tar.gz at the end.

BUT there is no such directory on my box:
hodgson@hodgson-desktop:~$ ls -d */
desk/ Desktop/ Examples/ f/ Mail/ mem/ News/ tmp/

nor was my <ls -al lshw* | command> issued in any other but my home dir.
 
Old 09-19-2007, 11:42 PM   #5
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
sorry; i just realized that the original <ls -al lshw* | less> DID show the directories
drwxr-xr-x 0/0 0 2007-08-05 16:12 lshw-B.02.11.01/
drwxr-xr-x 0/0 0 2007-08-05 16:12 lshw-B.02.11.01/docs/

but then what are these peculiar items on the list?

-rw-r--r-- 0/0 491 2007-08-05 16:11 lshw-B.02.11.01/docs/TODO
-rw-r--r-- 0/0 6287 2007-08-05 16:11 lshw-B.02.11.01/docs/Changelog
-rw-r--r-- 0/0 3063 2007-08-05 16:11 lshw-B.02.11.01/docs/IODC.txt
...

why the "subdirectories" and the weird permissions?
 
Old 09-20-2007, 03:42 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by imputerate View Post
but then what are these peculiar items on the list?

-rw-r--r-- 0/0 491 2007-08-05 16:11 lshw-B.02.11.01/docs/TODO
-rw-r--r-- 0/0 6287 2007-08-05 16:11 lshw-B.02.11.01/docs/Changelog
-rw-r--r-- 0/0 3063 2007-08-05 16:11 lshw-B.02.11.01/docs/IODC.txt

why the "subdirectories" and the weird permissions?
Weird permissions??! I can't see nothing strange in permissions here. The files you are listing are normal text files, read them and you will find out. The TODO and Changelog documents are usual inside a source tarball.
 
Old 09-20-2007, 03:52 AM   #7
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
sorry, i meant ownership: 0/0, NOT permissions, which i see are normal;

i never saw the ls listing for a file which included a path beyond the directory itself:

-rw-r--r-- 0/0 6287 2007-08-05 16:11 lshw-B.02.11.01/docs/Changelog

or is it possible to give a file a name with '/' slashes in it?
 
Old 09-20-2007, 09:35 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by imputerate View Post
sorry, i meant ownership: 0/0, NOT permissions, which i see are normal
Uh... sorry, I should have notice that. It does not resemble an output from ls, instead an archive content listing, e.g.
Code:
[colucix@linux]$ tar ztvf lshw-B.02.11.01.tar.gz
drwxr-xr-x 0/0               0 2007-08-05 23:12:03 lshw-B.02.11.01/
drwxr-xr-x 0/0               0 2007-08-05 23:12:03 lshw-B.02.11.01/docs/
-rw-r--r-- 0/0             491 2007-08-05 23:11:59 lshw-B.02.11.01/docs/TODO
-rw-r--r-- 0/0            6287 2007-08-05 23:11:59 lshw-B.02.11.01/docs/Changelog
-rw-r--r-- 0/0            3063 2007-08-05 23:11:59 lshw-B.02.11.01/docs/IODC.txt
-rw-r--r-- 0/0           10107 2007-08-05 23:11:59 lshw-B.02.11.01/docs/proc_usb_info.txt
where 0/0 are the uid/gid of the user/group who created the archive (most likely root/root). If you get this output by issuing a ls command, that is really weird! Anyway you can check if and how ls is aliased:
Code:
alias ls
 
Old 09-20-2007, 12:22 PM   #9
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
is 0/0 necessarily weird? If root owned the tarball, then root expanded it, they would come out that way, no? This could have happened if he built something, su'ed to 'make install', forgot he was root and extracted the next tarball.
 
Old 09-20-2007, 12:33 PM   #10
Vrajgh
Member
 
Registered: Aug 2005
Posts: 65

Rep: Reputation: 31
Quote:
Originally Posted by imputerate View Post
sorry; i just realized that the original <ls -al lshw* | less> DID show the directories

...

why the "subdirectories" and the weird permissions?
The subdirectories are shown because of the way you have invoked ls.
Code:
ls lshw*
will get expanded by the shell to
Code:
ls lshw-B.02.11.01 lshw-B.02.11.01.tar.gz
The first of these is the directory. If you invoke ls with a dir as an argument it will list the contents of the dir as you would expect. You would need "-d" to display the directory entry as a file an not its contents.

Last edited by Vrajgh; 09-20-2007 at 12:36 PM. Reason: Typo and clarification
 
Old 09-22-2007, 01:18 AM   #11
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
is 0/0 necessarily weird? If root owned the tarball, then root expanded it, they would come out that way, no?

thanks patrick; trouble is, here's how the tarball showed up when i typed
<ls -al | less>:

-rw-r--r-- 1 hodgson hodgson 1165673 2007-09-11 01:26 lshw-B.02.11.01.tar.gz;

besides, i never did intentionally extract the tarball [although i guess that's beside the point];
 
Old 09-22-2007, 01:43 AM   #12
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
The subdirectories are shown because of the way you have invoked ls.
Code:
ls lshw*
will get expanded by the shell to
Code:
ls lshw-B.02.11.01 lshw-B.02.11.01.tar.gz
The first of these is the directory. If you invoke ls with a dir as an argument it will list the contents of the dir as you would expect.

thanks, vraigh; a subtle and unexpected behavior of ls; and that must be what happened; but that leaves me with another "ls" anomaly; you wrote "You would need "-d" to display the directory entry as a file an not its contents."

on my ubuntu-feisty box:

Code:
hodgson@hodgson-desktop:~$ ls -d
.
hodgson@hodgson-desktop:~$ alias ls
alias ls='ls --color=auto'

i can get results with:

Code:
hodgson@hodgson-desktop:~$ ls -d */
desk/ Desktop/ Examples/ f/ Mail/ mem/ News/ tmp/
hodgson@hodgson-desktop:~$ ls -dl */
drwxr-xr-x 2 hodgson hodgson 12288 2007-09-21 00:44 desk/
drwxr-xr-x 3 hodgson hodgson 4096 2007-09-02 12:52 Desktop/
drwxr-xr-x 2 root root 4096 2007-04-15 06:52 Examples/
drwxr-xr-x 3 hodgson hodgson 4096 2007-07-09 05:06 f/
drwxr-xr-x 5 hodgson hodgson 4096 2007-09-21 23:02 Mail/
drwxr-xr-x 2 hodgson hodgson 16384 2007-09-18 05:13 mem/
drwxr-xr-x 4 hodgson hodgson 4096 2007-07-10 00:55 News/
drwxr-xr-x 2 hodgson hodgson 4096 2007-09-21 14:27 tmp/

but, as you see, those elusive directories extracted [magically] from the tarball, fail to show up this way; it still looks as if ls can, under certain circumstances, peer into a tarball, although i know that's probably not the case;
 
Old 09-23-2007, 05:46 PM   #13
Vrajgh
Member
 
Registered: Aug 2005
Posts: 65

Rep: Reputation: 31
Quote:
Originally Posted by imputerate View Post
The subdirectories are shown because of the way
Code:
hodgson@hodgson-desktop:~$ ls -d
.
This is also expected behaviour. From the ls man page:
Quote:
List information about the FILEs (the current directory by default).
So listing details for the current directory but not its contents can only return "."

Quote:
i can get results with:

but, as you see, those elusive directories extracted [magically] from the tarball, fail to show up this way; it still looks as if ls can, under certain circumstances, peer into a tarball, although i know that's probably not the case;
Without seeing exactly what is in your directories it is hard to say. Does it still show up with your original ls command? My first thought is that the extracted directory isn't there any more!
 
Old 09-23-2007, 08:19 PM   #14
imputerate
LQ Newbie
 
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
Vrajgh [either he is clairvoyant or he has hacked in to my computer] writes:

My first thought is that the extracted directory isn't there any more!
--------------

Vraijh; you are right again;

hodgson@hodgson-desktop:~$ ls -dl */ lshw*
drwxr-xr-x 2 hodgson hodgson 12288 2007-09-21 00:44 desk/
drwxr-xr-x 3 hodgson hodgson 4096 2007-09-02 12:52 Desktop/
drwxr-xr-x 2 root root 4096 2007-04-15 06:52 Examples/
drwxr-xr-x 3 hodgson hodgson 4096 2007-07-09 05:06 f/
-rw-r--r-- 1 hodgson hodgson 1165673 2007-09-11 01:26 lshw-B.02.11.01.tar.gz
drwxr-xr-x 5 hodgson hodgson 4096 2007-09-23 14:11 Mail/
drwxr-xr-x 2 hodgson hodgson 16384 2007-09-18 05:13 mem/
drwxr-xr-x 4 hodgson hodgson 4096 2007-07-10 00:55 News/
drwxr-xr-x 2 hodgson hodgson 4096 2007-09-21 14:27 tmp/
hodgson@hodgson-desktop:~$ ls -al lshw*
-rw-r--r-- 1 hodgson hodgson 1165673 2007-09-11 01:26 lshw-B.02.11.01.tar.gz

which means that both the appearance of the extracted directories and their contents [documented in my first post to this thread] and their subsequent disappearance was the result of some anomalous behavior [mine, i guess];

i'll just have to stop doing all those mushrooms;

thanks again, y'all, for your trouble and patient instruction;
 
  


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
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM
tar -zxvf foo.tar.gz creates all .gz files prophoto Linux - General 11 11-09-2006 07:27 PM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 09:09 PM
cant install .bin files, tar.gz files or anyother format!!! madskillz Linux - Newbie 4 10-05-2003 11:28 AM


All times are GMT -5. The time now is 06:04 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration