This tutorial shows multiple ways to open an atom editor from a command line in macOS and Windows.

Open an Atom editor from the Command line in Windows.

By default, the atom location path is updated to PATH once the atom is installed.

  • Open a command-line prompt win + R and type Command

  • It opens a command line in windows.

  • Run the below command and Open Atom editor

    start atom
    
  • Run the below command to open a file

    start atom first.java
    
  • Run the below command to open the folder in the atom.

    start atom src-folder
    

Open Atom editor from a terminal in macOS

After installing Atom in macOS, It creates a symlink for the/usr/local/bin folder.

Atom editor is opened with the open -a ‘Atom’ command.

So We are going to add an alias for this command with the atom command.

add alias for the open command to ~/.bash_profile .bash_profile

alias atom='open -a "Atom"'

From here onwards, the atom command works on the terminal.

  • Open a terminal

  • Run the below command to open the Atom editor

    atom
    
  • You can also open an editor with the file name

    atom filename
    
  • You can also open an editor with the folder name

    atom folder