Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I must be bad at using Google or something because I can't even find out how to get the file size of a file using the Terminal. I have two ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2005
    Location
    Central Canada
    Posts
    29

    Terminal Help


    I must be bad at using Google or something because I can't even find out how to get the file size of a file using the Terminal. I have two partitions: one with linux and one with winxp and I have it mounted. I would like to see the file sizes on the WinXP partition because I can't boot up WinXP.

    If someone wouldn't mind being patient with my rediculously easy questions, please answer:

    1) How to read information of a file using the terminal (namely the size)
    2) How to transfer files over LANi) without click and drag, (ii) using smb:// or using another method without the "user@domain.com" etc

    I'm using Ubuntu 5.04

  2. #2
    Linux Newbie
    Join Date
    Jul 2005
    Location
    Turn Around
    Posts
    202
    'ls -laF' should show filesize i think

    if u cant see all the files in the folder type 'ls -laF | more'

  3. #3
    Just Joined!
    Join Date
    Aug 2005
    Location
    Central Canada
    Posts
    29
    How is the file size formatted? It shows a list with numbers beside it. However, I know a few of my folders are well over 3 GB on my Desktop and it shows one mp3 as being bigger

    Code:
    dr-x------  1 root root   32768 2005-08-03 18:38 ./
    dr-x------  1 root root    4096 2005-08-03 19:03 ../
    -r--------  2 root root     129 2005-07-25 00:03 3\uffff Floppy (A).lnk
    dr-x------  1 root root   40960 2005-08-02 16:06 Applications/
    -r--------  2 root root     145 2005-07-25 00:09 CD & DVD Drive (D).lnk
    -r--------  2 root root     129 2005-07-25 00:03 CD & DVD Drive (E).lnk
    -r--------  2 root root     182 2005-07-24 23:50 CD & DVD Drive (F).lnk
    -r--------  1 root root      80 2005-03-19 22:01 desktop.ini
    dr-x------  1 root root   28672 2005-08-03 17:03 Files/
    -r--------  2 root root 6480307 2005-08-03 18:34 song.mp3

  4. #4
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,414
    It shows the file size in bytes, so song.mp3 is about 6MB. The folders are only a few kB as it is not reporting the size of the contents of the folder. In linux it is said that everything is a file, and this applies for folders as well. Folders are really only files that point towards the hard disc location of the files they "contain" -- so when it reports the size as a few kB, this is just the size of the file containing the folder info. Understand??

    I'm afraid I'm not sure how to find the size of the folders contents on a command line, sorry.
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  5. #5
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    To find the size of a folder in human readable form:
    Code:
    du -sh folder
    And then in kilobytes, megabytes and bytes respectively:
    Code:
    du -sk folder
    du -sm folder
    du -sb folder

  6. #6
    Just Joined!
    Join Date
    Aug 2005
    Location
    Central Canada
    Posts
    29
    Ah okay, that makes sense. This line is very useful.

    If you cannot see the folder size using cmd line, is there another way to see the folder size? I know you can right-hand click the folder. But the windows folder is locked.

    To me, it's obvious, but I would like to clerify: since you cannot use that line to see the content size, that command still works for .rar and .zip files right? I see the .rar file of the mp3 is a little bit smaller as it should be.

    Thanks DoctorDan and smolloy

    Edit: I typed this post before seeing yours, lakerdonald. Thanks.

  7. #7
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Well the only reason you wouldn't be able to see the size of a directory (Linux doesn't have 'folders') is if you don't have proper permissions, which means you probably shouldn't be there anyway. But yes that command will work on a file, however the -s option to du isn't necessary (since -s means Total)

  8. #8
    Just Joined!
    Join Date
    Aug 2005
    Location
    Central Canada
    Posts
    29
    That helps me a lot Thanks

    All I need now is to figure how to access my Network files on my other computer using the terminal. What are the cmds for that? I Google'd network file transfer and other wordings, they all came back with scp user@domain.net /filepath . How would that apply to me? There is no account name or domain.

  9. #9
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    What kind of box is the other computer?

  10. #10
    Just Joined!
    Join Date
    Aug 2005
    Location
    Central Canada
    Posts
    29
    All I know is:

    AMD Athlon 900 MHz
    RAM: 2x256 MB
    Harddrive Capacity: 40 GB
    OS: WinXP Home
    Vid Card: ATI ASUS 9200 SE

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •