Command Line

The command line interface is an alternate method of interacting with macOS and Mac OS X, relying on text based command entry to execute commands and perform tasks. It is accessed on the Mac by using the Terminal application. Generally, the command line is considered advanced, and thus it’s usage tends to be more complex than many standard procedures on a Mac.

Search Command Line

Get a Macs Serial Number from the Command Line

Apr 25, 2011 - 11 Comments
Get a Mac Serial Number the easy way from About This Mac overview

You can quickly retrieve any Macs serial number via the command line by using the ioreg or system_profiler command and grep for the serial string. Getting the serial number from the command line like this can be helpful for troubleshooting, Single User Mode, remote management with SSH, or for many other reasons, though most users … Read More

Monitor Mac OS X Filesystem Usage & Access with opensnoop

Apr 22, 2011 - 11 Comments
Monitor Mac OS X Filesystem Use and Access

The opensnoop utility is an amazing tool for tracking down specifics like what files specific applications are accessing, but you can also use opensnoop to monitor all filesystem access in Mac OS X. To do this, run the utility with no flags attached: sudo opensnoop You’ll be asked for your root password, and then you’ll … Read More

Follow System & Kernel Logs from Command Line in Mac OS X

Apr 20, 2011 - 1 Comment
Mac OS X Console Logs from Command Line

If you’re troubleshooting some of the more difficult problems that you can have on a Mac, a good place to look are the System & Kernel Logs contained within Console app. But you can access the same OS X logs from the Terminal too.

Set Terminal Focus to Follow the Mouse Cursor in Mac OS X

Apr 18, 2011 - 12 Comments
Terminal in macOS

If you’re coming to Mac OS X from elsewhere in the unix & x11 world, you might be used to the focus of Terminal windows following your mouse cursor. With a little command line magic, we can enable this hidden feature in the Mac OS X Terminal.app too.

Need an SSH App for iPhone and iPad? Check Out Prompt

Apr 14, 2011 - 4 Comments

If you’ve been looking for a great SSH client for iPad or iPhone, Prompt is probably exactly what you’ve been searching for. Released by Panic software, Prompt is a great looking SSH app that includes a bunch of features to improve the SSH experience from an iOS device. Notable features are: autocompletion of frequently used … Read More

Connect to a Wireless Network from the Command Line

Apr 12, 2011 - 16 Comments

Using the powerful ‘networksetup’ utility, we can connect to wireless networks directly from the command line of Mac OS X. The syntax you’ll want to use to accomplish joining a network is as follows: networksetup -setairportnetwork [interface] [router SSID] [password]

Use Aliases to Create SSH Shortcuts

Apr 11, 2011 - 12 Comments

More fun with SSH! We showed you how to setup SSH config files and use tab completion for SSH aliases, but setting up bash aliases is even easier if you are connecting to the same server over and over again.

Quickly launch a new styled Terminal window

Apr 10, 2011 - 3 Comments

You can quickly launch a new styled Terminal window through the apps Mac OS X Dock icon. Just right-click (two-finger click for trackpad users) on the Terminal app, navigate to “New Window” select a preconfigured style.

Quickly Copy HTML & CSS Source to the Clipboard with curl

Apr 9, 2011 - 4 Comments

Using curl and pbcopy, we can quickly grab and copy HTML and CSS code from any URL via the command line. This should be a helpful tip for the web developers out there, but for anyone looking to check the source of a web page through this can be an invaluable little trick.

Enable Tab Completion for SSH Aliases

Apr 6, 2011 - 17 Comments

Yesterday we showed you how to setup a basic SSH Config file, and here’s how to make that even more useful: enable tab completion for those SSH aliases. Throw this into ~/.bash_profile or ~/.bashrc # Add Tab-completion for SSH host aliases complete -o default -o nospace -W "$(/usr/bin/env ruby -ne ‘puts $_.split(/[,s]+/)[1..-1].reject{|host| host.match(/*|?/)} if $_.match(/^s*Hosts+/);’ … Read More

Setup an SSH Config File

Apr 5, 2011 - 8 Comments

If you use SSH even somewhat often, it would benefit you to setup a basic SSH config file. If you’re curious why, would you rather type something like this: ssh -p 6851 user@servername.domain.com Or just type: ssh name I know what I’d rather do, so let’s get this working. I’m going to use nano editor … Read More

Quickly Backup a Site Through FTP with wget

Apr 4, 2011 - 4 Comments

If you want to quickly backup an entire website through FTP, the absolute easiest way to do this is through the command line using the wget command. In fact, you can backup an entire site (or whatever else is on the entire FTP server) with a single command string.

Remove an Agent from launchd

Mar 8, 2011 - 35 Comments

The vast majority of Mac users won’t need to manually tweak launchd and launchctl, but there are times when you uninstall or stop using an app in Mac OS X and a service agent continues to needlessly load in launchd. This is annoying, but these rogue agents are easy to remove via the command line, … Read More

Change & Set the Default crontab Editor

Mar 7, 2011 - 16 Comments

Want to change the crontab editor on the Mac? You can do that! We’ll show you how to use a different crontab editor on a selective per-edit basis, and also how to change the default crontab text editor. You can use vi, emacs, nano, or whatever else you’d like. Most hardcore command line users and … Read More

Drag & Drop Finder Items into the Terminal to Automatically Type their Full Path & Name

Mar 2, 2011 - 8 Comments

You can instantly print any Finder items full path and name into the Terminal by dragging and dropping an item from a Finder window and into a Terminal window. Once the Finder item has been dropped into the terminal, the entire path to the item is automatically typed out instantaneously, maintaining both proper capitalization as … Read More

Print and Query Command History to Find Specific Past Commands

Feb 6, 2011 - 7 Comments
Terminal in macOS

If you’re trying to remember an exact command you executed via the Terminal but can’t quite come up with it, you can query your command line history to discover old commands that have been run or executed in the past. This trick to find and retrieve prior commands executed in the command line works on … Read More

Check and Install Mac OS X Software Updates from Terminal

Jan 13, 2011 - 19 Comments

Want to update Mac OS software from the Terminal? You can check for available updates, ignore packages, and install any or all Mac OS X Software Updates directly from the command line. To see what updates are available for a Mac, or to install a software update from the Terminal of Mac OS X, amongst … Read More

Fix Terminal Gibberish with reset Command in OS X

Jan 10, 2011 - 1 Comment
Terminal in macOS

If you’ve ever accidentally used cat on a binary file, you’ll have seen the gibberish that results and how it can totally screw up your Terminal window with loads of weird characters. Of course there are many other ways to bork up your command line prompt which seems to become unrecoverable through the typical clear … Read More

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site