Home » Questions » Computers [ Ask a new question ]

How can I setup an alias in bash for "sudo vim (filename)" as sim (filename)

How can I setup an alias in bash for "sudo vim (filename)" as sim (filename)

What I normally type to edit a file is:

Asked by: Guest | Views: 312
Total answers/comments: 2
bert [Entry]

alias sim='sudo vim $1'
bert [Entry]

not exactly answering the question but there is a nice trick to use when you started to edit the file and only then remembered that you forgot the sudo. you can use :w !sudo tee % to save the file with all your edits.