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,
Running: where mv
Returns: 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):
Running:
mv -i -v example.txt ~sh/example.txt
Returns:
mv: cannot move `example.txt' to `~sh/example.txt'
Running:
mv -i -v example.txt ~sh
Returns:
example.txt' -> `/example.txt'
/example.txt
implies a move to the root of the filesystem, I'd check if the files are in `C:`cd / && ls -l
and press enter.sudo apt update && sudo apt install mlocate
- please use your own judgment whether you need the mlocate package. Then dosudo updatedb && locate -i example.txt