How can I customize Ubuntu Dock via terminal. I would like to add Chrome and remove Amazon.
Just right click on the application icon you want to remove and select "Remove from Favourites". Similarly right click on an application icon you want to add when the application is running and select "Add to Favourites".
If you really want to use Terminal to achieve your goal, see this.