rewrite generic commands; added file option
rewrite generic commands; added file option