Sponsored Content
Top Forums Shell Programming and Scripting Get size of a file using ls on all UNIX OSes Post 302801799 by SkySmart on Thursday 2nd of May 2013 02:26:28 PM
Old 05-02-2013
Get size of a file using ls on all UNIX OSes

to get the most granular size of a file, you can do so with:
Code:
solaris hosts:

ls -l /tmp/filea | awk '{print $4}'

Code:
linux hosts:

ls -l /tmp/filea | awk '{print $5}'

Is there a more universal command that will give the file size?

i'm leery of this ls command because the fields in which the file size can be found differs on sunos and linux, and i'm not even sure if it is also like that with other unix oses.

so, is there a command that can accomplish the above without needing to check a field/column which, for all we know, wont be the same on another unix os.

i've tried "du -s". but that doesn't seem to work across all unix systems.

Last edited by SkySmart; 05-02-2013 at 07:06 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Hp Unix file size problem

We have two files /var/adm/wtmp and /var/opt/OV/tmp/OpC/guiagtdf Could you please tell me if what these files are and if I can purge them as they are very big and Vi will not let me look at them, it gives me a message 'file to long'. Help any ideas Thanks :cool: (3 Replies)
Discussion started by: A Roberts
3 Replies

2. HP-UX

Unix file size - HP-UX

Hi All, Currently we are using HP-UX machine.. We are facing problems with respect to file size. The file size does not seem to be exceeding 2 GB. Could you please let me know the following 1. Is there any difference between a 32 bit application and 64 bit application with respect to file... (2 Replies)
Discussion started by: krishna7
2 Replies

3. Shell Programming and Scripting

File size limitation of unix sort command.

hi , iam trying to sort millions of records which is delimited and i cant able to use sort command more than 60 million..if i try to do so i got an message stating that "File size limit exceeded",Is there any file size limit for using sort command.. How can i solve this problem. thanks ... (7 Replies)
Discussion started by: cskumar
7 Replies

4. Filesystems, Disks and Memory

unix file size becomes zero

Hi, when can a unix library file size become zero? For example.: can mistyping this command -> /usr/ucb/ps -auxww|grep -i <process name> make the "ps" library file size to become zero or its contents to get deleted? Is there any other way that an inadvertant mistake could cause the file size to... (1 Reply)
Discussion started by: ananthmm
1 Replies

5. UNIX for Dummies Questions & Answers

file size different in unix and windows

I have a file on solaris/linux. ls -ls shows the logical size to be: 13292 However, when I transfer the file to my windows machine.. Rightclick->Properties shows the file size as: 13421 I wrote a small program on unix and windows that does a stat() on the file and reports the st_size... (6 Replies)
Discussion started by: the_learner
6 Replies

6. UNIX for Dummies Questions & Answers

Maximum size of a file in unix

What's the maximum file size supported by unix. (3 Replies)
Discussion started by: nagalenoj
3 Replies

7. UNIX for Dummies Questions & Answers

what's the Linux|Unix OSes works on Servers

Hi everybody , I'm new here in the forum and new Dummy in L|U systems (Hope finding welcomes...:)). I just want to ask : What is the OS's that works on servers and the OS's that work as client OS?? I just know that Solaris Work on sarvers :D.. and i'm glad to be memmber in this... (1 Reply)
Discussion started by: derbi
1 Replies

8. UNIX for Advanced & Expert Users

how to find the file size in unix

Anybody can help HOW TO FIND THE FILE SIZE IN UNIX (5 Replies)
Discussion started by: lmraochodisetti
5 Replies

9. Shell Programming and Scripting

Unix file empty.. but size is greater than zero??/

Hi, I have a file by redirecting some contents in unix shell. Even when there is no content that is being redirected, the file size still shows greater than zero. but even if there is no matching pattern the file APPRES has size greater than 0bytes. awk -f AA.awk $logfile>APPRES... (3 Replies)
Discussion started by: justchill
3 Replies

10. UNIX for Beginners Questions & Answers

Get the remote server file size in UNIX

Hi All, I am trying to sftp, get a file from remote server. Post this we need to check the remote server file size or checksum value of the remote server file and compare it with the file size in the current server. But I am facing issue to get the remote server file size. Could you please... (2 Replies)
Discussion started by: abhi_123
2 Replies
IRSEND(1)								FSF								 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.8.7pre1 May 2010 IRSEND(1)
All times are GMT -4. The time now is 04:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy