Table of Contents

MacOS misc

Network

Disable IPv6:

sudo networksetup -listallnetworkservices # get names to use below

sudo networksetup -setv6off Ethernet
sudo networksetup -setv6off Wi-Fi
#...

Show DNS:

scutil --dns | grep nameserver

Mac startup key combinations

https://support.apple.com/en-us/HT201255

Key combinations for an Intel-based Mac

Users

List user accounts :
https://4it.com.au/kb/article/list-user-accounts-mac-osx-using-terminal-command-line/

dscl . list /Users | grep -v '^_'

List all members of a group :
https://superuser.com/questions/279891/list-all-members-of-a-group-from-the-command-line-in-os-x

dscacheutil -q group -a name $group_name
members () { dscl . -list /Users | while read user; do printf "$user "; dsmemberutil checkmembership -U "$user" -G "$*"; done | grep "is a member" | cut -d " " -f 1; };

Information about each user :
https://stackoverflow.com/questions/1303561/list-of-all-users-and-groups dscl . readall /users

dscl . readall /groups
dscacheutil -q user
dscacheutil -q group

Sharing

List AFP/SMB share info (Samba's testparm -s for Macs) :
https://apple.stackexchange.com/questions/405658/list-and-define-smb-shares-from-command-line

sharing -l

Connect to a File Server with a Specific Username (macOS)
https://kb.mlml.sjsu.edu/books/network-services/page/connect-to-a-file-server-with-a-specific-username-%28macos%29 smb:username:*@server.name

You can get the current authentication authorities of a user by entering :
https://apple.stackexchange.com/questions/306151/where-does-file-sharing-store-smb-passwords

dscl . -read /users/$user authentication_authority

See also

How to add a user from the command line
https://apple.stackexchange.com/questions/286749/how-to-add-a-user-from-the-command-line-in-macos

sudo dscl localhost -create /Local/Default/Users/USERNAME_HERE
/usr/sbin/sysadminctl -h
sudo sysadminctl -addUser xxx -password xxxxxxxx interactive

OSX User/Group Management – Part 1: Users
https://blog.travismclarke.com/post/osx-cli-user-management/

https://apple.stackexchange.com/a/7288/14586

How to enable File Sharing on macOS Ventura
https://www.stratospherix.com/support/how-to-enable-file-sharing-on-mac.php

And for the sharing basics :
https://support.apple.com/guide/mac-help/set-up-file-sharing-on-mac-mh17131/mac