Ask a Question related to Debian, Design and Development.
-
David selby #1
stat question
Hello,
A while ago someone suggested using the stat command to get modification
times for files etc, ls -al will give the info but I would have to do a
lot of string stripping etc ...
I have looked up man "stat", confusing ... googled for it, confusing !
It is not a regular command, ie "stat" on the command line is a no go
though there is a man page for it.
It appears to be a "pearl" module ?
OK simple question. In a bash script can I use stat to get modification
times of files ?
If so what is the syntax ?
Dave
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
David selby Guest
-
Help! I need to know how to use a cookie stat!
Hey guys I am currently making my first dynamic website and am using the most recent version of Macromedia Studio. the site is almost done but I... -
About stat problem ??
Dear all I found that stat command problems, when the file is over 2GB , it cannot return any result when i use stat command. The following are... -
Could not stat error message
Joe Burns typed (on Mon, Aug 11, 2003 at 09:43:38PM -0400): | I am trying to create a "tar" output file of the "/usr2" filesystem into a | storage... -
lsof & non-stat()-ble NFS server
Hello, We're getting errors in /var/adm/messages saying that an NFS directory is not writable: Jul 17 09:04:33 XXXXXXX nfs: NFS write error... -
File.stat.blksize returns nil and not 0 on win2k
Hello, on the 1.8.0 ruby version of the pragprog installer, File.stat(file).blksize returns nil and not 0 on a windows 2k machine. According to... -
Elie De Brauwer #2
Re: stat question
Frankly I don't see your problem
helios@kafka:~$ whereis stat
stat: /usr/bin/stat /usr/share/man/man1/stat.1.gz
/usr/share/man/man2/stat.2.gz
helios@kafka:~$ dpkg -S /usr/bin/stat
coreutils: /usr/bin/stat
helios@kafka:~$ stat workdir/
File: `workdir/'
Size: 4096 Blocks: 8 IO Block: 8192 directory
Device: 304h/772d Inode: 671748 Links: 4
Access: (0755/drwxr-xr-x) Uid: ( 1000/ helios) Gid: ( 1000/ helios)
Access: 2003-08-02 08:55:49.000000000 +0200
Modify: 2003-07-21 16:14:04.000000000 +0200
Change: 2003-07-21 16:14:04.000000000 +0200
-> only the date
helios@kafka:~$ stat -c %y workdir/
2003-07-21 16:14:04.000000000 +0200
-> modification in seconds after the epoch
helios@kafka:~$ stat -c %Y workdir/
1058796844
Can you be more specific about _what_ you actually want ?
hth
Elie De Brauwer
On Saturday 02 August 2003 10:07, David selby wrote:> Hello,
>
> A while ago someone suggested using the stat command to get modification
> times for files etc, ls -al will give the info but I would have to do a
> lot of string stripping etc ...
>
> I have looked up man "stat", confusing ... googled for it, confusing !
> It is not a regular command, ie "stat" on the command line is a no go
> though there is a man page for it.
>
> It appears to be a "pearl" module ?
>
> OK simple question. In a bash script can I use stat to get modification
> times of files ?
> If so what is the syntax ?
>
> Dave
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
Elie De Brauwer Guest
-
Colin Watson #3
Re: stat question
On Sat, Aug 02, 2003 at 09:07:26AM +0100, David selby wrote:
In woody, you need the 'stat' package. In sarge and sid it's part of> A while ago someone suggested using the stat command to get modification
> times for files etc, ls -al will give the info but I would have to do a
> lot of string stripping etc ...
>
> I have looked up man "stat", confusing ... googled for it, confusing !
> It is not a regular command, ie "stat" on the command line is a no go
> though there is a man page for it.
coreutils, which everyone has installed. You can use
[url]http://packages.debian.org/[/url] to answer questions like this.
The reason your searches were confusing is that there's also a system
call called stat(), which C programmers care about but which isn't
useful on the command line.
It's called 'perl', not 'pearl' :-) And no, while there may be a Perl> It appears to be a "pearl" module ?
module with a similar name it's probably not what your respondent was
referring to.
'stat' is a bit tedious for this, because you'd have to parse it out of> OK simple question. In a bash script can I use stat to get modification
> times of files ?
> If so what is the syntax ?
the output using sed or something, but it can be done. The most common
use of modification times is to find out whether one file is newer or
older than another, and you do that with '[ file1 -nt file2 ]' and '[
file1 -ot file2 ]' respectively. If it's something else, give us a bit
more detail about what you're trying to do.
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
Colin Watson Guest
-
David selby #4
Re: stat question
Elie De Brauwer wrote:
Thanks for the clarification on man pages ...>a) do you have the coreutils package installed (which provides the stat binary
>on my machine
>
>b) that is not true, there are manpages for a whole lot of file, for example
>if you have the mesa development files installed you have the manpages for
>all Opengl functions available.
>On my system i have two separate stat manpage i have
>man 1 stat
>(this describes the command like i pasted below)
>man 2 stat
>(which describes the stat system calls which you can use in c/c++ (and
>probably other) programs to get information about files on you system.)
>
>helios@kafka:~$ dpkg -S /usr/share/man/man2/stat.2.gz
>manpages-dev: /usr/share/man/man2/stat.2.gz
>elios@kafka:~$ dpkg -S /usr/share/man/man1/stat.1.gz
>coreutils: /usr/share/man/man1/stat.1.gz
>
>As you can see both manpages (which have the same name but cover different
>topics) are originating from different packages, so normally installing
>coreutils should provide you with the binary you need.
>
>hth
>
>
I don't appear to have the coreutils package installed.
Something tells me I am missing something obvious but !
debian:/home/web# apt-cache gencaches
Reading Package Lists... Done
debian:/home/web#
debian:/home/web# apt-cache search coreutils
debian:/home/web#
and from aptitude a search for coreutils provides zip, running debian woody
OK what am I missing !
Dave
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
David selby Guest
-
David selby #5
Re: stat question
David selby wrote:
>
>
> Elie De Brauwer wrote:
>>>> a) do you have the coreutils package installed (which provides the
>> stat binary on my machine
>>
>> b) that is not true, there are manpages for a whole lot of file, for
>> example if you have the mesa development files installed you have the
>> manpages for all Opengl functions available. On my system i have two
>> separate stat manpage i have man 1 stat (this describes the command
>> like i pasted below)
>> man 2 stat
>> (which describes the stat system calls which you can use in c/c++
>> (and probably other) programs to get information about files on you
>> system.)
>>
>> helios@kafka:~$ dpkg -S /usr/share/man/man2/stat.2.gz
>> manpages-dev: /usr/share/man/man2/stat.2.gz
>> elios@kafka:~$ dpkg -S /usr/share/man/man1/stat.1.gz
>> coreutils: /usr/share/man/man1/stat.1.gz
>>
>> As you can see both manpages (which have the same name but cover
>> different topics) are originating from different packages, so
>> normally installing coreutils should provide you with the binary you
>> need.
>>
>> hth
>>
>>
> Thanks for the clarification on man pages ...
>
> I don't appear to have the coreutils package installed.
> Something tells me I am missing something obvious but !
>
> debian:/home/web# apt-cache gencaches
> Reading Package Lists... Done
> debian:/home/web#
> debian:/home/web# apt-cache search coreutils
> debian:/home/web#
>
> and from aptitude a search for coreutils provides zip, running debian
> woody
>
> OK what am I missing !
> Dave
All sorted, used file1 -ot file2 instead as suggested by colin, didn't
know bash could do that !
many thanks for your help anyhow.
Dave
PS still cant find coreutils or stat, though its not a problem now.
debian:/home/web# dpkg -i coreutils
dpkg: error processing coreutils (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
coreutils
debian:/home/web# dpkg -i stat
dpkg: error processing stat (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
stat
debian:/home/web#
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
David selby Guest
-
Colin Watson #6
Re: stat question
On Sat, Aug 02, 2003 at 11:55:43AM +0100, David selby wrote:
You won't be able to find coreutils on woody. It hadn't been created yet> PS still cant find coreutils
then!
'dpkg -i' doesn't work that way; it takes a .deb filename. Use 'apt-get> or stat, though its not a problem now.
>
> debian:/home/web# dpkg -i coreutils
> dpkg: error processing coreutils (--install):
> cannot access archive: No such file or directory
> Errors were encountered while processing:
> coreutils
> debian:/home/web# dpkg -i stat
> dpkg: error processing stat (--install):
> cannot access archive: No such file or directory
> Errors were encountered while processing:
> stat
> debian:/home/web#
install stat' or some other package manager if you just have the package
name.
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
Colin Watson Guest
-
Johannes Zarl #7
Re: stat question
> PS still cant find coreutils or stat, though its not a problem now.
Could it be that you want to do:>
> debian:/home/web# dpkg -i coreutils
> dpkg: error processing coreutils (--install):
> cannot access archive: No such file or directory
> Errors were encountered while processing:
> coreutils
> debian:/home/web# dpkg -i stat
> dpkg: error processing stat (--install):
> cannot access archive: No such file or directory
> Errors were encountered while processing:
> stat
> debian:/home/web#
# apt-get install stat
As far as I know, dpkg is only used to install packages, which are already
downloaded (from ``dpkg --help'': ``dpkg -i|--install <.deb file name>'').
Does it show up on apt-cache[1]?
Cheers,
Johannes
[1]:
# apt-cache search ^stat
....
stat - wrapper for stat() and statfs calls
....
# apt-cache show stat
Package: stat
Priority: optional
Section: utils
Installed-Size: 80
Maintainer: Michael Meskes <meskes@debian.org>
Architecture: i386
Version: 3.3-2
Depends: libc6 (>= 2.2.4-4)
Filename: pool/main/s/stat/stat_3.3-2_i386.deb
Size: 11916
MD5sum: d576a105c03861f57e9c8b82a9b3dfd5
Description: wrapper for stat() and statfs calls
Display all information about a file that the stat() call provides and all
information about a filesystem that statfs() provides.
#
--
"More than machinery we need humanity" -- Charlie Chaplin, The Great
Dictator
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
Johannes Zarl Guest
-
David selby #8
Re: stat question
>
> PS still cant find coreutils or stat, though its not a problem now.
>
> debian:/home/web# dpkg -i stat
> dpkg: error processing stat (--install):
> cannot access archive: No such file or directory
> Errors were encountered while processing:
> stat
> debian:/home/web#
Err can I crawl into a hole, please ...
apt-get install stat works just fine !
Thanks
Dave
PS I think I need a break, Im getting over linuxed.
--
To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
David selby Guest



Reply With Quote

