How iPad can run terminal as linux system?
Without jailbreaking you can't really. iOS is designed not to allow executables to be created or even files to be moved between apps. Also there is no terminal.

If you want to build apps for iOS you generally use code on a mac.

However there are some apps that allow programming on the iPad but all run inside the app. Examples of this include Swift Playgrounds from Apple and various interpreters for Python, Javascript and Lua. (I have not provided links as I have not used them and my quick search found low rated or old apps) there are also interpreters that you can build on the Mac and install like Pharo ( a version of smalltalk).