Why does :wq fail with File is read only, but :w! then :q succeeds?
This file was opened by the command sudo vi filename since the permissions are 550
The sudo command allows you to override the permissions of the file 550 (rxrx-). :wq won't override but :w! will.
Note that the purpose of the ! is to 'force' your command w. :wq doesn't include the 'force' modifier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With