Juicy lil' bytes

How to Open a File or Directory in the Atom Editor From the Command Line

You can use the atom executable to open a file or source directory in the GitHub Atom text editor.

Confirm Command Line Tools Install

Atom installs the atom and apm executables as part of the MacOSX install. We will be using the atom executable to open files and directories in Atom. To confirm that atom is installed, call the help documentation with:

atom --help

If you don’t see a help message, use the Atom menu item and select Atom > Install Shell Commands. You will receive a confirmation message if this was successful.

Open a File in Atom

To open a file in Atom, enter the path to the file as the argument to the atom executable:

atom <filepath>

For a file named ‘test.c’ in the working directory, use the following command:

atom test.c

Open the Current Working Directory in Atom

To open your working directory in Atom, use the following command:

atom .