I 'fat-fingered' a comma to the end of a mv command
mv path/file .,
The file seems to have disappeared into an ether somewhere. 'find' found nothing.
CodePudding user response:
Unlike . and .., the name ., has no special meaning, so the file is there and is actually named .,.
Verify that the file is there:
ls -l .,
You can move it back by just reversing the arguments to mv:
mv ., path/file
CodePudding user response:
Linux ls command hide files starting with a dot. If you only type ls all the files or directories like .ssh or .bashrc in your home directory will not be displayed. To get all files, you have to give ls -a option ( all ).
What you did by moving with mv path/file ., is simply moving your source file to the destination .,, means your file has exactly this name. By entering ls -a or even `ls -l .,' you see it as all other normal files.
You simply can copy or move it again with mv ., <destination_path/destination_name>.
You said: " 'find' found nothing."
That is maybe a wrong observation as find will see all files even those which starting with a dot.
find -maxdepth 1 | grep ',' gives:
./.,
Maybe you searches in the wrong place?
CodePudding user response:
I have done the same and I find the ".," easily:
ls -ltra | grep ","
-rwxrwxrwx 1 user1 user1 0 Jan 19 10:09 .,
The deal is the usage of the a switch in the ls command: this also shows file, starting with a dot (which are in fact normally invisible in UNIX/Linux), as you can see from the manpage:
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of
-cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
Oh, you need to look into the parent directory of the path directory :-)
