Typing "yes" into the Terminal

Discussion in 'macOS' started by ElectroGhandi, Jan 9, 2009.

  1. ElectroGhandi macrumors regular


    Jan 9, 2009
    Baltimore, MD
    I heard if you type "yes" into the Terminal with tons of programs running, it does a bad thing, but what bad thing does it do?
  2. Phil A. Moderator

    Phil A.

    Staff Member

    Apr 2, 2006
    Shropshire, UK
    Wirelessly posted (iPod touch 32GB: Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Safari/525.20)

    The yes command simply causes a continual echoing of yes to standard output.
  3. octelcogopod macrumors newbie

    Nov 12, 2007
    It eats a little bit of CPU. You can make a crude stress/burn-in test by opening a ton of consoles and running "yes" in all of them
  4. richard.mac macrumors 603


    Feb 2, 2007
    51.50024, -0.12662
    if you enter "yes > /dev/null & yes > /dev/null" into Terminal "yes" will continually write to /dev/null in a loop and put 100% load on both CPUs cores

    it is entered twice as its one process for each core i.e. for quad core CPU run "yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null" etc.

    to relieve your cores and fans press "control+z" and then enter "killall yes".

  5. octelcogopod macrumors newbie

    Nov 12, 2007
    You can cat pretty much anything to /dev/null and it eats CPU. Try /dev/urandom or /dev/diskx to give your hard drive a workout
    (don't cat anything INTO your disk, and triple check your commands before running them since catting from the raw disk device requires root access)

    or just don't do any of these things ever

Share This Page