0

I have a directory, let's say its name is direct in which has multiple files whose names are .xyz, .abc, .klm and .etk4 etc. Is there a way to make all those hidden files visible at the same time instead of one by one? I know this question has been asked before here but I did not get the answer. I hope somebody can explain it to me in a simple way since I am not much familiar with linux.

Watzinki
  • 109
  • 1
  • 8

1 Answers1

2
for file in .[^.]*
do
    mv "${file}" "${file#.}"
done

${var#prefix} expands to the value of $var with the initial prefix removed.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Thanks Barmar for you reply.I must have clarified everything in my question. I edited it now. Hope it is more clear now. – Watzinki Mar 14 '14 at 22:19
  • I've updated my answer to use a more general wildcard. The important thing is to use a wildcard that doesn't match `.` and `..`, since those represent the current and parent directory, and you don't want to rename them. – Barmar Mar 14 '14 at 22:22