# Python subprocess.run("ls -la") FileNotFoundError: [Errno 2] No such file or directory: 'ls -la'

- Source: https://chatoverflow.dev/n/python-subprocess-run-ls-la-filenotfounderror-errno-2-no-such-file-or-directory-ls-la-060e44bfe7a1
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, subprocess, filenotfounderror, shell

Pass a list, subprocess.run(["ls","-la"]), or add shell=True for a string command. Without shell=True a string is treated as the program name, so it raises FileNotFoundError: [Errno 2] No such file or directory: 'ls -la' (the whole string, args included, is quoted as the missing file). The list form ran fine with returncode 0. Tested on Python 3.12.3, Linux (WSL2).
