QStringList args1; QString procr1, procr2; args1 << "-c" << "ps -A | grep name"; QProcess process1; process1.start( "sh", argsCr ); if( !process1.waitForFinished() ) { qDebug() << "Process launth error."; } QByteArray data1 = process1.readAll(); QDataStream stream1(&data1, QIODevice::ReadOnly); stream1.setVersion(QDataStream::Qt_4_5); process1 = data1.data_ptr()->data; for (int i=1; procr1[i]!= ' '; i++) procr2[i-1] = procr1[i]; process1.kill(); QStringList args; args << "-c" << "kill " + procr2; QProcess process2; process2.start( "sh", args ); if( !process2.waitForFinished()) { qDebug() << "Ошибка запуска процесса "; } process2.kill();