7

Output of "ls -l":

-rw-r--r--  1 root root    0 Mar  4 08:22 -t

When i try to do "rm '-t'":

rm: invalid option -- 't'
Try 'rm ./-t' to remove the file '-t'.
Try 'rm --help' for more information.
Aaron
  • 6,764

2 Answers2

23

You can use rm -- -t or rm ./-t

From man rm

To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:

          rm -- -foo

          rm ./-foo
Wayne_Yux
  • 4,942
6

You can use find too:

find . -maxdepth 1 -type f -name '-t' -delete 

Example:

% ls 
egg -t

% find . -maxdepth 1 -type f -name '-t' -delete 

% ls
egg
heemayl
  • 93,925