• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

"stat" für Unix

regexer

Advanced Hacker
Hallo zusammen!

Was ist der Unix-Pendant zum Linux-Befehl "stat"?


Ich brauche in etwa dasselbe für UnixWare...

Danke und Gruß

notoxp
 
OP
regexer

regexer

Advanced Hacker
Workaround in perl:
Code:
perl -e 'print join ";", stat($_), "\n" for (@ARGV)' Datei1 Datei2 ...
In Verbindung mit
Code:
perldoc -f stat
Mich würde allerdings trotzdem noch die Eingangsfrage interessieren. Das müsste es doch auch als "Unix-Bordmittel" geben...
 

TeXpert

Guru
bei GNU ist ls Dein Freund :) bei UNIX bitte mal die manpage checken

Code:
ls -l --full-time FILE
zeigt mtime an
Code:
ls -l --full-time --time=atime FILE
zeigt atime an
Code:
ls -l --full-time --time=ctime FILE
zeigt ctime an


Code:
ls -i FILE
liefert den inode die restlichen Infos sind mehr oder weniger direkt auch über ls abzubilden, d.h. stat lässt sich bei GNU mit ls so realisieren (hier nur für 1 Datei brauchbar...)

Code:
#!/bin/sh


LSIL=$(ls -il --full-time $1)
LSILN=$(ls -iln --full-time $1)
LSILNCTIME=$(ls -iln --full-time --time=ctime $1)
LSILNATIME=$(ls -iln --full-time --time=atime $1)


INODE=$(echo $LSILN | cut -d" " -f 1)
ACCESS=$(echo $LSILN | cut -d" " -f 2)
LINKS=$(echo $LSILN | cut -d" " -f 3)
OWNER=$(echo $LSILN | cut -d" " -f 4)
GROUP=$(echo $LSILN | cut -d" " -f 5)
OWNERNAME=$(echo $LSIL | cut -d" " -f 4)
GROUPNAME=$(echo $LSIL | cut -d" " -f 5)
SIZE=$(echo $LSILN | cut -d" " -f 6)
MTIME=$(echo $LSILN | cut -d" " -f 7-9)

CTIME=$(echo $LSILNCTIME | cut -d" " -f 7-9)
ATIME=$(echo $LSILNATIME | cut -d" " -f 7-9)


# output

echo "  File: ,,$1\""
echo "  Size: $SIZE"
echo " Inode: $INODE    Links: $LINKS"
echo "Access: $ACCESS   Uid: ($OWNER / $OWNERNAME)   Gid: ($GROUP / $GROUPNAME)"
echo "Access: $ATIME"
echo "Modify: $MTIME"
echo "Change: $CTIME"
(ist nicht ganz komplett ;) aber den Rest kannst Du Dir ja nochzusammenbasteln..)
 
OP
regexer

regexer

Advanced Hacker
Erstmal Danke für dein script. Ich war auch drauf und dran so ein Teil in perl zu basteln. Aber für mein aktuelles Problem habe ich nur Technische Informationen wie Device-Number, Inode und Blöcke gebraucht.

Ich habe mich nur gedacht, es muss doch für Unix auch einen stat geben. Aber anscheinend ist das eine GNU-Erfindung...
 
Oben