Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 1716  / 2 Years ago, wed, march 2, 2022, 12:26:56

my problem is that i keep forgetting to write sudo before every time i use nano, and eventually what happens is i work on a file for a while and don't have permissions. i remember hearing somewhere that you can edit one of the files so that every time i type
nano filename
it will function as if i wrote
sudo nano filename



i haven’t tried anything since I've no previous knowledge about this.



how would i go about doing this?


More From » 12.04

 Answers
4

I suggest to create a Bash alias. I'm assuming you're using Bash as a shell here.



alias nano='sudo nano'


This will map nano to sudo nano. To make it permanent, see this Q&A: How do I create a permanent Bash alias?


[#27833] Thursday, March 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
laceanz

Total Points: 86
Total Questions: 113
Total Answers: 104

Location: Australia
Member since Thu, Jan 26, 2023
1 Year ago
laceanz questions
Tue, Apr 26, 22, 07:43, 2 Years ago
Sat, Oct 23, 21, 09:40, 3 Years ago
Sat, Nov 5, 22, 08:24, 2 Years ago
Sat, Mar 12, 22, 07:56, 2 Years ago
;