You always want to stop a process gracefully. However, sometimes it’s just not possible to do so. Sometimes, you have to kill a process. Sometimes you have to end a process or a process tree when you can’t restart them gracefully.
To stop a process in Linux and Mac, use the kill command. In Windows, there’s a Powershell cmdlet called Stop-Process that enables you to terminate a process. As with kill, just add the process ID at the end of the command. For example, to stop process 318:
Or you can stop based on the name of the process using the -processname option. For example, to kill a process called minesweeper:
Stop-Process -processname minesweeper
Note: You can include wildcards in these commands as well.
Be careful what you wish for. The reason you’d kill a process rather than reboot is that you don’t want to reboot because other processes are working out just fine. You can always kill a process, but some will reboot your boxen.
Finally, there’s also taskkill.exe, which can be used as well:
taskkill.exe /F /IM minesweeper.exe /T
Here’s the thing: I’m not very good with computers. So to keep me from hurting myself too badly, I need the simplest interface available that allows me to run multiple applications. But most of the command keys shouldn’t work in this interface and I should only have Finder, file and Help menus.
Luckily for my poor MacBook Airs, Apple thought of people like me when they wrote the Finder and invented something called Simple Finder which makes OS X even simpler than it is by default to use. To enable Simple Finder, just go to Parental controls, enable controls for a user and then check the box for Simple Finder. Or, if you have an entire population of users like me, who simply can’t be trusted with a full operating environment, you can send the InterfaceLevel key with the contents of simple (easy to remember for those of us who resemble said key) to com.apple.finder and restart our friendly neighborhood Finder:
defaults write com.apple.finder InterfaceLevel simple; killall Finder
Come to think of it, maybe I’m not so awful. Let’s say I want to turn that whole Simple Finder thing right back off. Well, all we have to do is delete that key we created and then restart the Finder:
defaults delete com.apple.finder InterfaceLevel; killall Finder
Actually, I am terrible with these things. So much so that it’s not appropriate for me to use a computer. Therefore, just take it away. I’ll be better off using that Samsung with Windows 8 for awhile. At least there, I won’t be able to get any of my apps open or find any of the administrative tools that could damage the computer!
For many environments, securing OS X is basically trying to make the computer act more like an iOS device. Some of the easier tasks involve disabling access to certain apps, sandboxing and controlling access to certain features. One of the steps en route to building an iOS-esque environment in OS X is to disable that Go to Folder… option. To do so, set the ProhibitGoToFolder key as true in com.apple.finder:
defaults write com.apple.finder ProhibitGoToFolder -bool true
Then reboot, or kill the Finder:
To undo, set the ProhibitGoToFolder as false:
defaults write com.apple.finder ProhibitGoToFolder -bool false
One of those annoying little things is when you ARD into a system and the Dock is nowhere to be seen. Why do we (or should I say they) autohide Docks on servers? Either way, when I ARD into a box and I don’t see a Dock I have this line saved as a Template:
defaults write com.apple.dock autohide -bool false; killall Dock
By writing an autohide key that is false into com.apple.dock for the currently logged in user, I don’t have to deal with the Dock disappearing any more. You need to kill the Dock and let it respawn, thus the killall as well.
Once I’m done working with the box, I can show the dock again:
defaults write com.apple.dock autohide -bool true; killall Dock
Or, instead of all this, as diskutant once pointed out, just use Command-Option-d when you ARD in and then again when you log out!
When I’m writing, I like to listen to music in the background. When writing, I also like to have everything minimized so I can quickly grab a screenshot of the desktop where needed. This means that when I run into a track that doesn’t work with whatever I’m writing that I would need to unminimize iTunes, click the next button and then re-minimize iTunes. Awhile back I found a better way but can’t remember where for attribution. So, part of my default user template and imaging framework now includes setting the iTunes Dock icon to show the track that I’m playing so I can easily go to the next song, filing away the current song to remove from whatever playlist at a later date in case I’ve forgotten who the artist was. By default the iTunes Dock icon doesn’t show the current playing track. To tell it to:
defaults write com.apple.dock itunes-notifications -bool TRUE
Then killall Dock:
Now when you click on iTunes in the dock and hold the mouse down, you’ll see the following:
If you later decide you don’t like this:
defaults write com.apple.dock itunes-notifications -bool FALSE
And then killall Dock:
In Mac OS X Server occasionally the Directory Services daemon will just stop working. To term it you can just run the following command:
Each user in Mac OS X can customize the location that their screenshots (aka screencaptures) will go. To do so you would edit the com.apple.screencapture property list, customizing the location key. You can easily edit this file using the defaults command. For example, if we wanted to set the location to go to a folder called screenshots in the home directory of a user we could use the following command:
defaults write com.apple.screencapture location ~/screenshots
You can also change the default type of screenshot which I cover here http://krypted.com/mac-os-x/mac-os-x-changing-the-default-screen-shot-format