A standard alias
will not work, however you may declare a operate in ~/.zshrc
that ought to do what you want. It makes use of a case
conditional that can help you add different choices for ls
:
operate ls() {
case $* in
-lO* ) shift 1; command /bin/ls -lO "$@" ;;
* ) command ls "$@" ;;
esac
}
Word that for the -lO
possibility; the “Apple-sourced” model of ls
at /bin/ls
is executed, whereas (as proven above) all different choices are handed by to the GNU/MacPorts model of ls
. After all this assumes that your PATH
surroundings is about to favor the GNU utilities; one thing like this:
% echo $PATH
/choose/native/libexec/gnubin:/choose/native/bin:/choose/native/sbin:/usr/native/bin:/usr/bin:/bin:/usr/sbin:/sbin
To take impact it is best to add the operate definition above to your ~/.zshrc
file, after which supply
it to (every) shell you intend to make use of. After including the ls
operate to ~/.zshrc
, it may be supply
d as follows:
% supply ~/.zshrc
--OR--
% . ~/.zshrc
After sourcing ~/.zshrc
, we are able to confirm appropriate operation as follows:
% ls -lO /and so forth/auto_master
-rw-r--r-- 1 root wheel schg 284 Feb 13 22:47 /and so forth/auto_master
# ^^^^^^^^
% ls --version
ls (GNU coreutils) 9.5
Copyright (C) 2024 Free Software program Basis, Inc.
License GPLv3+: GNU GPL model 3 or later .
That is free software program: you might be free to vary and redistribute it.
There may be NO WARRANTY, to the extent permitted by legislation.
Written by Richard M. Stallman and David MacKenzie.