Search code examples
linuxunixwildcardrm

rm with wildcards shows me taskset help output


I'm trying to remove a bunch of folders with the Unix command rm and the wildcard symbol *. Perplexingly, rather than removing my folders, the shell is displaying for me the help output for the taskset command. Can anyone explain this?

(master)dbliss@nx1[dist_exp]> rm -r 8*/8*_task_results
taskset (util-linux-ng 2.17.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process

  -p, --pid                  operate on existing given pid
  -c, --cpu-list             display and specify cpus in list format
  -h, --help                 display this help
  -V, --version              output version information

The default behavior is to run a new command:
  taskset 03 sshd -b 1024
You can retrieve the mask of an existing task:
  taskset -p 700
Or set it:
  taskset -p 03 700
List format uses a comma-separated list instead of a mask:
  taskset -pc 0,3,7-11 700
Ranges in list format can take a stride argument:
  e.g. 0-31:2 is equivalent to mask 0x55555555

The same thing happens if I call rm without the -r flag (but with the wilcards). Replacing rm with ls, on the other hand, works as expected.

This is my output after following @Biffen's advice regarding set -x:

(master)dbliss@nx4[dist_exp]> rm -r 8*/8*_task_results
+ taskset -p 1 nice -n19 ionice -t -c3 rm -r 8103/8103_task_results 8131/8131_task_results 8132/8132_task_results 8133/8133_task_results 8141/8141_task_results 8142/8142_task_results 8143/8143_task_results 8161/8161_task_results 8162/8162_task_results 8163/8163_task_results 8171/8171_task_results 8172/8172_task_results 8173/8173_task_results 8181/8181_task_results 8182/8182_task_results 8183/8183_task_results 8191/8191_task_results 8192/8192_task_results 8193/8193_task_results 8261/8261_task_results 8262/8262_task_results 8263/8263_task_results 8341/8341_task_results 8342/8342_task_results 8343/8343_task_results 8361/8361_task_results 8362/8362_task_results 8363/8363_task_results 8381/8381_task_results 8382/8382_task_results 8383/8383_task_results 8391/8391_task_results 8392/8392_task_results 8393/8393_task_results 8401/8401_task_results 8402/8402_task_results 8403/8403_task_results 8431/8431_task_results 8432/8432_task_results 8433/8433_task_results 8451/8451_task_results 8452/8452_task_results 8453/8453_task_results 8461/8461_task_results 8462/8462_task_results 8463/8463_task_results
taskset (util-linux-ng 2.17.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process

  -p, --pid                  operate on existing given pid
  -c, --cpu-list             display and specify cpus in list format
  -h, --help                 display this help
  -V, --version              output version information
. . . 

Of note, rm does work for me:

dbliss@nx4[~]> touch banana
dbliss@nx4[~]> ls banana
banana
dbliss@nx4[~]> rm banana
dbliss@nx4[~]> ls banana
ls: cannot access banana: No such file or directory

Solution

  • Your admin (or somebody) had aliased the rm command. Use \rm to bypass the alias temporarily, or unalias rm and go wild.