Per the Windows and Linux threads, what commands do you find most useful in Mac OS X Server (or Client)?
|
locked by Mark Henderson♦ Jun 27 '12 at 4:44
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: FAQ.
|
Truly Mac only: I saw 'open .' above, but open will open any document or app you pass to it. Generic Unix that I use the most: sudo is pretty handy for changing system config files, etc, which I actually edit in vi. kill can't be overstated when something hangs (or when another user is still logged into my desktop in the background and I want to log them out, nasty I know but it's my desktop) ssh/scp - I love that in OSX I can just open a terminal and connect to any of our servers. That alone made me happy to drop Windows. ifconfig/ping/whois/nmap etc |
|||||
|
|
If you want to know what sort of line endings a file has, just run
ex:
|
||||
|
|
|
Will display the order for DNS resolution. Useful for when you're creating or debugging your Network settings. |
||||
|
|
lists Internet ports that are open. Sample output:
Use |
||||
|
|
is great for getting your IP address, and
works well for getting a MAC address. Using en1 will (almost always) get the Airport's MAC address, which is handy if only known devices are allowed onto your wireless network. Conversely, if you use en0 -- the built-in ethernet port -- you can then look the machine up in your Open Directory, like so:
(Assuming your server was 'odm' and the realm is ODM.PRETENDCO.COM). |
||||
|
|
|
ipconfig is sometimes useful: Getting current IP address on interface:
Getting the DHCP information that was last received:
|
||||
|
|
|
This question overlaps quite a bit with this one about tools a UNIX administrator cannot live without. Many of the command-line tools for Mac OS X have UNIX roots, such as |
||||
|
|
|
How to enable Time Machine to backup to a NAS.
Find MAC address
Command to create sparsebundle to copy over to NAS
Works like charm backing up to my ReadyNAS. |
||||
|
|
|
It is a freeware third-party tool, but
is really handy. It is a command-line tool that you can optionally install the first time you run TextWrangler. [Other text editors (BBEdit, TextMate) likely provide something analogous.]
Opens up the file in TextWrangler, and will let you authenticate if you don't normally have permission to edit it. (You can even do it from an ssh session, and it'll open it for the logged-in graphical user). Better still is that you can pipe things to it.
for example, will show you your open network connections and open them up in TextWrangler, where you can search (and scroll) through them easily. |
|||||
|
|
Gain a root shell without enabling the root user (as Apple itself requires sometimes in their docs in order to do some "geeky" stuff, ie to set system-wide language)
This gives you a root shell where you can do everything you want as root, without having to prepend every command with the sudo command. This may be dangerous, but we are sysadmins, we know what we are doing, don't we? :) |
|||||
|
|
|
||||
|
|
|
Apart from the usual Unix suspects I find the following useful :-
If you master those and the usual Unix stuff you have all you need for Mac administration from the command-line. |
||||
|
|
|
I just found out that there's a nifty bash construct that you can use instead of the seq command missing in Mac OS:
|
||||
|
|
|
A bit pedestrian for this audience, no doubt, but I use: screencapture -i -c to grab whatever I want from the screen It's really handy and does things that Grab won't allow me to grab. |
||||
|
|
|
du -d 1 -h Displays disk usage statistics for the current directory in human readable form. man [command] One of the most used commands. Tells you how to use everything else. |
||||
|
|
Force Demote an LDAP Replica to Standalone. If your Open Directory Master is misconfigured, sometimes trying to demote an Open Directory Replica using Server Admin will fail (eg: you might find your Replica server refuses to demote). You can use slapconfig to force it to demote on these occasions. |
||||
|
|
searched the path for program, and tells you which executable is invoked if you run program without specifying a full path. It is usually most useful as a shorthand for typing a path.
|
||||
|
|
Starts an interactive SQLite session. If foo.db does not exist, it will be created. |
||||
|
|
|
These are basic, but handy if you have amnesia: Who am I?
Where am I standing?
What building am I?
What's its address?
|
||||
|
|
|
OS X specific things I haven't seen mentioned:
|
||||
|
|
|
What DHCP licenses does the client hold?
List the firewall allow/denies:
Generate a high-entropy password (double click on a promising 16 character string to copy/paste):
|
||||
|
|
|
Ever wanted to know what the IP address of another Mac that you can see is in the Finder is on your LAN thanks to Bonjour?
dscacheutil is surprisingly useful and versatile. You can do a lot more with it than just flush the DNS cache (as mentioned elsewhere here), i.e. user lookups and cache stats and dumps. |
||||
|
|
Displays any file on your system with "foo" in its filename. I must use this almost as often as I use Spotlight. |
|||||
|
|
Maybe not the most "useful" command but For example |
||||
|
|