Sponsored Content
Top Forums Shell Programming and Scripting list the files with size in bytes Post 302098693 by matrixmadhan on Wednesday 6th of December 2006 02:48:57 AM
Old 12-06-2006
by default ls lists the file size in bytes

Code:
ls -l | awk '{print $9"   -    "$5}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email message if file size > 0 bytes

I want to create a script that emails a file created by Informix Ace if the file size is > 0. It is a list of exceptions. No exceptions...no message This does not work: THESIZE=`ls -lA /tmp/ds_treo.txt | awk -F' ' '{print $5}'` if then (cat $DSDIR/ds_treo.txt) | mail -s "Treo... (1 Reply)
Discussion started by: poste_d_ordure
1 Replies

2. UNIX for Dummies Questions & Answers

file size in bytes is different in ftp and local pc

Hi how can it be that say i have text (xls) file that is 661 bytes when i upload it to Solaris ftp its becomes 650 byes and when i downloading it back its again 661 bytes both in my local pc and Solaris ftp the file remains not corrupted and valid (2 Replies)
Discussion started by: umen
2 Replies

3. UNIX for Dummies Questions & Answers

How to get the size of process in Bytes

Hi All, We have the commands top and ps through which we can find out the size of the running process. These commnds are giving the size of my process in MB after rounding of the size. Is there any way by which I can get the size of my process in Bytes or KBytes. Any help would be greatly... (2 Replies)
Discussion started by: darshi
2 Replies

4. UNIX for Dummies Questions & Answers

SIZE OF FILES STORE IN WHICH FORMAT bytes or kb in unix?

Hi, i need to know regarding the size type of the files in unix environment.. whether a files or directory will store in which format? kb or bytes ? please answer to my question... thanks & regards, kamal (1 Reply)
Discussion started by: G.K.K
1 Replies

5. Shell Programming and Scripting

How to find size 0-4 bytes files?

Hi I need to find and delete 0-4 bytes size files in a folder. How can I achieve that? (1 Reply)
Discussion started by: kapilk
1 Replies

6. Shell Programming and Scripting

How to see the list of files which exists with nonzero bytes

Hi, I would like to see the file list which contains the data. Ex : - When I enter the "ls -ltr" command it will show all the files which are exists in the directory, But I want only those files list which are non zero byte by using only ls command. I knew that I can write a script with... (12 Replies)
Discussion started by: kandi.reddy
12 Replies

7. UNIX for Dummies Questions & Answers

How to list files which have same size?

Hi guys, I need to do 100 files comparison after I sorted the files. There are no specific key for sorting so i plan to arrange the files based on the file size. The command that i used to sort the files by size is as per below:- ls -l | sort +4rn | awk '{print $5, $9}' The problem that i... (3 Replies)
Discussion started by: shahril
3 Replies

8. Shell Programming and Scripting

Error PHP Fatal error: Allowed memory size of 67108864 bytes exhausted(tried to allocate 401 bytes)

While running script I am getting an error like Few lines in data are not being processed. After googling it I came to know that adding such line would give some memory to it ini_set("memory_limit","64M"); my input file size is 1 GB. Is that memory limit is based on RAM we have on... (1 Reply)
Discussion started by: elamurugu
1 Replies

9. Shell Programming and Scripting

Help printing files in ascending order of the fi le size (in bytes)

Hey guys I'm new to unix and need help printing files in a specified directory according to size in bytes as well as files with equal bites in alphabetical order the part i have done so far prints out all files in the directory as well as setting a time limit in which they have been modified ... (2 Replies)
Discussion started by: wessy
2 Replies

10. UNIX for Dummies Questions & Answers

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

Hello guys. I really hope someone will help me with this one.. So, I have to write this script who: - creates a file home/student/vmdisk of 10 mb - formats that file to ext3 - mounts that partition to /mnt/partition - creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies
TRUNCATE(1)						    BSD General Commands Manual 					       TRUNCATE(1)

NAME
truncate -- truncate or extend the length of files SYNOPSIS
truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ... truncate [-c] -r rfile file ... DESCRIPTION
The truncate utility adjusts the length of each regular file given on the command-line. The following options are available: -c Do not create files if they do not exist. The truncate utility does not treat this as an error. No error messages are displayed and the exit value is not affected. -r rfile Truncate or extend files to the length of the file rfile. -s [+|-]size[K|k|M|m|G|g|T|t] If the size argument is preceded by a plus sign (+), files will be extended by this number of bytes. If the size argument is pre- ceded by a dash (-), file lengths will be reduced by no more than this number of bytes, to a minimum length of zero bytes. Other- wise, the size argument specifies an absolute length to which all files should be extended or reduced as appropriate. The size argument may be suffixed with one of K, M, G or T (either upper or lower case) to indicate a multiple of Kilobytes, Megabytes, Gigabytes or Terabytes respectively. Exactly one of the -r and -s options must be specified. If a file is made smaller, its extra data is lost. If a file is made larger, it will be extended as if by writing bytes with the value zero. If the file does not exist, it is created unless the -c option is specified. Note that, while truncating a file causes space on disk to be freed, extending a file does not cause space to be allocated. To extend a file and actually allocate the space, it is necessary to explicitly write data to it, using (for example) the shell's '>>' redirection syntax, or dd(1). EXIT STATUS
The truncate utility exits 0 on success, and >0 if an error occurs. If the operation fails for an argument, truncate will issue a diagnostic and continue processing the remaining arguments. SEE ALSO
dd(1), touch(1), truncate(2) STANDARDS
The truncate utility conforms to no known standards. HISTORY
The truncate utility first appeared in FreeBSD 4.2. AUTHORS
The truncate utility was written by Sheldon Hearn <sheldonh@starjuice.net>. BSD
December 19, 2006 BSD
All times are GMT -4. The time now is 07:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy