If you work in an environment with multiple Apple computers, it’s sometimes easiest to monitor and manage them through the use of Apple Remote Desktop. Here are a series of unix commands that you may find helpful.
Mass Login – send a command that logs you into all of the machines with the click of a button:
(just copy and paste the code below, changing out the user name and password where appropriate; enter root for the user and run the command on the designated computers)
Tip: If this doesn’t give you the desired results, try rebooting the machine remotely because sometimes a user has the cursor in an unexpected location/field
osascript -e 'tell application "SecurityAgent" to activate'; \
osascript -e 'tell application "Bluetooth Setup Assistant" to quit'; \
osascript -e 'tell application "System Events" to keystroke "<username>"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 0.9'; \
osascript -e 'tell application "System Events" to keystroke "<userpassword>"'; \
osascript -e 'tell application "System Events" to delay 0.9'; \
osascript -e 'tell application "System Events" to keystroke return'
Set Safari Homepage – send a command that designates a specific webpage for a user’s homepage in the Safari web browser
(just copy and paste the code below, editing the URL where appropriate; enter the local user name of the account you want to apply the settings to and run the command on the designated computers)
defaults write com.apple.Safari HomePage 'http://www.'
Control How Safari Opens – send a command that designates the behavior for both a new window and a new tab in the Safari web browser
(just copy and paste the code below, editing the number according to the guide listed below; enter the local user name of the account you want to apply the settings to and run the command on the designated computers)
New Window/Tab Behavior Integer Guide:
- 0 = Homepage
- 1 = Empty Page
- 2 = Same Page
- 3 = Bookmarks
- 4 = Top Sites
defaults write com.apple.Safari NewWindowBehavior -int 0
defaults write com.apple.Safari NewTabBehavior -int 0
Open a Folder – send this command at the user level to open a folder such as documents
open users/p1user/documents
Delete All Items in Downloads Folder – send this command at the user level to automatically delete all of the items from a user’s downloads folder
cd ~/Downloads
rm -rv *
Empty the Trash – use this command to automatically empty the trash bin
rm -rf ~/.Trash/*
Open Another Volume – use this command to open another volume
open /Volumes/"Name of Volume"
Have any other useful custom unix commands? Share in the comments below!