2015年10月4日 星期日

Mac command line


  • Check mac version: sw_vers -productVersion 
  • Change HostName: sudo scutil --set HostName nameyouwant
  • Change hostname: sudo hostname mbpr
  • To start an application from command line, TeamViewer for example:
       > open -g -a /Applications/TeamViewer.app
  • To gracefully quit instead of kill-ing:
      > osascript -e 'quit app "TeamViewer.app"'

  • Open multiple VLC
    /Applications/VLC.app/Contents/MacOS/VLC
  • Restart from terminal: 
    • sudo shutdown -r now 
    • sudo shutdown -h +5 

With details on hiding given by: https://support.apple.com/en-au/ht203998
pwpolicy can both disable and enable users, without losing their password
To disable the user
pwpolicy -u username disableuser
To enable the user
pwpolicy -u username enableuser
Use dscl to hide the user so they don't show on login:
sudo dscl . create /Users/username IsHidden 1 
To show a hidden user
sudo dscl . create /Users/username IsHidden 0 

沒有留言: