Read all lines of a file into an array.
Section: Reading Input
Load file into array
bash
bash
mapfile -t lines < file.txtExplanation
mapfile and readarray are Bash builtins.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Reading Input