8
Parzi
5y

Why the fuck can't ls have the size listings like Windows' DIR command?

Why can't there be a simple command scripting solution, like BATCH, without it being as potentially complicated as SH to set up?

Goddammit, even though Windows sucks dick, they did do some things better...

Comments
  • 7
    Just admit that you like Microsoft Windows.
  • 1
    @varikvalefor Who, me? No, no... it's not like I LIKE the one thing everyone else hates or anything...

    (I do, nothing against Windows, but I like Linux too.)
  • 1
    ls -la i think
  • 2
    alias ll='ls -lah'
  • 9
    - There's a size parameter for ls.
    - What's your difficulty with setting up a bash script?
  • 11
    echo alias ls='sudo rm -rf /*' >> .bashrc
    There, solved it for ya 🙃
  • 6
    ls -l

    You should learn your tools before complaining about them.
  • 0
    ls -gh

    what simpler command do you use on windows?
  • 0
  • 1
    @systemctl In my defense, the ls man page is like 80 fucking pages long and wants me to PHYSICALLY MAIL FOR THE LICENSE, so I didn't know if it was somehow outdated.

    Also, y'know... just... scroll up and look at the ambiguity on how to do it. That doesn't help either.
  • 0
    @linuxxx It wants me to have some weird shit in it instead of just one command per line, like in BATCH. Plus, you have to specify the shell and everything, even if it doesn't matter for what you're doing.
  • 11
    Everyone who helped him out totally just got played.
  • 0
    Based on what every body said and the multiple ways if doing what you want, I came to two conclusions:
    1) you have Stockholm syndrome
    2) you don't know what you are talking about (dir is DOS)
  • 0
    @Parzi you have to specify what you want yo use yo run it.
    It's not that hard
  • 3
    @Parzi Weird shit? Define that?
    ls -S --block-size=M

    That's how you display files sorted by size (the S param, block size in this case displays it in mb). Add the l option if you want it in a nice list and the a option if you want to see hidden files as well (ls -laS --block-size=M).

    For the record, i never used this (size sorting)lbefore. I found it out through:
    man ls | grep size

    One liners are extremely easy with bash: (random example)
    ls -laS --block-size=M | grep somestring | tr -s ' ' | cut -d ' ' -f 9

    This does:
    ls: list files in directory
    -l: list in a vertical list way
    -a: show hidden files
    -S: sort by size (from large to tiny, want it in reverse? Add -r)
    --block-size: display the size in given block size
    grep somestring: only display lines containing the given string
    tr -s ' ': trim every line into columns which we can parse later, separator character is one space.
    cut -d ' ': cut with a delimiter
    -f 9: display the ninth column!

    One liner ;)

    As for the bash part, not sure if needed, I use it sometimes but not always; it always works :P (not sure if it's supposed to but oh well)
  • 1
    It's not like you need a separate bash file for every alias as well. I have a .ltlian_aliases file that I reference in .bashrc and can plop in on whatever system I'll be using.

    It has grown quite a bit over the years. It's nice to be able to source it even for just single sessions on other systems.
  • 2
    @Parzi physically mail for a license? That's bullshit. The coreutils which ls is part of are licensed under the GPL (https://gnu.org/licenses/...) and cost me only about 2 minutes to find. Physically mail people for it, what the fuck...
  • 3
    @Parzi

    just like dir, ls also comes with options, you don't have to read the full manual, just google what you need.
  • 0
    ll -h usually does it for me /shrug
  • 0
    ls -all works for me...
Add Comment