Results 1 to 7 of 7
  1. #1


    Member Since
    Sep 21, 2008
    Location
    Ashby de la Zouch, UK
    Posts
    3
    Specs:
    MacBook 2GHz Intel C2D
    Terminal Kill command
    I use Remote Desktop at work to keep an eye on pesky kids in the shop.
    I have already set some preset Unix commands to kill safari, mute the computer and that sort of thing.

    But, the killall command will not kill Firefox. I have thought about killing the PID but then, that changes all the time and it takes ages to get the correct PID back from the host machine.

    at first i thought Remote Desktop was having trouble handling 3rd party apps but i just tried killing firefox on my own machine and it doesn't kill it then either. I just get "No matching processes belonging to you were found"

    Does anyone know how I can get Terminal to kill firefox, without first finding the PID?

    Dan.

  2. #2

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    killall is the executable to kill by name, you'll need the PID for kill. Why is ps -ef | grep firefox taking forever? That should return pretty quickly, then you can kill it using kill. and.. does kill all -z firefox not work either?
    mike
    This machine kills fascists
    Got # ? phear the command line!

  3. #3


    Member Since
    Sep 21, 2008
    Location
    Ashby de la Zouch, UK
    Posts
    3
    Specs:
    MacBook 2GHz Intel C2D
    Ahh, that was confusing.

    In my first post all of my "Kill"'s were "killall"'s if that makes sense.




    If killing firefox without first finding the PID isn't particularly easy, is there a way to send a command that will emulate keystrokes?

    Dan
    An infinite amount of Infinity's

    http://www.zeroq.co.uk

  4. #4

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    Finding the PID is pretty simple.

    Here's a screenshot of me killing firefox.





    Now, since we're talking killall... killall -z firefox
    will kill all PID's matching the name firefox of your assumed user, the z tells it to also kill any zombied processes.

    ps -ef | grep firefox

    this will list all running processes, then search through that list and display all that include the word firefox. If you take a look at my example, the first # is the process owner ID (me) the second is the PID.
    mike
    This machine kills fascists
    Got # ? phear the command line!

  5. #5


    Member Since
    Sep 21, 2008
    Location
    Ashby de la Zouch, UK
    Posts
    3
    Specs:
    MacBook 2GHz Intel C2D
    Ah right, okay.

    One final hurdle.

    Is there a way of automating the second command by taking the correct PID and actioning the command "kill 1234".
    The reason for this is the command will be executed via the "Send Unix Command" feature of Remote desktop, run from one of the shop checkouts.

    For example;

    osascript -e 'set volume 0'

    is the command sent to mute all of the computers, but it only does one job.

    this new command need to get the output of the first command and then use the correct part of it in the next command.

    Perhaps an Applescript for this command too?
    An infinite amount of Infinity's

    http://www.zeroq.co.uk

  6. #6

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    Try something like...

    ps -ef | grep -v 'grep' | grep firefox | awk '{ print $2; }' | xargs kill


    applescript I can't help you with
    mike
    This machine kills fascists
    Got # ? phear the command line!

  7. #7

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,881
    Specs:
    Way... way too many specs to list.
    Oh, thought of something else... since killall will assume username.. you could try..

    killall -u <username> firefox
    mike
    This machine kills fascists
    Got # ? phear the command line!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Terminal command help.
    By ladylisak in forum OS X - Operating System
    Replies: 2
    Last Post: 10-18-2013, 02:47 PM
  2. Terminal 'ls' Command Help
    By xxSwagPanda in forum OS X - Operating System
    Replies: 1
    Last Post: 03-27-2013, 12:18 AM
  3. Terminal Kill reopens app
    By Jonnyfrond in forum OS X - Operating System
    Replies: 5
    Last Post: 01-16-2011, 03:33 PM
  4. Please help me with this Terminal command
    By nowakchr in forum OS X - Operating System
    Replies: 2
    Last Post: 12-12-2010, 11:39 AM
  5. terminal command help
    By ytbryan in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 09-18-2009, 06:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •