Hi
I am using the command below to list the 10 biggest directories and files in my present directory
du -hs * | sort +0 | tail -10
the output is
8K disk-space
16K rish
32K WINDOWS
48K tests
104K imgvdEwLa.jpg
168K 020204_aerosmith_1024768.jdk
3.2M Acdc -... (4 Replies)
Hi
I have a file that is a fdupes output. I'd like to sort the duplicated file by size. The format file is the following:
5996544 bytes each:
/path1/to/file1.jpg
/path2/to/file1.jpg
/pathx/to/file1.jpg
... random number of lines
/path999/to/file1.jpg
591910 bytes each:... (2 Replies)
Hello,
I've done
ls -ls >fileout1
When I do the sort command for +4 it sorts it bu group. When I do +5 it sorts it by date. But it's skipping the file size column. Example:
rwxr-xr-x 1 Grueben sup 65 16 Sep 13:58 cdee
How can I sort it by file size? It doesn't... (2 Replies)
Can some one help in sorting the attached file.
I used cmd: sort -r jar1.txt -o sortedjar.txt , but it didnt work.
Thanks for your help in Advance. (6 Replies)
Input file:
100%ABC2 3.44E-12 USA
A2M%H02579 0E0 UK
100%ABC2 5.34E-8 UK
100%ABC2 3.25E-12 USA
A2M%H02579 5E-45 UK
Output file:
100%ABC2 3.44E-12 USA
100%ABC2 3.25E-12 USA
100%ABC2 5.34E-8 UK
A2M%H02579 0E0 UK
A2M%H02579 5E-45 UK
Code try:
sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Hello,
I'm trying to find top 5(highest) directories by size. I did something like du -sh * > $file
Where I can get all the size with respect to directories, but I need only top 5 directory from the file. How can I sort by size in the file and print top 5 sizes with the directory name???
... (3 Replies)
-rw-r--r-- 1 oracle oinstall 4 Jan 17 16:23 a
-rw-r--r-- 1 oracle oinstall 212 Jan 17 17:51 amar
-rw-r--r-- 1 oracle oinstall 32 Jan 17 17:30 b
-rw-r--r-- 1 oracle oinstall 246 Jan 17 15:40 h1.tar.gz
Hi,
I want combination of linux command to sort out the line which has 32k size.
... (5 Replies)
OS : RHEL 6.6
I want to list the files/directories sorted (Ascending or Desceding) by their size.
As you can see in the below example, du command doesn't sort by size.
In Linux world, is there any other command or workaround using du command to list the files/directories sorted by their... (6 Replies)
Discussion started by: John K
6 Replies
LEARN ABOUT PHP
stat
STAT(3) 1 STAT(3)stat - Gives information about a fileSYNOPSIS
array stat (string $filename)
DESCRIPTION
Gathers the statistics of the file named by $filename. If $filename is a symbolic link, statistics are from the file itself, not the sym-
link.
lstat(3) is identical to stat(3) except it would instead be based off the symlinks status.
PARAMETERS
o $filename
- Path to the file.
RETURN VALUES stat(3) and fstat(3) result format
+--------+--------------------------------------+---+
|Numeric | | |
| | | |
| | Associative | |
| | | |
| | Description | |
| | | |
+--------+--------------------------------------+---+
| 0 | | |
| | | |
| | dev | |
| | | |
| | device number | |
| | | |
| 1 | | |
| | | |
| | ino | |
| | | |
| | inode number * | |
| | | |
| 2 | | |
| | | |
| | mode | |
| | | |
| | inode protection mode | |
| | | |
| 3 | | |
| | | |
| | nlink | |
| | | |
| | number of links | |
| | | |
| 4 | | |
| | | |
| | uid | |
| | | |
| | userid of owner * | |
| | | |
| 5 | | |
| | | |
| | gid | |
| | | |
| | groupid of owner * | |
| | | |
| 6 | | |
| | | |
| | rdev | |
| | | |
| | device type, if inode device | |
| | | |
| 7 | | |
| | | |
| | size | |
| | | |
| | size in bytes | |
| | | |
| 8 | | |
| | | |
| | atime | |
| | | |
| | time of last access (Unix timestamp) | |
| | | |
| 9 | | |
| | | |
| | mtime | |
| | | |
| | time of last modification (Unix | |
| | timestamp) | |
| | | |
| 10 | | |
| | | |
| | ctime | |
| | | |
| | time of last inode change (Unix | |
| | timestamp) | |
| | | |
| 11 | | |
| | | |
| | blksize | |
| | | |
| | blocksize of filesystem IO ** | |
| | | |
| 12 | | |
| | | |
| | blocks | |
| | | |
| | number of 512-byte blocks allocated | |
| | ** | |
| | | |
+--------+--------------------------------------+---+
* On Windows this will always be 0.
** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1.
In case of error, stat(3) returns FALSE.
Note
Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results
for files which are larger than 2GB.
ERRORS /EXCEPTIONS
Upon failure, an E_WARNING is emitted.
EXAMPLES
Example #1
stat(3) example
<?php
/* Get file stat */
$stat = stat('C:phpphp.exe');
/*
* Print file access time, this is the same
* as calling fileatime()
*/
echo 'Access time: ' . $stat['atime'];
/*
* Print file modification time, this is the
* same as calling filemtime()
*/
echo 'Modification time: ' . $stat['mtime'];
/* Print the device number */
echo 'Device number: ' . $stat['dev'];
?>
Example #2
Using stat(3) information together with touch(3)
<?php
/* Get file stat */
$stat = stat('C:phpphp.exe');
/* Did we failed to get stat information? */
if (!$stat) {
echo 'stat() call failed...';
} else {
/*
* We want the access time to be 1 week
* after the current access time.
*/
$atime = $stat['atime'] + 604800;
/* Touch the file */
if (!touch('some_file.txt', time(), $atime)) {
echo 'Failed to touch file...';
} else {
echo 'touch() returned success...';
}
}
?>
NOTES
Note
Note that time resolution may differ from one file system to another.
Note
The results of this function are cached. See clearstatcache(3) for more details.
Tip
As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to "Supported Protocols and Wrappers" to determine
which wrappers support stat(3) family of functionality.
SEE ALSO lstat(3), fstat(3), filemtime(3), filegroup(3).
PHP Documentation Group STAT(3)