There's a way to prevent overwriting files when redirecting, howeverthe noclobber option. If you set noclobber to on, bash won't allow redirection to overwrite existing files without your explicit permission. To turn on noclobber, use this command: $ set -o noclobber At that point, if you want to use redirection and overwrite a file, use >| instead of just >, like this: $ pwd /home/scott/music $ ls -1F Hank_Mobley/ hank_mobley.txt Horace_Silver/ John_Coltrane/ $ ls -1F Hank_Mobley/* > hank_mobley.txt ERROR $ ls -1F Hank_Mobley/* >| hank_mobley.txt $ cat hank_mobley.txt 1958_Peckin'_Time/ 1960_Roll_Call/ 1960_Soul_Station/ 1961_Workout/ 1963_No_Room_For_Squares/ If you decide you don't like or need noclobber, you can turn it off again: $ set +o noclobber To permanently turn on noclobber, you need to add set -o noclobber to your .bashrc file. |