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.
Asked
Active
Viewed 1,687 times
0

Watzinki
- 109
- 1
- 8
-
1If their names are `file1`, `file2`, `file3` and `file4`, then they are not hidden files. – Charles Duffy Mar 14 '14 at 21:54
-
How are the files hidden, if their name does not start with a `.`? – abligh Mar 14 '14 at 21:55
-
sorry I forgot to put "dot"before name of the files in my questions.They are supposed to be like this **.file1**, **.file2**, **.file3** and **.file4** – Watzinki Mar 14 '14 at 21:58
-
What is wrong with e.g. `ls -a`? – vonbrand Mar 15 '14 at 01:19
1 Answers
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