For most people, the Mac's OS X is all about the graphical user interface. But system administrators and power users know that the Mac's command-line interface can be a powerful time saver and, in.
. Log in to your Mac with an administrator account.
While holding down the Option key, then choose Apple menu () System Information (or System Profiler). Select Network from the list on the left side of the System Information window. Select the network interface (such as Wi-Fi or Ethernet) from the list of active services on the right side of the window.
From the details section at the bottom of the window, find 'BSD Device Name.' In the example pictured, the BSD device name for Wi-Fi is en0. Open Terminal, which is in the Utilities folder of your Applications folder. Type the following command, but replace BSDname with the BSD device name (such as en0, en1, or ppp0) from System Information: sudo tcpdump -i BSDname -s 0 -B 524288 -w /Desktop/DumpFile01.pcap. Press Return, then enter your administrator password when prompted. Terminal should say tcpdump: listening on. to indicate that it's listening for activity on that network interface.
While Terminal is open, perform the network function that you want to test. When the network function is complete, return to Terminal and press Control-C to capture the packet trace. Terminal saves it to your desktop in a file named 'DumpFile01.pcap.' . To see the contents of the file, use this command in Terminal: tcpdump -s 0 -n -e -x -vvv -r /Desktop/DumpFile01.pcap.
To capture additional packet traces, modify the Terminal command to increment the number of the saved file (such as DumpFile02.pcap and DumpFile03.pcap). The Apple Developer website has. When troubleshooting a network connection, you should know your computer's model, macOS version, IP address (and the destination IP address), and media access control (MAC) address. You should also understand your computer's role in the network activity, as well as the time of each network event associated with the issue. When troubleshooting the connection between an AirPort Base Station and a broadband modem, restart the base station and capture its interactions with the Internet service provider while it starts up. You can restart the base station using AirPort Utility, or by briefly unplugging it from power. While testing, it's best if the base station, modem, and capturing computer are connected to an Ethernet hub, not a switch.
You should also manually assign the capturing computer's IP address so that it doesn't take the DHCP lease that the base station needs (a 169.254.x.x address should suffice). The packet trace may show that the TCP checksum of packets sent by the Mac is bad.
This is because the packet trace is being captured at the link layer of the network stack, which is just before the physical network adapter where checksums are generated. This can be safely ignored.
The Easy Way: iCanHazShortcut The easiest way to add custom keyboard shortcuts for specific commands is to, a free Mac application with a terrible name. Installing couldn’t be simpler: just drag the icon to your Applications folder. Then fire up the application. You’ll find it in the menu bar.
Click “Shortcuts” to bring up a list of current shortcuts. Looks like we don’t have any shortcuts defined right now. To change this, click the green arrow at bottom-right. This will bring up a two fields: one for the keyboard shortcut, another for the command you’d like to trigger. Click the first field, then hit whatever keyboard shortcut you’d like to use. Next, click the second field and enter whatever command you’d like to trigger. For our example, we’re going to use date '+The time is%H:%M' say which makes our Mac say the current time out loud.
Click the green checkmark at bottom-right, and your done! Your keyboard shortcut will now run your command at will. Note that you can configure a few more things, if you like. The icon menu bar icon can be disabled, allowing you to run this application in the background. You can also set the application to run when you start up your computer. The (Slightly) Harder, But Built-In Way: Automator If you’d rather not use a third party application to trigger Terminal commands, there’s another method, which works because macOS lets you.
To get started we’re going to launch, which you’ll find in your Applications folder. We’re going to create a new Service for your Mac. In the Actions section, click the “Utilities” sub-section, then drag “Run Shell Script” over to your workflow.
Next, paste your command. Again I’ve used date '+The time is%H:%M' say, which will read the current time out loud, but you can use whatever command you like. Save your workflow with a name you’ll recognize, and we’re done with Automator. Next, head to System Preferences Keyboard Shortcuts. In the left panel click “Services,” and scroll down until you see the service you just created—it should be under the “General” section.
After setting this, you can trigger your service using whatever shortcut you defined. And because this is all native to the operating system itself, there’s no program you need to leave running in the background.