Search code examples
linuxfilehiddenvisible

converting hidden files in to normal files in linux


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.


Solution

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

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