Emergency: Fool's Blunder

https://www.codecademy.com/courses/learn-the-command-line/projects/attica

Hey folks. I’m currently doing the CLI introduction course for an upcoming course I’ll be starting next Monday as a prerequisite. I’ve stumbled into an issue where I can’t edit anything in /.bash_profile, I get the error:

‘Error writing lock file //…bash_profile.swp: Permission denied’

Any ideas? I don’t want to have to reset my entire progress over these last few hours for the sake of what I assume to be a slight mishap in one small exercise…

Get it from who, where?

You don’t need to edit that file (note that it’s not saying that ~/.bash_profile), so it doesn’t really matter if you don’t have write permission for it (even though you probably should)

If it’s on your own system I suggest forcefully removing it (elevated privileges) - presumably you created it by editing .bash_profile as root user but abnormally exited the editor, leaving behind a lock file that your current user isn’t allowed to touch

You could also edit a different file, and then move it to .bash_profile, or tell your editor to not use lock files, or use lock files somewhere else

Or maybe you’re just editing the wrong file, in a directory where you indeed don’t have write permission. If you indeed tried to edit /.bash_profile like you said, then that is not the right file.