By mistake, I did zip *
in the shell. After execution, I failed to find the zip file. Where could I find the file and delete it?

- 29
-
1You've not provided any OS/release details; but if you didn't specify a file to save the output, the output likely went to stdout (standard output) and wasn't saved to a file (as you didn't specify one) – guiverc Feb 19 '24 at 05:59
-
1@guiverc, "zip" is probably the "Info-Zip" version, which doesn't follow Linux conventions. – Mark Feb 19 '24 at 21:49
1 Answers
When you run zip
without specifying the destination file, it will take its first argument as the destination. If it ends in .zip
, it will be modified or overwritten, otherwise a new file with .zip
appended will be created.
Unlike what the comment said, it is not true that "the output likely went to stdout (standard output) and wasn't saved to a file (as you didn't specify one)" . Even if you have a file named "-", zip
will refuse to do that with "zip error: Invalid command arguments (cannot write zip file to terminal)".
To find which is likely to be your file, run x=(*); echo $x
. This lists the files from the *
and prints the first file. If that doesn't work, you can do find -mtime -2
to find all files changed within the last 2 days and see which one is the zip.

- 4,594
-
ls -clrt
is a handy command: files with the most recent inode change time will be last (closest to the next prompt where your eyes are looking). Archive tools that may set an old mod time on extract, but they can't set an old ctime. (And doing almost anything to a file updates the ctime, even renaming it even though that doesn't change anything in the inode.) – Peter Cordes Feb 19 '24 at 19:58 -
That first sentence is a bit self-contradictory. The first (non-option) argument is the one that specifies the destination file. You can't not specify it and have some arguments left. – ilkkachu Feb 19 '24 at 20:41