Thank you for posting your question in the Support Community. The guide Configuring Port Access Control in AOS is excellent and includes very good explanations of the options, with GUI and CLI examples. Perhaps the following would match what you're trying to accomplish:
Switch (config)#interface gigabit-switchport 0/1
Switch (config-giga-swx 0/1)#switchport port-security
Switch (config-giga-swx 0/1)#switchport port-security sticky
This will remember the first learned MAC address until the next reboot. Alternately, switchport port-security sticky-volatile will make the sticky MAC addresses persist across a reboot.
To apply port security to a range of interfaces at once:
Switch (config)#interface range gigabit-switchport 0/1-48
Switch (config-giga-swx 0/1-48)#switchport port-security
Switch (config-giga-swx 0/1-48)#switchport port-security sticky
I went ahead and flagged the "Correct Answer" on this post to make it more visible and help other members of the community find solutions more easily. If you don't feel like the answer I marked was correct, feel free to come back to this post to unmark it and select another in its place with the applicable buttons. If you have any additional information on this that others may benefit from, please come back to this post to provide an update. If you still need assistance, we would be more than happy to continue working with you on this - just let us know in a reply.