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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-19-2007, 08:40 PM
|
#1
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Rep:
|
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?
|
|
|
09-19-2007, 09:36 PM
|
#2
|
Member
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938
Rep:
|
No. It means that you've probably already detarred the file.
|
|
|
09-19-2007, 09:37 PM
|
#3
|
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Rep:
|
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
|
|
|
09-19-2007, 11:36 PM
|
#4
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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.
|
|
|
09-19-2007, 11:42 PM
|
#5
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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?
|
|
|
09-20-2007, 03:42 AM
|
#6
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by imputerate
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.
|
|
|
09-20-2007, 03:52 AM
|
#7
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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?
|
|
|
09-20-2007, 09:35 AM
|
#8
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by imputerate
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:
|
|
|
09-20-2007, 12:22 PM
|
#9
|
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Rep:
|
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.
|
|
|
09-20-2007, 12:33 PM
|
#10
|
Member
Registered: Aug 2005
Posts: 68
Rep:
|
Quote:
Originally Posted by imputerate
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.
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
|
|
|
09-22-2007, 01:18 AM
|
#11
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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];
|
|
|
09-22-2007, 01:43 AM
|
#12
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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;
|
|
|
09-23-2007, 05:46 PM
|
#13
|
Member
Registered: Aug 2005
Posts: 68
Rep:
|
Quote:
Originally Posted by imputerate
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!
|
|
|
09-23-2007, 08:19 PM
|
#14
|
LQ Newbie
Registered: May 2006
Location: houston/malibu
Distribution: ubuntu
Posts: 19
Original Poster
Rep:
|
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;
|
|
|
All times are GMT -5. The time now is 11:43 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|