VIM 사용하다가 저장시 root 계정이 없다고 뜬다면?

리눅스/MAC 에서

vi /etc/hosts 와 같이 시스템 파일을 건들고, 열심히 수정을 하였습니다. 그런데 만약 sudo 명령어를 잊고 실행시켰다는 것을 알았다면?  다시 작성할까…. 고민하시는 분들을 위한 꿀팁입니다.

:는 명령어 내린다는 것을 다들 알것이고, w 는 저장입니다. 이에 뒤붙여서 !sudo tee % 하면 비밀번호 입력하라고 합니다. 비번입력하면 신기하게 저장됩니다.

:w !sudo tee %

이제 파일 다시 수정하지 마세요.

MAC 에서도 적용되는 내용입니다.

오늘은 여기까지.

“VIM 사용하다가 저장시 root 계정이 없다고 뜬다면?”에 대한 64개의 댓글

  1. Simply wish to say your article is as surprising.
    The clearness in your post is simply great and i can assume you are knowledgeable in this subject.
    Fine together with your permission allow me to grasp your feed to keep up to date with forthcoming post.
    Thank you one million and please carry on the gratifying work.

  2. I know this if off topic but I’m looking into starting my own blog
    and was curious what all is needed to get setup?

    I’m assuming having a blog like yours would cost a pretty penny?

    I’m not very web savvy so I’m not 100% certain. Any recommendations or advice would be
    greatly appreciated. Thanks

  3. I was wondering if you ever thought of changing the structure of
    your blog? Its very well written; I love what
    youve got to say. But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or 2 pictures.

    Maybe you could space it out better?

  4. Unquestionably imagine that which you stated. Your favorite justification seemed to be on the net the easiest factor
    to bear in mind of. I say to you, I definitely get annoyed while people consider concerns that they just do not
    understand about. You controlled to hit the nail upon the
    top and outlined out the entire thing without having side effect , other
    people can take a signal. Will probably be back to get more.
    Thank you

  5. I think that everything posted was actually very
    reasonable. However, what about this? suppose you typed a catchier post title?

    I ain’t suggesting your information isn’t good, but what if
    you added something to possibly grab a person’s attention? I mean VIM 사용하다가 저장시 root
    계정이 없다고 뜬다면? – 권선우의 스타트업하는 개발자 is kinda plain. You ought to glance at Yahoo’s
    front page and see how they write news titles to grab viewers interested.
    You might try adding a video or a pic or two to get readers
    excited about what you’ve written. Just my opinion, it might make your
    posts a little livelier.

  6. hey there and thank you for your information – I’ve certainly picked up anything new from right here.

    I did however expertise a few technical points using this website,
    since I experienced to reload the website a lot of
    times previous to I could get it to load properly. I had been wondering
    if your hosting is OK? Not that I’m complaining, but
    slow loading instances times will very frequently affect your placement in google and could damage your quality
    score if ads and marketing with Adwords. Anyway I’m adding this
    RSS to my email and could look out for a lot more of your respective
    intriguing content. Make sure you update this again soon.

답글 남기기