Find the size of a single specific file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find the size of a single specific file
# 1  
Old 08-22-2006
Find the size of a single specific file

As I'm a newbie to UNIX, very newbie in fact, could anyone humour me and tell me how I'd find just the file size in bytes for a specific file?

Or at least just the specific line from the ls -a for the file - call it file1

I know this sounds bad but I don't seem to be getting very far at this one. How does one normally go about this simple task (I want to use the file size in a calculation)
# 2  
Old 08-22-2006
sorry, i mean

Code:
ls -l file1


Last edited by nortypig; 08-22-2006 at 08:44 AM..
# 3  
Old 08-22-2006
ls -l filename | awk '{print $5}'

if in programming lang - c
use stat command on the file
# 4  
Old 08-22-2006
thanks for the help, I know that one was a bit of a simple question but I had so forgotten about awk for some reason
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. HP-UX

How to view specific file size in HP UX?

Dear, Can anyone inform me the command to view specific file size in megabyte in hp-ux? (2 Replies)
Discussion started by: makauser
2 Replies

2. Shell Programming and Scripting

Find all the files under a specific directory and zip them into a single file.

Hi, Is there a way to find all the files from a specific location and then zip them into a single file, even if they are in multiple directories? (3 Replies)
Discussion started by: rudoraj
3 Replies

3. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

4. UNIX for Dummies Questions & Answers

How to separate a single column file into files of the same size (i.e. number of rows)?

I have a text file with 1,000,000 rows (It is a single column text file of numbers). I would like to separate the text file into 100 files of equal size (i.e. number of rows). The first file will contain the first 10,000 rows, the second row will contain the second 10,000 rows (rows 10,001-20,000)... (2 Replies)
Discussion started by: evelibertine
2 Replies

5. Shell Programming and Scripting

Find files of specific size excluding search in a subdirectory

Hi All, I was exploring find command and came across -prune option which would exclude search in a mention subdirectory. My quesry is to search all files more that 100 MB size but exclude search in a subdirectory. I am using below command,but somehow it is not working. Can anybody help me... (6 Replies)
Discussion started by: usha rao
6 Replies

6. Shell Programming and Scripting

find with file size and show the size

Hi All... is the below command be modified in sucha way that i can get the file size along with the name and path of the file the below command only gives me the file location which are more than 100000k...but I want the exact size of the file also.. find / -name "*.*" -size +100000k ... (3 Replies)
Discussion started by: rpraharaj84
3 Replies

7. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

8. AIX

Creat a File with a Specific Size

Hi everybody, Is there a command that can create a new file with a specific size? Thanks in advance. (3 Replies)
Discussion started by: aldowsary
3 Replies

9. UNIX for Dummies Questions & Answers

How to test for a specific file size

Hello, In my shell program, I need to test for a specific size of a text file before it can be imported into an oracle table. If the size is less than that number, my program should stop processing. What is the correct command to do this test? Thanks! (1 Reply)
Discussion started by: GEBRAUN
1 Replies
Login or Register to Ask a Question