cout<<"Press ENTER to exit";
cin.ignore(cin.rdbuf()->in_avail()+1);
But srsly, either start the program from the console, or start it from the IDE. A program that asks for user input before termination is not very user friendly (ex: You could direct cout and cin to files - in that case, it would be very stupid to ask for further user input)
That code works perfectly fine for me. Anyways, what you should really do is just ignore the pause part and launch the program from the terminal. Terminal applications are expected to be run from the terminal.
The "command" depends entirely on linux terminal type, there are many of them and no standard ones like windows built-in cmd.exe when everybody know what to do.