To clarify, this was in a windows system running wsl. The commands were run in windows cmd.exe.
So I was working in command prompt, doing some actions with git and switching between cmd.exe and wsl bash. Afterwards, I wanted to move a script file named "sh" to the home directory of my wsl2 ubuntu distribution.
So without thinking (In command prompt, not bash), I ran this exact command
mv sh ~sh
I realize now that I made two errors.
- Since I was not in bash, ~/ is not a valid path
- Even if I was in bash, I forgot the / in between ~ and sh
Essentially, my question is where did my file go?
But also Why didn't the command just rename the file sh to ~sh?
I already ran ls -a and dir in the directory in both command prompt and wsl bash. The file wasn't just named to ~sh and left in the directory as far as I can tell. Also for good measure, I searched my ubuntu home folder, but the file is nowhere to be found.
The script wasn't really important, but more I'm curious where it could have gone.
Doing some further digging,
C:\Program Files (x86)\WinAVR-20100110\utils\bin\mv.exe
This leads me to believe that I didn't run the classic linux mv command but
mv --help just describes essentially the bash mv command "Rename SOURCE to Dest...".
The only section that might be relevant is:
The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values:
But that doesn't really seem to apply to this usage.
I have looked for if the file is simply hidden and also turned off "hide system protected files" for the folder.
Edit (Copied from comment):
mv -i -v example.txt ~sh/example.txt
mv: cannot move `example.txt' to `~sh/example.txt'
mv -i -v example.txt ~sh
example.txt' -> `/example.txt'