Skip to content

Support for du command #679

Closed
Closed

Description

@tlightsky

like the du command in linux or osx

Activity

  1. sophiajt commented on Sep 17, 2019

    @sophiajt
    Contributor

    We don't have aliases yet to make it short, but you can get du-like data from:

    sys | get disks
    
  2. tlightsky commented on Sep 18, 2019

    @tlightsky
    Author
    ----------+----------+----------+------------+----------
     host     | cpu      | mem      | net        | battery 
    ----------+----------+----------+------------+----------
     [object] | [object] | [object] | [20 items] | [1 item] 
    ----------+----------+----------+------------+----------
    

    my sys seems different

  3. sophiajt commented on Sep 18, 2019

    @sophiajt
    Contributor

    @tlightsky - what system and version of the system are you on? It looks like the software we use to detect the disks isn't working

  4. tlightsky commented on Sep 19, 2019

    @tlightsky
    Author

    OSX 10.14.6
    nushell 0.1.3

  5. sophiajt commented on Sep 19, 2019

    @sophiajt
    Contributor

    @tlightsky - are you able to build nushell from source? We've done fixes to the sys command since that release, which might help fix the issue you're seeing. We'll also be putting out a release in a few weeks, which will also have the fixes.

  6. tlightsky commented on Sep 19, 2019

    @tlightsky
    Author

    cargo run in nushell master branch

    > sys 
    error: No such file or directory (os error 2)
    
  7. sophiajt commented on Sep 19, 2019

    @sophiajt
    Contributor

    @tlightsky - when building you may need to do cargo build && cargo run to make sure all the plugins are built.

  8. tlightsky commented on Sep 20, 2019

    @tlightsky
    Author

    still no disks

    /Users/me/source/rust/nushell(master)> sys
    ━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━
     host           │ cpu            │ mem            │ net              │ battery 
    ────────────────┼────────────────┼────────────────┼──────────────────┼────────────────
     [table: 1 row] │ [table: 1 row] │ [table: 1 row] │ [table: 20 rows] │ [table: 1 row] 
    ━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━
    

    btw, what i want is the du command to list all folders and the size of them inside current folder,
    not df command which give me an overview of sytem disks status

  9. andrasio commented on Sep 20, 2019

    @andrasio
    Member

    I can confirm disks isn't displayed on my mac.

  10. sophiajt commented on Sep 22, 2019

    @sophiajt
    Contributor

    @svartalf - do you happen to know why the disks aren't showing up for some folks?

  11. svartalf commented on Sep 23, 2019

    @svartalf
    Contributor

    Hey! My guess goes to the lack of apfs filesystem support at the heim::disks::FileSystem, as without it heim::disks::partitions_physical will not yield such a partitions.

    Corresponding issue is here, and it can be tested with these lines at the Nu' Cargo.toml file:

    [patch.crates-io]
    heim = { git = "https://github.com/heim-rs/heim.git", branch = "disks-apfs-filesystem" }

    @tlightsky @andrasio could you help with that?

    @jonathandturner that would require bumping heim version later, but I were not planning to release 0.8.0 soon, as there are few issues I want to close first. Is it okay for Nu to use alpha versions, like heim = "0.8.0-alpha.1"?

  12. sophiajt commented on Sep 23, 2019

    @sophiajt
    Contributor

    @svartalf - as long as the version is published on crates.io, I'm okay moving to it

  13. thegedge commented on Oct 13, 2019

    @thegedge
    Contributor

    Verified that sys | get disks is working for me with 0.8.0-alpha.1 (OSX 10.14.6). 0.8.0 is released now though, so I could go ahead and bump.

  14. sophiajt commented on Oct 13, 2019

    @sophiajt
    Contributor

    @thegedge sounds good, if you want to send a PR I'll approve

  15. thegedge commented on Oct 13, 2019

    @thegedge
    Contributor

    Looks like #813 actually bumped it in Cargo.lock. Probably no need to worry about bumping until the next release?

  16. 1 remaining item

  17. thegedge commented on Oct 13, 2019

    @thegedge
    Contributor

    Sounds good! I'll send a quick PR.

  18. sophiajt commented on Oct 14, 2019

    @sophiajt
    Contributor

    I'm going to go ahead and close since the original issue should be fixed. I'd like to be able to add aliases to be able to squeeze this down to a du alias, but we're tracking that elsewhere.

    Thanks again.

  19. thegedge commented on Oct 14, 2019

    @thegedge
    Contributor

    I intended to mention that one thing du does that sys doesn't seem to be able to provide is usage for directories. For example, in the nushell source directory:

    $ du -hd1
     32K	./docker
     36K	./debian
    2.9M	./images
    3.2G	./target
    172K	./tests
    148K	./docs
      0B	./.cargo
    8.0K	./.github
    8.4M	./.git
    524K	./assets
    8.0K	./.circleci
    4.0K	./.azure
    1.2M	./src
    3.3G	.
    

    sys | get disks seems more akin to df.

  20. sophiajt commented on Oct 15, 2019

    @sophiajt
    Contributor

    That's a good point. I was reading one and thinking the other. Let me reopen in case someone wants to create the du equivalent.

  21. andrasio commented on Nov 3, 2019

    @andrasio
    Member
  22. added
    category:enhancement
    on Nov 3, 2019
  23. Freaky commented on Jan 31, 2020

    @Freaky

    A du command was merged in d48f99c - albeit a naive one. Compare/contrast:

     12 │ target    │   1.9 GB │ [table 2 rows]
    
    833M    ./target # du --si
    1.6G    ./target # du --si -A
    1.9G    ./target # du --si -Al
    

    i.e. it considers only the apparent size of files, and doesn't do hardlink tracking for files with link counts >1.

  24. coolshaurya commented on Jan 31, 2020

    @coolshaurya
    Contributor

    I believe this issue was fixed in PR #1250 .

  25. thegedge commented on Jan 31, 2020

    @thegedge
    Contributor

    Agree with @Freaky that there are improvements we can make, but @coolshaurya is right that this was already resolved by #1250.

    For specific improvements to du, we can open additional issues 🙂

    Thanks everyone!

    [EDIT]
    #1317 for not counting hard links more than once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions