Commande kill

jhon2000 Messages postés 3 Statut Membre -  
jhon2000 Messages postés 3 Statut Membre -
bonjour à tout le monde,
je cherche depuis un bon moment comment peut on utiliser la commande kill pour arrêter un processus qui utilise la commande Grep,mais je n'arrive pas a trouver de solution.Y a t il quelqu'un qui a une idée? Merci

2 réponses

  1. dubcek Messages postés 18627 Date d'inscription   Statut Contributeur Dernière intervention   5 660
     
    hello
    voir la commande pkill
    1
  2. jisisv Messages postés 3678 Statut Modérateur 936
     
    Tu peux t'inspirer de ceci:
    johand@bata:~/tmp$ grep truc & grep brol & echo -e "\n\n"
    [1] 9963
    [2] 9964

    johand@bata:~/tmp$ pgrep -a grep
    9963 grep truc
    9964 grep brol

    [1]- Stoppé grep truc

    [2]+ Stoppé grep brol
    johand@bata:~/tmp$ kill -KILL 9963
    johand@bata:~/tmp$ pgrep -a grep
    9964 grep brol
    [1]- Processus arrêté grep truc


    Regarde aussi man pstree:
    johand@bata:~/tmp$ grep truc | sort | sed -e 's/a/HAHA/' &
    [1] 10089
    johand@bata:~/tmp$ pstree -p $$
    bash(8316)─┬─grep(10087)
               ├─pstree(10090)
               ├─sed(10089)
               └─sort(10088)
    
    [1]+  Stoppé                 grep truc | sort | sed -e 's/a/HAHA/'
    johand@bata:~/tmp$ kill -KILL 10087 ; pstree -p $$
    bash(8316)─┬─pstree(10091)
               ├─sed(10089)
               └─sort(10088)
    
    [1]+  Stoppé                 grep truc | sort | sed -e 's/a/HAHA/'
    johand@bata:~/tmp$ fg
    grep truc | sort | sed -e 's/a/HAHA/'


    Gates gave ^W  sold  you the windows.
    GNU gave us the whole house.(Alexandrin)
    0
    1. jhon2000 Messages postés 3 Statut Membre
       
      merci pour la réponse je vais la tester pour voir
      0