If you want GNU ls features on FreeBSd, you can install the gnuls package and alias ls to gnuls.
If you want to stick to the base software, you can post-process the output of ls. (Script reposted from how do you sort du output by size?) This works on any POSIX system.
CLICOLOR_FORCE=1 ls | awk '
function human(x) {
s="kMGTEPYZ";
while (x>=1000 && length(s)>1)
{x/=1024; s=substr(s,2)}
return int(x+0.5) substr(s,1,1)
}
{gsub(/^[0-9]+/, human($1)); print}'
CLICOLOR_FORCE causes BSD ls to use colors even if it isn't writing to a terminal. On the other hand, because ls isn't writing to a terminal, you'll get one file per line instead of columns. On FreeBSD, you can use the option -C to get columns, but then the postprocessing script becomes a lot more complex since it needs to find sizes in the middle of the line. Try this (untested):
CLICOLOR_FORCE=1 ls -C | awk '
function human(x) {
s="kMGTEPYZ";
while (x>=1000 && length(s)>1)
{x/=1024; s=substr(s,2)}
return int(x+0.5) substr(s,1,1)
}
{gsub(/(^| )[0-9]+/, human($1)); print}'