I basically want to make an alias to modify '/etc/systemd/logind.conf' file. To change




How can i do it?


You wouldn't even need nano. You could do it like this:

alias enableLid='sudo sed -i "s/^#HandleLidSwitch=ignore/HandleLidSwitch=ignore/" /etc/systemd/logind.conf'

alias disableLid='sudo sed -i "s/^HandleLidSwitch=ignore/#HandleLidSwitch=ignore/" /etc/systemd/logind.conf'

If you want to have one alias to toggle the setting I would create a shell script for it. If you want to use nano anyway:

alias editLogindconf='sudo nano /etc/systemd/logind.conf'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.