how to delete contents of file shell code example Example 1: bash command to empty textfile : > file.log Example 2: shell remove file rm <file_name>