Multiple Link Target Change


Dec 27, 2018
Reaction score
Hey guys.

I've come to the obvious post-realisation with my backups of personal files that any link file within my home folder breaks if I import them to a linux user with a different username, and thus home directory name. My first attempt at Linux I put the user as "owner", thus the home directory was named as such, this second time I put the username as "sasha".

Every link file type simply needs it's link target to be changed from /home/owner/* to /home/sasha/* and they won't be broken as far as my understanding goes. Knowing how to change the link target of every link file en masse would be better than locking myself into needing to be known as "owner" for the rest of my life while using linux. :p

I've not successfully done any real scripting before, but with my limited knowledge I believe the steps would be:
  1. find/locate all link file types in my home directory after importing from backups
  2. with all results, switch the link target from */oldusername/* to */new username/*. Perhaps to be safe use /home/username/* to be sure only that directory level is changed in the file link. I do believe the use of "*" will make all that comes after unchanged, correct?

Members online

Latest posts