Bagaimana cara membuka file ketika 'vi' melaporkannya sudah terbuka?

10

Untuk beberapa alasan, ketika saya mencoba mengedit vi .profile, terminal terus memberi tahu saya bahwa saya sudah memiliki profil di mode edit.

E325: ATTENTION
Found a swap file by the name ".profile.swp"
          owned by: smaranh   dated: Fri Apr  6 09:46:45 2012
         file name: ~smaranh/.profile
          modified: YES
         user name: smaranh   host name: ubuntu
        process ID: 4394
While opening file ".profile"
             dated: Fri Apr 27 10:35:32 2012
      NEWER than swap file!

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r .profile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".profile.swp"
    to avoid this message.
".profile" 23 lines, 713 characters
Press ENTER or type command to continue

Jadi saya mencoba untuk mematikan proses yang ditampilkan di atas, tetapi terus muncul No such process.

Saya kemudian menggunakan ps -ef | grep 4394dan mendapatkan output ini,

smaranh   3491  3375  0 10:08 pts/3    00:00:00 grep --color=auto 4394

Jadi saya mencoba kill -9 3491tetapi masih memberi saya No such process. Tidak yakin apa yang salah?

Bagaimana cara menutup yang sudah terbuka .profile?

Sam007
sumber

Jawaban:

16

Ini adalah file swap lama yang masih ada karena editor mungkin macet atau terbunuh. Anda dapat menghapusnya dengan aman.

rm .profile.swp
Eric Carvalho
sumber
1
apakah saya masih memiliki konten asli dari .profilefile saya ?
Sam007
1
TIDAK . Periksa jawaban yang diedit.
SirCharlo
@ Sam007 Maaf. Kesalahanku. Aku agak mengantuk sekarang ...
Eric Carvalho
@EricCarvalho Selalu waspada dengan rmperintah !!
SirCharlo
1
@ Sam007 meta.askubuntu.com/a/3973/65926
Eric Carvalho