# Using Commands from Pluto

**URL:** <https://discourse.julialang.org/t/using-commands-from-pluto/138964>\
**Category:** New to Julia\
**Tags:** question, pluto, pluto-markdown\
**Created:** [August 21, 2026, 2:48am UTC](https://discourse.julialang.org/t/using-commands-from-pluto/138964 "2026-08-21T02:48:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![haroldnick0](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@haroldnick0](https://discourse.julialang.org/u/haroldnick0)\
**Post date:** [August 21, 2026, 2:48am UTC](https://discourse.julialang.org/t/using-commands-from-pluto/138964/1 "2026-08-21T02:48:02Z")

</div>

Is it possible to use external operating system commands from Pluto to automate the `fossil add harold/tiddlers/*` step, so that only the final commit has to be done manually from the console?

---

<div class="post-metadata">

**Author:** ![Sevi](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sevi](https://discourse.julialang.org/u/Sevi)\
**Post date:** [August 21, 2026, 9:13am UTC](https://discourse.julialang.org/t/using-commands-from-pluto/138964/2 "2026-08-21T09:13:59Z")

</div>

Hi! Yes, you can run ~~shell~~ \[1\] commands from within Julia and hence Pluto notebooks, e.g. you can run the “list directory” command `ls` on Unix-like systems by running a cell containing this code:

```julia
run(`ls`)

```

This creates a “command object” of type `Cmd` and then runs this command with the function `run`. You can check the documentation of `run` and `Cmd` for a lot more details on how to run this.

Beware that all cells will be run at every startup of a Pluto notebook and all cells that depend on changed cells will also be re-run upon changes. With external shell commands this may or may not be what you want, but there are also ways to avoid running the “command cell” every time you change some dependency of it.

PS: The `run` will return the result of the process, so it will usually print the output or show some error codes if the command failed.

* * *

1. The commands are not run in a shell, actually, see my reply below.

---

<div class="post-metadata">

**Author:** ![haroldnick0](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@haroldnick0](https://discourse.julialang.org/u/haroldnick0)\
**Post date:** [August 24, 2026, 6:33pm UTC](https://discourse.julialang.org/t/using-commands-from-pluto/138964/3 "2026-08-24T18:33:50Z")

</div>

Thanks a lot for your help.  
I’m going to give it a try and let you know if it works. I really appreciate it.

---

<div class="post-metadata">

**Author:** ![Sevi](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sevi](https://discourse.julialang.org/u/Sevi)\
**Post date:** [August 25, 2026, 8:10am UTC](https://discourse.julialang.org/t/using-commands-from-pluto/138964/4 "2026-08-25T08:10:00Z")

</div>

You’re very welcome. And I just realized that I forgot to mention that the command object constructed by Julia might need to be created a bit carefully when it contains special characters (like the `*` in your example). Julia actually doesn’t run the commands in any shell, but executes them directly. So the `*` probably doesn’t do what you would like it to.

E.g. if the command you want to run is

```julia
cmd = `fossil add harold/tiddlers/*`
run(cmd)

```

Julia first complains about the unquoted `*` (so you would need to write `\*`) but then also won’t do what you want, because the expansion of `*` to all the files in the directory is a feature of Bash (or other shells), called “globbing”. This is not done by `run` though, see e.g. here [Quoting in shell commands](https://discourse.julialang.org/t/quoting-in-shell-commands/6781) and the related discussions, e.g. here [Removing directory contents recursively](https://discourse.julialang.org/t/removing-directory-contents-recursively/128761).

Probably the easiest way around it is to explicitly run the command in a shell, e.g. with `bash -c '...'`

```julia
cmd = `bash -c 'fossil add harold/tiddlers/*'`
run(cmd)

```

This should then have the complete expected behavior of the shell you’re running it in (if it’s Bash). The downside is that you rely on Bash being installed on the system, but if not, it can be easily adapted.
