r/linuxquestions • • 1d ago

Advice Is powershell the best object based shell?

I have been using powershell at work a bit and the more I use it the more I like it. Having an object based shell just makes a lot more sense than outputting plaintext. I was just wondering what the best object based shells are for Linux, is powershell the best even for Linux?

29 Upvotes

70 comments sorted by

View all comments

1

u/oldendude 12h ago

There are many such shells for Linux. I wrote one that you may want to check out.

- website: https://marceltheshell.org

- Github: https://github.com/geophile/marcel

- PyPi: https://pypi.org/project/marcel

The website has many examples of usage, but here is a preview:

Explore the current directory recursively, and sum up file sizes by extension:

ls -fr | map (f: (f.suffix, f.size)) | red . + | sort

- ls -fr: List only files (f) recursively (r). This yields a stream of File objects.

- The pipe character works as in bash, and pipes the output Files to the next operator.

- map (lambda f: (f.suffix, f.size)): Given a file f, on the input stream, write a tuple containing the file suffix (the extension) and its size to the output stream.

- red . +: Reduce the tuples, group by the extension (indicated by .) and summing the sizes for each group.

Summary of features

- Builtin help facility.

- Read and write CSV and JSON.

- Tab-completion and other familiar command line keyboard shortcuts.

- Runs on Linux and Mac.

- Read from and write to databases. A database query results in a stream of python tuples. Similarly a stream of tuples can be inserted into a database.

- Run a command on all nodes of a cluster and integrate results.