I'm using Zsh on macOS Big Sur (11.7.4), and in my Terminal I am trying to look at ownership (user & group) of files in the current folder. I want to know the user as well as the group of my files using the ls -la
command.
In the Bash shell on macOS, the command:
ls -la
in the /Users/
folder returns:
drwxr-xr-x 5 root admin 160 Jan 1 2020 .
drwxr-xr-x 20 root wheel 640 Jan 1 2020 ..
-rw-r--r-- 1 root wheel 0 Jan 1 2020 .localized
drwxrwxrwt 14 root wheel 448 Feb 16 00:25 Shared
drwxr-xr-x@ 71 Danran staff 2272 Feb 17 09:41 Danran
This clearly shows that the user of the /User/Danran
folder is "Danran" and the group that it belongs to is "staff".
However, when switching back to Zsh and entering the command ls -la
on the /Users/
folder it returns:
total 0
drwxr-xr-x 5 root 160 Jan 1 2020 .
drwxr-xr-x 20 root 640 Jan 1 2020 ..
-rw-r--r-- 1 root 0 Jan 1 2020 .localized
drwxrwxrwt 14 root 448 Feb 16 00:25 Shared
drwxr-xr-x+ 71 Danran 2272 Feb 17 09:47 Danran
As you can see, in the Zsh command, it only shows the user name, but does not show the group name.
My question is, how can I get Zsh in macOS to show the username and group name using the ls -la
command, and if I can't, what command should I use in Zsh to list both users and groups of files and folders?
UPDATE: The output of the alias
command is:
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -1'
2='cd -2'
3='cd -3'
32x='ykr && rl && ssh 32x'
32xroot='ykr && rl && ssh 32xroot'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
CA='2>&1 | cat -A'
G='| grep'
H='| head'
HOMEBREW_NO_AUTO_UPDATE=1
L='| less'
LL='2>&1 | less'
M='| most'
NE='2> /dev/null'
NUL='> /dev/null 2>&1'
P='2>&1| pygmentize -l pytb'
T='| tail'
_='sudo '
ali='nano -c ~/.aliases'
autobrewoff=export
autobrewon=export
bcubc='brew upgrade --cask && brew cleanup'
bcubo='brew update && brew outdated --cask'
bfu='brew upgrade --formula'
bp='nano ~/.bash_profile'
brewp='brew pin'
brewsp='brew list --pinned'
brewup='brew update; brew upgrade; brew update --cask; brew upgrade --cask; brew cleanup; brew doctor'
brewup2='brew upgrade --cask --greedy; brew outdated --cask --greedy --verbose | grep -v '\''(latest)'\'' | awk '\''{print }'\'' | xargs brew cask reinstall'
bubc='brew upgrade && brew cleanup'
bubo='brew update && brew outdated'
bubu='bubo && bubc'
bubug='bubo && bugbc'
bugbc='brew upgrade --greedy && brew cleanup'
buz='brew uninstall --zap'
caskup='brew cu --all'
ccat=colorize_cat
cless=colorize_less
cmds='cat ~/.aliases'
cp='cp -i'
dec2='ykr && rl && ssh dec2'
dec2def='ykr && rl && ssh dec2def'
disks='diskutil list'
dpr10='sudo gdd if=/dev/urandom of=/dev/rdisk10 bs=1M count=50 status=progress'
dpr2='sudo gdd if=/dev/urandom of=/dev/rdisk2 bs=1M count=50 status=progress'
dpr3='sudo gdd if=/dev/urandom of=/dev/rdisk3 bs=1M count=50 status=progress'
dpr4='sudo gdd if=/dev/urandom of=/dev/rdisk4 bs=1M count=50 status=progress'
dpr5='sudo gdd if=/dev/urandom of=/dev/rdisk5 bs=1M count=50 status=progress'
dpr6='sudo gdd if=/dev/urandom of=/dev/rdisk6 bs=1M count=50 status=progress'
dpr7='sudo gdd if=/dev/urandom of=/dev/rdisk7 bs=1M count=50 status=progress'
dpr8='sudo gdd if=/dev/urandom of=/dev/rdisk8 bs=1M count=50 status=progress'
dpr9='sudo gdd if=/dev/urandom of=/dev/rdisk9 bs=1M count=50 status=progress'
dpz10='sudo gdd if=/dev/zero of=/dev/rdisk10 bs=1M count=50 status=progress'
dpz2='sudo gdd if=/dev/zero of=/dev/rdisk2 bs=1M count=50 status=progress'
dpz3='sudo gdd if=/dev/zero of=/dev/rdisk3 bs=1M count=50 status=progress'
dpz4='sudo gdd if=/dev/zero of=/dev/rdisk4 bs=1M count=50 status=progress'
dpz5='sudo gdd if=/dev/zero of=/dev/rdisk5 bs=1M count=50 status=progress'
dpz6='sudo gdd if=/dev/zero of=/dev/rdisk6 bs=1M count=50 status=progress'
dpz7='sudo gdd if=/dev/zero of=/dev/rdisk7 bs=1M count=50 status=progress'
dpz8='sudo gdd if=/dev/zero of=/dev/rdisk8 bs=1M count=50 status=progress'
dpz9='sudo gdd if=/dev/zero of=/dev/rdisk9 bs=1M count=50 status=progress'
dr10='sudo gdd if=/dev/urandom of=/dev/rdisk10 bs=1M status=progress'
dr2='sudo gdd if=/dev/urandom of=/dev/rdisk2 bs=1M status=progress'
dr3='sudo gdd if=/dev/urandom of=/dev/rdisk3 bs=1M status=progress'
dr4='sudo gdd if=/dev/urandom of=/dev/rdisk4 bs=1M status=progress'
dr5='sudo gdd if=/dev/urandom of=/dev/rdisk5 bs=1M status=progress'
dr6='sudo gdd if=/dev/urandom of=/dev/rdisk6 bs=1M status=progress'
dr7='sudo gdd if=/dev/urandom of=/dev/rdisk7 bs=1M status=progress'
dr8='sudo gdd if=/dev/urandom of=/dev/rdisk8 bs=1M status=progress'
dr9='sudo gdd if=/dev/urandom of=/dev/rdisk9 bs=1M status=progress'
dud='du -d 1 -h'
duf='du -sh *'
dz10='sudo gdd if=/dev/zero of=/dev/rdisk10 bs=1M status=progress'
dz2='sudo gdd if=/dev/zero of=/dev/rdisk2 bs=1M status=progress'
dz3='sudo gdd if=/dev/zero of=/dev/rdisk3 bs=1M status=progress'
dz4='sudo gdd if=/dev/zero of=/dev/rdisk4 bs=1M status=progress'
dz5='sudo gdd if=/dev/zero of=/dev/rdisk5 bs=1M status=progress'
dz6='sudo gdd if=/dev/zero of=/dev/rdisk6 bs=1M status=progress'
dz7='sudo gdd if=/dev/zero of=/dev/rdisk7 bs=1M status=progress'
dz8='sudo gdd if=/dev/zero of=/dev/rdisk8 bs=1M status=progress'
dz9='sudo gdd if=/dev/zero of=/dev/rdisk9 bs=1M status=progress'
efi='sudo mkdir /Volumes/ESP && sudo mount -t msdos /dev/disk0s1 /Volumes/ESP/'
egrep='egrep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
ej10='diskutil eject /dev/disk9 && echo "Disk 10 Ejected." || "Disk 10 NOT Ejected."'
ej2='diskutil eject /dev/disk2 && echo "Disk 2 Ejected." || "Disk 2 NOT Ejected."'
ej3='diskutil eject /dev/disk3 && echo "Disk 3 Ejected." || "Disk 3 NOT Ejected."'
ej4='diskutil eject /dev/disk4 && echo "Disk 4 Ejected." || "Disk 4 NOT Ejected."'
ej5='diskutil eject /dev/disk5 && echo "Disk 5 Ejected." || "Disk 5 NOT Ejected."'
ej6='diskutil eject /dev/disk6 && echo "Disk 6 Ejected." || "Disk 6 NOT Ejected."'
ej7='diskutil eject /dev/disk7 && echo "Disk 7 Ejected." || "Disk 7 NOT Ejected."'
ej8='diskutil eject /dev/disk8 && echo "Disk 8 Ejected." || "Disk 8 NOT Ejected."'
ej9='diskutil eject /dev/disk9 && echo "Disk 9 Ejected." || "Disk 9 NOT Ejected."'
ejefi='diskutil unmount /dev/disk0s1'
fbox='ykr && rl && ssh fbox'
fd='find . -type d -name'
ff='find . -type f -name'
fgrep='fgrep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}'
flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder'
g=git
ga='git add'
gaa='git add --all'
gam='git am'
gama='git am --abort'
gamc='git am --continue'
gams='git am --skip'
gamscp='git am --show-current-patch'
gap='git apply'
gapa='git add --patch'
gapt='git apply --3way'
gau='git add --update'
gav='git add --verbose'
gb='git branch'
gbD='git branch --delete --force'
gba='git branch --all'
gbd='git branch --delete'
gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null'
gbl='git blame -b -w'
gbnm='git branch --no-merged'
gbr='git branch --remote'
gbs='git bisect'
gbsb='git bisect bad'
gbsg='git bisect good'
gbsr='git bisect reset'
gbss='git bisect start'
gc='git commit --verbose'
'gc!'='git commit --verbose --amend'
gca='git commit --verbose --all'
'gca!'='git commit --verbose --all --amend'
gcam='git commit --all --message'
'gcan!'='git commit --verbose --all --no-edit --amend'
'gcans!'='git commit --verbose --all --signoff --no-edit --amend'
gcas='git commit --all --signoff'
gcasm='git commit --all --signoff --message'
gcb='git checkout -b'
gcd='git checkout $(git_develop_branch)'
gcf='git config --list'
gcl='git clone --recurse-submodules'
gclean='git clean --interactive -d'
gcm='git checkout $(git_main_branch)'
gcmsg='git commit --message'
'gcn!'='git commit --verbose --no-edit --amend'
gco='git checkout'
gcor='git checkout --recurse-submodules'
gcount='git shortlog --summary --numbered'
gcp='git cherry-pick'
gcpa='git cherry-pick --abort'
gcpc='git cherry-pick --continue'
gcs='git commit --gpg-sign'
gcsm='git commit --signoff --message'
gcss='git commit --gpg-sign --signoff'
gcssm='git commit --gpg-sign --signoff --message'
gd='git diff'
gd10='sudo gdisk /dev/disk10'
gd2='sudo gdisk /dev/disk2'
gd3='sudo gdisk /dev/disk3'
gd4='sudo gdisk /dev/disk4'
gd5='sudo gdisk /dev/disk5'
gd6='sudo gdisk /dev/disk6'
gd7='sudo gdisk /dev/disk7'
gd8='sudo gdisk /dev/disk8'
gd9='sudo gdisk /dev/disk9'
gdca='git diff --cached'
gdct='git describe --tags $(git rev-list --tags --max-count=1)'
gdcw='git diff --cached --word-diff'
gds='git diff --staged'
gdt='git diff-tree --no-commit-id --name-only -r'
gdup='git diff @{upstream}'
gdw='git diff --word-diff'
gf='git fetch'
gfa='git fetch --all --prune --jobs=10'
gfg='git ls-files | grep'
gfo='git fetch origin'
gg='git gui citool'
gga='git gui citool --amend'
ggpull='git pull origin "$(git_current_branch)"'
ggpur=ggu
ggpush='git push origin "$(git_current_branch)"'
ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
ghh='git help'
gignore='git update-index --assume-unchanged'
gignored='git ls-files -v | grep "^[[:lower:]]"'
git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
github='ykr && rl && ssh github'
gk='\gitk --all --branches &!'
gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
gl='git pull'
glg='git log --stat'
glgg='git log --graph'
glgga='git log --graph --decorate --all'
glgm='git log --graph --max-count=10'
glgp='git log --stat --patch'
glo='git log --oneline --decorate'
globurl='noglob urlglobber '
glod='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'\'
glods='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'\'' --date=short'
glog='git log --oneline --decorate --graph'
gloga='git log --oneline --decorate --graph --all'
glol='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\'
glola='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\'' --all'
glols='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\'' --stat'
glp=_git_log_prettily
gluc='git pull upstream $(git_current_branch)'
glum='git pull upstream $(git_main_branch)'
gm='git merge'
gma='git merge --abort'
gmom='git merge origin/$(git_main_branch)'
gmtl='git mergetool --no-prompt'
gmtlvim='git mergetool --no-prompt --tool=vimdiff'
gmum='git merge upstream/$(git_main_branch)'
gp='git push'
gpd='git push --dry-run'
gpf='git push --force-with-lease --force-if-includes'
'gpf!'='git push --force'
gpoat='git push origin --all && git push origin --tags'
gpod='git push origin --delete'
gpr='git pull --rebase'
gpristine='git reset --hard && git clean --force -dfx'
gpsup='git push --set-upstream origin $(git_current_branch)'
gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes'
gpu='git push upstream'
gpv='git push --verbose'
gr='git remote'
gra='git remote add'
grb='git rebase'
grba='git rebase --abort'
grbc='git rebase --continue'
grbd='git rebase $(git_develop_branch)'
grbi='git rebase --interactive'
grbm='git rebase $(git_main_branch)'
grbo='git rebase --onto'
grbom='git rebase origin/$(git_main_branch)'
grbs='git rebase --skip'
grep='grep --color'
grev='git revert'
grh='git reset'
grhh='git reset --hard'
grm='git rm'
grmc='git rm --cached'
grmv='git remote rename'
groh='git reset origin/$(git_current_branch) --hard'
grrm='git remote remove'
grs='git restore'
grset='git remote set-url'
grss='git restore --source'
grst='git restore --staged'
grt='cd "$(git rev-parse --show-toplevel || echo .)"'
gru='git reset --'
grup='git remote update'
grv='git remote --verbose'
gsb='git status --short --branch'
gsd='git svn dcommit'
gsh='git show'
gsi='git submodule init'
gsps='git show --pretty=short --show-signature'
gsr='git svn rebase'
gss='git status --short'
gst='git status'
gsta='git stash push'
gstaa='git stash apply'
gstall='git stash --all'
gstc='git stash clear'
gstd='git stash drop'
gstl='git stash list'
gstp='git stash pop'
gsts='git stash show --text'
gstu='gsta --include-untracked'
gsu='git submodule update'
gsw='git switch'
gswc='git switch --create'
gswd='git switch $(git_develop_branch)'
gswm='git switch $(git_main_branch)'
gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
gts='git tag --sign'
gtv='git tag | sort -V'
gunignore='git update-index --no-assume-unchanged'
gunwip='git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1'
gup='git pull --rebase'
gupa='git pull --rebase --autostash'
gupav='git pull --rebase --autostash --verbose'
gupom='git pull --rebase origin $(git_main_branch)'
gupomi='git pull --rebase=interactive origin $(git_main_branch)'
gupv='git pull --rebase --verbose'
gwch='git whatchanged -p --abbrev-commit --pretty=medium'
gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
gwt='git worktree'
gwta='git worktree add'
gwtls='git worktree list'
gwtmv='git worktree move'
gwtrm='git worktree remove'
h=history
help=man
hgrep='fc -El 0 | grep'
hidefiles='defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder'
history='omz_history -f'
hosts='sudo nano /etc/hosts'
ipinfo=$'echo "Your current public ip address is... \t" && curl https://ipinfo.io/ip'
kh='nano ~/.ssh/known_hosts'
l='ls -lFh'
l.='ls -d .* --color=auto'
lS='ls -1FSsh'
la='ls -lAFh'
lanscan='arp-scan -l'
lanscan2='arp -a'
lart='ls -1Fcart'
ldot='ls -ld .*'
listcasks='brew search --casks --desc '\'\'
ll='ls -la'
lr='ls -tRFh'
lrt='ls -1Fcrt'
ls='ls -G'
lsa='ls -lah'
lsn='ls -1'
lsr='ls -lARFh'
lt='ls -ltFh'
maildel='echo '\''d *'\'' | mail -N'
mailsaved='mail -f ~/mbox'
md='mkdir -p'
mv='mv -i'
nano='nano -c'
nmap_check_for_firewall='sudo nmap -sA -p1-65535 -v -T4'
nmap_check_for_vulns='nmap --script=vuln'
nmap_detect_versions='sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn'
nmap_fast='nmap -F -T5 --version-light --top-ports 300'
nmap_fin='sudo nmap -sF -v'
nmap_full='sudo nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v'
nmap_full_udp='sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 '
nmap_full_with_scripts='sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all '
nmap_list_interfaces='nmap --iflist'
nmap_open_ports='nmap --open'
nmap_ping_scan='nmap -n -sP'
nmap_ping_through_firewall='nmap -PS -PA'
nmap_slow='sudo nmap -sS -v -T1'
nmap_traceroute='sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute '
nmap_web_safe_osscan='sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy '
odmt='telnet 149.28.125.6 25'
odmtd='telnet mail.facl.xyz 25'
ofd='open_command $PWD'
p='ps -f'
path='echo "Your current path is" && echo $PATH'
privdns=$'echo "Your current private DNS Server is ...\t" && grep "nameserver" /etc/resolv.conf'
privip=$'echo "Your current private IP Address is ...\t" && ipconfig getifaddr en0'
psmo='curl -I -p https://www.mcmo.is'
pubip=$'echo "Your current public IP Address is...\t\t" && curl https://ipinfo.io/ip'
rd=rmdir
rl='source ~/.zshrc && echo "File .zshrc reloaded correctly" || echo "Syntax error, could not import the .zshrc"'
rm='rm -i'
run-help=man
sali='source ~/.aliases && echo "File ~/.aliases reloaded (sourced) correctly" || echo "File ~/.aliases didn not reload (was NOT sourced) correctly. please check your syntax and try again."'
sconf=' nano -c ~/.ssh/config'
sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
showfiles='defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder'
sortnr='sort -n -r'
ssl=ssllabs-scan
st=speedtest
stubbyconf='nano /usr/local/etc/stubby/stubby.yml'
surf='ssh surf'
t='tail -f'
um10='diskutil unmountDisk /dev/disk10 && echo "Disk 10 unmounted." || "Disk 10 NOT unmounted."'
um2='diskutil unmountDisk /dev/disk2 && echo "Disk 2 unmounted." || "Disk 2 NOT unmounted."'
um3='diskutil unmountDisk /dev/disk3 && echo "Disk 3 unmounted." || "Disk 3 NOT unmounted."'
um4='diskutil unmountDisk /dev/disk4 && echo "Disk 4 unmounted." || "Disk 4 NOT unmounted."'
um5='diskutil unmountDisk /dev/disk5 && echo "Disk 5 unmounted." || "Disk 5 NOT unmounted."'
um6='diskutil unmountDisk /dev/disk6 && echo "Disk 6 unmounted." || "Disk 6 NOT unmounted."'
um7='diskutil unmountDisk /dev/disk7 && echo "Disk 7 unmounted." || "Disk 7 NOT unmounted."'
um8='diskutil unmountDisk /dev/disk8 && echo "Disk 8 unmounted." || "Disk 8 NOT unmounted."'
um9='diskutil unmountDisk /dev/disk9 && echo "Disk 9 unmounted." || "Disk 9 NOT unmounted."'
umefi='diskutil unmount /dev/disk0s1'
unexport=unset
uuid='python -c '\''import sys,uuid; sys.stdout.write(uuid.uuid4().hex)'\'' | pbcopy && pbpaste && echo'
which-command=whence
ykr='gpg-connect-agent "scd serialno" "learn --force" /bye'
yks='gpg --card-status'
zrc='nano ~/.zshrc'
zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc'
NEW DISCOVERY:
I am using oh-my-zsh and have plugins enabled. By disabling oh-my-zsh plugins one by one, I have discovered that the command ls -la
works properly in zsh when disabling the gnu-utils
plugin for oh-my-zsh. Therein, the answer lies inside of the gnu-utils
plugin, but I'm not sure which alias from oh-my-zsh is causing this.
alias
/bin/ls
is the same for all shells, what do you get if you run/bin/ls -la
?unalias ls
then issue the commandls -la
. Let's just ensure there's no alias set then proceed from a clean slate.ls='ls -G'
. You can chase does where OMZ adds the alias and comment it out or placeunalias ls
at the end of your .zshrc. Or even better uninstall OMZ.