How is it known what shares I’m selling for tax purposes?

If I’m buying stock in company X in a taxable account:
Let’s say I buy 10 shares now and 10 shares 1 year from now. 6 months later I sell 10 shares will these gains be taxed as long term or short term gains?

Additionally, using the same scenario as above, if first purchase date was at $100/share and second purchase date was at $120/share, but when I sold the share price is $115/share can I choose to still the $120 shares to make it a capital loss or is it simply an average cost basis?

Does a brokerage (I.e. fidelity or vanguard) allow me to choose, does it depend how I file to the IRS or neither of these?
Thanks in advance!