When you open a file in vim, it creates what’s called a swap file for the file on which you’re working. So if you’re working on two files called temp1 and temp2, you’ll end up with two swap files like this:
$ find . -name '.*.swp'
./.temp2.swp
./.temp1.swp
Once you close vim, those files will go away, unless vim closes unexpectedly (e.g. you lose your ssh connection). To get rid of those files, we can use a little tool I like to call xargs:
$ find . -name '.*.swp' | xargs rm
When you pipe find through xargs rm, you’re saying, “Take the output from find and run an rm command on each one of those items.” If you run find again, you’ll see that those pesky swap files are gone:
$ find . -name '.*.swp'
$
xargs has, of course, many other applications, but this particular technique is helpful if you’ve ever encountered this problem in vim.