Start and Stop the Apple File Server from Command Line

You can use /sbin/service to start or stop the “Personal File Sharing”.

Start the Apple File Server (“Personal File Sharing”):

sudo /sbin/service com.apple.AppleFileServer start

And likewise stop it:

sudo /sbin/service com.apple.AppleFileServer stop