LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-04-2008, 02:13 PM   #16
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57

Quote:
Originally Posted by Nylex View Post
ls -lh | awk '{print $8 " " $5}'

Example output:

1024_wallpaper.jpg 169K
Desktop 4.0K
Downloads 4.0K
IC 4.0K
Music 12K
PhD 4.0K
Pictures 4.0K
README_PXE.TXT 27K
UKPEW08 4.0K
how do you do when you have spaces in filenames ?
 
Old 11-04-2008, 03:14 PM   #17
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Just use stat like it's been said a thousand times already. If you need to elaborate a list of files use it in conjunction with find.

Code:
find /path/to/dir -name '*' <whatever-else-you-want-to-find> -exec stat --format='%n %s' '{}' \;
This will work regardless of the spaces or any other special stuff in the file names. It's also the proper way to do it. Parsing the output from ls is something that I always discourage.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a simple script for installing a list of files zbenjudah Debian 28 04-16-2007 03:03 PM
How do I produce sorted list of files in current directory over a certain size? bangback Linux - Newbie 3 10-25-2006 12:11 AM
Samba can create new files and folders but access denied in any new folders k.king Linux - Networking 2 01-15-2006 06:14 AM
cant save or create files/folders on drives. felonius Linux - Newbie 9 11-07-2004 03:18 PM
how do i limit a folders size? darklordzim Linux - Newbie 1 05-31-2004 06:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration