"file /var/log/syslog is being edited" message in nano

To the best of my knowledge, I can view /var/log/syslog with the command

sudo nano /var/log/syslog

and successfully did so several times during a session; however, I was trying to search the log for keywords and apparently entered some 'unknown commands' by mistake. The terminal froze, so I killed it to try starting over.

Now, when I issue the command above, I get what appears to be a blank file with the prompt at the bottom of the terminal window:

File /var/log/syslog is being edited (by root using Nano 2.4.2) CONT

with options, Yes, No and Cancel.

Why is this happening? Have I screwed up my syslog file? If so, how dire is that?


If the option "vim-style lock-files" is enables (set locking in nanorc), which is the case by default, nano creates a special so called "lock file" while you edit a file to indicate that the file is currently edited.

Normally this file is removed when nano is closed, but that doesn't happen if you kill it by closing the terminal.

Just remove the file

/var/log/.syslog.swp