You need to navigate to the samtools folder. Confirm by typing "pwd" in the terminal, meaning "print working directory". It would indicate that you are in the samtools directory. Once there you can run your command by simply removing the "samtools". IE xargs faidx all_my_sequences.fa < wanted_seq_ids.txt > wanted_seq_only.fa
I had the same problem using faidx and this solved it for me. Good luck.
which samtools
for the full path