In general, no. This can be hardware dependent, so you may be able to to do so depending on your machine.
You may be able to limit the charging threshold. But I know of no terminal command on Linux that can halt or restart charging.
Yes, this is where that Hardware compliant problem comes into play.
Does your hardware show having a file or directory in /sys/devices/platform/ directory?
If so, you may be able to quite easily set a Battery charging Threshold there.
I went through all the directories and files under /sys/devices/platform... there's no reference to the battery.
There is under /sys/module/battery/sys/bus/acpi/drivers/battery, but no mention of any charge limit.
I wonder... if I were to change /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/charge_full_design to show a lower full charge, if the charger would stop charging when it hit that lower level? Right now it's 3592000.
Or the capacity_level file... right now it says Full.
Or the capacity file... right now it says 100.
Or is that overwritten by the battery management hardware?
Further reading can be found here - Just as an Example:
What you may prefer to do is set a file to limit charging capacity, rather than change a direct system file.
There are probably several different ways to go about achieving the effect. This is not something I have ever done, so I am limited in any helpfulness.
Actually, I'm not even sure how to change that file. I took ownership of it using chown, changed the permissions to read-write, then opened a root gedit, edited it and attempted to save. I get Unexpected error: Error writing to file: No such device.
Figuring that I had permission to save to that file under my account and group, I then did the same without root... same thing.
So I changed the owner and group back to root and the permissions back to read-only while I do research.
So how do I edit /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/charge_full_design?
It's just a plain-text file with a single number in it (the battery capacity: 3592000). I'm betting that it compares the number in that file with the number in /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/charge_full, then limits charging as the battery ages and the 'charge-full' number drops... so if I edit 'charge_full_design' to be lower, it'll think it's overcharged the battery and cut off charging.
I recommend against ever doing this.
Files in Root need to remain under Root ownership so that Root can access and utilize them.
Instead, elevate your user privileges to SuperUser (SUDO) in order to gain access to write to files in Root.