Dark energy with the usually used equation of state p = w \rho , where w = const < 0 is hydrodynamically unstable . To overcome this drawback we consider the cosmology of a perfect fluid with a linear equation of state of a more general form p = \alpha ( \rho - \rho _ { 0 } ) , where the constants \alpha and \rho _ { 0 } are free parameters . This non-homogeneous linear equation of state provides the description of both hydrodynamically stable ( \alpha > 0 ) and unstable ( \alpha < 0 ) fluids . In particular , the considered cosmological model describes the hydrodynamically stable dark ( and phantom ) energy . The possible types of cosmological scenarios in this model are determined and classified in terms of attractors and unstable points by the using of phase trajectories analysis . For the dark energy case there are possible some distinctive types of cosmological scenarios : ( i ) the universe with the de Sitter attractor at late times , ( ii ) the bouncing universe , ( iii ) the universe with the Big Rip and with the anti-Big Rip . In the framework of a linear equation of state the universe filled with an phantom energy , w < -1 , may have either the de Sitter attractor or the Big Rip .