SOLVED: mv command with no destination?!?! omg it's gone?

LinuxLegends

New Member
Joined
Jul 18, 2022
Messages
13
Reaction score
1
Credits
135
So I was following a guide and the guy did a move command without a destination. I thought it made like a copy or something. But it had brackets at the end like this:

mv folders/file.key{,.bak}

now I can't find the file. even if I search by file extension like:

find . *.key

is the file deleted forever? where'd it move to?
 


I did a search by .bak using the command osprey gave and it's still not showing up!

Also wouldn't a search by the name have it show up, even if it has a .key in the end?
In other words, if I do:
Code:
 find . goat
it would return a file named "goat.key.bak" right?
 
Check the following code to see what the results are of the various commands. It's apparent that "file . goat" will show the file "goat.bak" in a listing but it only does so because it prints all the files in the directory it is looking in, and since the command is looking for "goat", it doesn't find that particular file and outputs "No such file or directory" for that file "goat". The more precise result that you would get in looking for the file with .bak in its name comes from the file command using the -name option as shown at the end of the code below.
Code:
[tom@jub ~]$ ls
file1  file2  file3  goat.bak

[tom@jub ~]$ find . goat
.
./file3
./file1
./file2
./goat.bak
find: ‘goat’: No such file or directory

[tom@jub ~]$ find . -name goat
[tom@jub ~]$ find . goat.bak

.
./file3
./file1
./file2
./goat.bak
goat.bak

[tom@jub ~]$ find . -name goat.bak
./goat.bak

[tom@jub ~]$ find . *.bak
.
./file3
./file1
./file2
./goat.bak
goat.bak
[tom@jub]$ find . -name *.bak
./goat.bak

As to the .bak file not showing up at all on your system, I can only speculate that it may have been inadvertently deleted or renamed with another filename. You could check all the files in the directory to see if such renaming has occurred.
 
I realized the issue was once you add the dot to the find command, it only does that directory and not the sub directories!

Once I narrowed it down, the file showed up with the commands you suggested.
Is there a way to get the subs too?

*marked this as solved now
 

Members online


Latest posts

Top