---
title: "How to save a file with sudo in VIM"
description: "How to save a file with sudo in VIM"
canonical: https://oozou.com/til/how-to-save-a-file-with-sudo-in-vim-18
locale: en
date: 2020-10-13
topic: vim
---

# How to save a file with sudo in VIM

> How to save a file with sudo in VIM

Published: 2020-10-13 · Topic: [vim](https://oozou.com/til-topics/vim) ([markdown](https://oozou.com/til-topics/vim.md))

```vim
:w !sudo tee %
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
