Miscellaneous functions and commands in the Terminal for Mac OS X


Syntax:say [-Options] <Phrase to pronounce>

Usage:Uses the inbuilt Speech Synthesis manager for Mac to convert a text to audible speech.
Don’t forget to surround your text with quotes if it contains spaces.


-vChoose which voice to use.
-o <filename.aiff>Save the spoken text as an audio file on your computer
-f <filename.txt>Get the text that shall be spoken from a file.


say “The terminal rules”Outputs the phrase through your speakers.
say -o myspeech.aiff “The terminal rules”Create an audio file myspeech.aiff with the pronounced text.
say -f phrases.txtRead the text to be spoken from the file called phrases.

cal / ncal

Syntax:cal [-Options]
ncal [-Options]

Usage:Display a calendar in the Terminal.
Ncal offers a calendar with a slight different layout, and with more options.


-JDisplay Julian Calendar, if combined with the -e option, display date of easter according to the Julian Calendar.
-eDisplay the date when easter occurs on the given year (or the current year if -y is not set)
-jDisplay Julian days (days one-based, numbered from January 1).
-m <month>Display the specified month. <month> can both be a numeric value (1-12) or the name of the month.
-oDisplay the date when the orthodox easter occurs on the given year (or the current year if -y is not set) (Greek and Russian Orthodox Churches)
-pDisplays a collection of country codes combined with the date when each country switched from Julian to Gregorian calendar.
-s <country code>Set which country the calendar should be based on. (only works with ncal)
-wPrints out week numbers in the bottom of the calendar. (only works with ncal)
-y <år>Can either be used to set which year the calendar shall use when presenting a calendar month. If -y is the only parameter used you will see a full calendar representation of each month in the given year.


calDisplays a calendar of the current month.
ncalDisplays a calendar of the currenth month with the alternative layout.
ncal -eDisplays which date easter occurs this year.
ncal -e -y 2007Displays which date easter occured year 2007.
ncal -pShow dates of different countries switch from the Julian to the Gregorian calendar.


Syntax:afplay [-Options] <filename>

Options:Play audio files directly from the Terminal.
Stop playback by holding down the “Ctrl”-key followed by the “C”-key (Ctrl+C).


-v <volume>Set the volume of the playback.


afplay test.mp3Plays the audio file called “test.mp3“.
afplay ~/Documents/Music/Albums/Song.mp3Plays an audio file which is located in a certain directory.

Quick tipWhen using afplay as described above you can’t do anything else in the Terminal as long as the audio file is being played.
To avoid this you can add “&” after the command to play it in the background. Example:

afplay test.mp3 &

This will make “test.mp3” play in the background while you can do other things in the Terminal window.
If you wan’t to stop the playback after using the background playback (&) Ctrl+C won’t do the trick anymore. Instead you must write:
killall afplay