command to keep only the name of a file

This bash expansion will do it: ${file%.*}.