Adding a song file to iTunes via the command line without playing the file
You can use the "Automatically Add to iTunes" folder for that (see PH19617):

cp song.mp3 ~/"Music/iTunes/iTunes Media/Automatically Add to iTunes/"


If iTunes is running, anything you copy into this folder will be imported into iTunes automatically (and deleted from the folder afterwards).

Please note:


The folder name might be language specific, so check the name on your system first.
Depending on when iTunes was installed, the media folder may be called either iTunes Media or Tunes Music