Linux Bash: Move multiple different files into same directory

You can do

mv car.txt bicycle.txt vehicle/

(Note that the / above is unnecessary, I include it merely to ensure that vehicle is a directory.)

You can test this as follows:

cd               #Move to home directory
mkdir temp       #Make a temporary directory
touch a b c d    #Make test (empty) files ('touch' also updates the modification date of an existing file to the current time)
ls               #Verify everything is there
mv a b c d temp/ #Move files into temp
ls               #See? They are gone.
ls temp/         #Oh, there they are!
rm -rf temp/     #DESTROY (Be very, very careful with this command)

Leave a Comment