Fill-or-kill (FOK) demands the full size right now or nothing. Immediate-or-cancel (IOC) takes whatever is available immediately and cancels any remainder, allowing a partial fill.
These are used when you do not want an order resting in the order-book where it can be seen or filled later at a worse time. Most retail traders rarely need them; they are common in algorithmic execution.
Example: an IOC limit buy for 1,000 shares at $20.00 finds 600 shares at that price. 600 fill and the remaining 400 are cancelled instantly.
Related: fill, limit-order, order-book, iceberg-order