Hello sysadmins, silly question but can I consider Python as a serious alternative to powershell/bash? I have always hidden myself from learning bash considering myself not that kind of guy hacking around in Linux. Thanks in advance

  • 9
    As python is a general purpose language, you can of course use it for anything.
    I personally find it easier for small automation tasks to use Bash (e.g. do backups, clean files) but for larger projects I use Python instead making a thousand line shell script.

    The only downside is, some functionality of the shell commands are hardly available to Python or the results are difficult to parse.

    In the end I'd still recommend you to learn some bash basics, as you may have to maintain an older script from colleagues once.
    Additionally you cannot rely on the availability of Python in your desired version (I'm looking at you, CentOS!) or its packages.
  • 4
    Python helps with high level logic, and certain abstractions that bash as a script just did not care about.
    Also - use an automation tool like ansible to manage your server - based on python.
  • 0
    Depends on what you are doing I guess. For Linux it should be fine since bash doesn't really have any extra functionally. Powershell on the other hand does some dark magic that you probably won't get to work without some significant effort. So unless you want to manage Windows servers I think you are fine with python.
  • 0
    Personally I'm not a sysadmin, but i think that native implementations are usually better. However, if you want to do the same thing across platforms, I'd suggest Python.
Add Comment