"file /var/log/syslog is being edited" message in nano
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
Related videos on Youtube
munr0
Updated on September 18, 2022Comments
-
munr0 over 1 year
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?
-
Pooping over 8 yearsWhen the terminal appears frozen, sometimes this happens because
ctrl-s
was pressed which causes the display to stop updating. To recover from that, pressctrl-q
. Also, if you don't intend on editing a file, consider using something likeless
instead of an editor so you don't inadvertently make changes.
-
-
kos over 8 yearsAlso faster hitting Y and CTRL+X; the lock is replaced by the new instance and removed upon CTRL+X.
-
munr0 over 8 yearsFantastic! This worked perfectly. Thanks, Florian Diesch!
-
Frank Nocke over 7 yearsCan't find that
.syslog.swp
file as ofUbuntu 16.04.1 LTS
. -
user2972154 over 7 yearsFor Ubuntu 16.04 LTS the nano lock file, as explained by Florian Diesch, is located in the path of the file being edited and takes the hidden name of the file with the suffix .swp. > Thus if editing /path/to/file, the corresponding lock file is /path/to/.file.swp. Delete the .file.swp to release the lock
-
Patrick over 6 yearsone method to delete the .swp file is to use 'sudo find /path/to/.filename.swp -type f -delete'
-
user25 about 6 yearslinux sucks, why such problems? I closed all terminal windows, where is it still used?
-
user25 about 6 yearsno such file:
sudo rm $HOME/.bashrc.swp
, and can't still accessnano $HOME/.bashrc
File .../.bashrc is being edited (by root with nano 2.5.3, PID 24112); continue -
Pablo Bianchi over 5 yearsAlso say "...with nano 2.5.3, PID 18017". Where did it get that PID? Is not on hidden swp file. Sometimes it doesn't exist.
-
Bobort about 4 years@kos, you should really make your comment an answer! It's the only reasonable thing to do!
-
steveb over 3 years@kos I am late to this question but, your comment solved my problem. The file this answer refers to, didn't exist for me.