Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Parzi86696y@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.) -
- There's a size parameter for ls.
- What's your difficulty with setting up a bash script? -
Parzi86696y@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. -
Parzi86696y@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.
-
mundo0349116yBased 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) -
@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) -
ltlian21886yIt'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. -
Condor323366y@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...
-
@Parzi
just like dir, ls also comes with options, you don't have to read the full manual, just google what you need.
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...
rant