I basically want to make an alias to modify '/etc/systemd/logind.conf' file. To change
How can i do it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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'