I'm new to Linux and interested in using the command line and automating small tasks. Should I start with Bash or Python?
Should I learn Bash or Python first for Linux command line tasks?
Answers
For that goal, start with the shell. Learn to move around, work with files, read manual pages, and combine commands with pipes and redirection. If you're using Bash, those skills lead naturally into short Bash scripts.
You don't have to master every odd corner of Bash before trying Python. Just get comfortable using the tools you're trying to automate.
Reply to this answer
If you've never programmed before, Python might be the easier first language. Its lists and dictionaries, error handling, and libraries give you a more straightforward way to learn programming concepts. Bash can be surprisingly tricky once a script gets complicated.
I'd still pick up enough shell to run commands and understand files and directories alongside it.
Reply to this answer
There's no need to make it an either-or decision. Bash is handy for connecting command line utilities and automating a few commands. Python is a good fit when you're processing more complex data or the logic is getting hard to follow.
You can even combine them, with a short shell script starting a Python program when that makes sense.
Reply to this answer
Think about where the script needs to run. Bash is commonly available on Linux, while Python may need to be installed separately. Python packages can add setup work too, so a small shell script may be simpler to move around.
Neither interpreter is guaranteed to be present everywhere. Check the actual environment rather than assuming.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_m93!wicketcompass:
Check which shell you're using too. Bash is common on Linux, but it isn't the only one.