# \#shell

**URL:** https://discourse.julialang.org/tag/shell/69.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Removing directory contents recursively](https://discourse.julialang.org/t/removing-directory-contents-recursively/128761)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 6\
**Last updated:** [May 6, 2025, 4:31pm UTC](https://discourse.julialang.org/t/removing-directory-contents-recursively/128761 "2025-05-06T16:31:50Z")

</div>

Hi all, still struggling with this. I want to run command rm -rf /path/to/dir/\*, so that I delete the content but not the dir itself. I get this julia\> Base.run(\`rm -rf $(ReproData.root())/code/"\*"\`) Process(\`rm -rf '/…

---

## [Quoting in shell commands](https://discourse.julialang.org/t/quoting-in-shell-commands/6781)

<div class="topic-metadata">

**Author:** [@harven](https://discourse.julialang.org/u/harven)\
**Replies:** 5\
**Last updated:** [October 30, 2017, 6:46pm UTC](https://discourse.julialang.org/t/quoting-in-shell-commands/6781 "2017-10-30T18:46:27Z")

</div>

I don’t understand the new behavior of the shell wrt quotation. Assuming that there are files in the current directory starting by img, how do I execute the following shell command from julia? $ ls -l img\* The foll…

---

## [Redirect the error output of an AppleScript called through Cmd](https://discourse.julialang.org/t/redirect-the-error-output-of-an-applescript-called-through-cmd/123825)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 1\
**Last updated:** [December 13, 2024, 11:45pm UTC](https://discourse.julialang.org/t/redirect-the-error-output-of-an-applescript-called-through-cmd/123825 "2024-12-13T23:45:03Z")

</div>

The next question (for background see Interpolate into an AppleScript called through Cmd). When calling AppleScript from the shell, the redirection works as expected: eben60@Macmini ~ % osascript -e 'POSIX path of (cho…

---

## [Interpolate into an AppleScript called through Cmd](https://discourse.julialang.org/t/interpolate-into-an-applescript-called-through-cmd/123824)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 1\
**Last updated:** [December 13, 2024, 8:57pm UTC](https://discourse.julialang.org/t/interpolate-into-an-applescript-called-through-cmd/123824 "2024-12-13T20:57:08Z")

</div>

The background: the NativeFileDialog.jl unfortunately makes problems on MacOS 15 (i.e. current version). I’m trying to put together a workaround. This one actually works: cmd1 = \`osascript -e 'POSIX path of (choose fi…

---

## [Terminal on Windows: git bash](https://discourse.julialang.org/t/terminal-on-windows-git-bash/6005)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [December 8, 2024, 3:11pm UTC](https://discourse.julialang.org/t/terminal-on-windows-git-bash/6005 "2024-12-08T15:11:05Z")

</div>

Would it be possible to bundle the Julia dist for Windows with the git bash terminal? It is much more useful than the current Windows terminal (shell mode works!). (See Usable shell on Windows (yay!))

---

## [Can the Julia shell be changed to \`/bin/bash\`?](https://discourse.julialang.org/t/can-the-julia-shell-be-changed-to-bin-bash/122500)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 3\
**Last updated:** [December 7, 2024, 10:02pm UTC](https://discourse.julialang.org/t/can-the-julia-shell-be-changed-to-bin-bash/122500 "2024-12-07T22:02:32Z")

</div>

I’ve just learned that the Julia shell is not /bin/sh as I had assumed. It is it’s own thing, apparently. Can the default shell be changed so that a /bin/bash shell is launched when the Shell Mode key ; is pressed? I’m…

---

## [Collecting all output from shell commands](https://discourse.julialang.org/t/collecting-all-output-from-shell-commands/15592)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 27\
**Last updated:** [September 28, 2024, 7:34pm UTC](https://discourse.julialang.org/t/collecting-all-output-from-shell-commands/15592 "2024-09-28T19:34:32Z")

</div>

I want to run a command that may or may not exit gracefully. In any case I want to get all of the following information from it: content of stdout as String content of stderr as String exit code as Int What is the rec…

---

## [No such file when using backticks for running external program](https://discourse.julialang.org/t/no-such-file-when-using-backticks-for-running-external-program/110264)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 10\
**Last updated:** [February 16, 2024, 9:50am UTC](https://discourse.julialang.org/t/no-such-file-when-using-backticks-for-running-external-program/110264 "2024-02-16T09:50:00Z")

</div>

Hello, I’m sorry to bother with such a seemingly trivial problem but I’m stuck with a stupid problem. I have a simple file that I’d like to read. open(path) do f readdlm(f,header=true)\[1\] end where path contain…

---

## [Julia's shell mode can't recognize user-defined aliases of system commands on Linux](https://discourse.julialang.org/t/julias-shell-mode-cant-recognize-user-defined-aliases-of-system-commands-on-linux/109724)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 11\
**Last updated:** [February 6, 2024, 6:47am UTC](https://discourse.julialang.org/t/julias-shell-mode-cant-recognize-user-defined-aliases-of-system-commands-on-linux/109724 "2024-02-06T06:47:32Z")

</div>

Why can’t Julia’s shell mode recognize user-defined aliases of system commands on Linux? I defined some aliases in the ~/.bashrc file such as alias mydir="cd ~/path/to/my/directory/" so that I can conveniently cd to m…

---

## [Error with setting TZ=UTC when running touch in Julia](https://discourse.julialang.org/t/error-with-setting-tz-utc-when-running-touch-in-julia/107315)

<div class="topic-metadata">

**Author:** [@KeepLearning](https://discourse.julialang.org/u/KeepLearning)\
**Replies:** 2\
**Last updated:** [December 11, 2023, 2:32am UTC](https://discourse.julialang.org/t/error-with-setting-tz-utc-when-running-touch-in-julia/107315 "2023-12-11T02:32:47Z")

</div>

Hi, I wanted to run the unix command in Julia as follows: run(\`TZ=UTC touch -t "YYMMDDhhmm" filename\`) but got an IOError, assuming that I am in a different time zone from UTC and wanted to set the timestamp of a file…

---

## [Command hangs: \`run(pipeline(\`git diff\`, stderr=err, stdout=out), wait=true)\`](https://discourse.julialang.org/t/command-hangs-run-pipeline-git-diff-stderr-err-stdout-out-wait-true/103742)

<div class="topic-metadata">

**Author:** [@adomasbaliuka](https://discourse.julialang.org/u/adomasbaliuka)\
**Replies:** 3\
**Last updated:** [September 21, 2023, 9:05am UTC](https://discourse.julialang.org/t/command-hangs-run-pipeline-git-diff-stderr-err-stdout-out-wait-true/103742 "2023-09-21T09:05:43Z")

</div>

(Found while debugging DrWatson.jl) Setup (git repo with changed file): # julia 1.9.3, Commit bed2cd540a1 (2023-08-24 14:43 UTC) shell\> mkdir JuliaGitWithPipeHangs shell\> cd JuliaGitWithPipeHangs shell\> git init Initia…

---

## [Terminating a process on Windows](https://discourse.julialang.org/t/terminating-a-process-on-windows/87481)

<div class="topic-metadata">

**Author:** [@Ashlin\_Harris](https://discourse.julialang.org/u/Ashlin_Harris)\
**Replies:** 1\
**Last updated:** [April 21, 2023, 8:26pm UTC](https://discourse.julialang.org/t/terminating-a-process-on-windows/87481 "2023-04-21T20:26:41Z")

</div>

I’m not able to kill a Julia process on Windows. Instead, its status remains as ProcessSignaled, and it never terminates. The issue doesn’t exist on MacOS and Linux, and it occurs regardless of Julia version. I didn’t ex…

---

## [Writing a zsh script to test a Julia project](https://discourse.julialang.org/t/writing-a-zsh-script-to-test-a-julia-project/96897)

<div class="topic-metadata">

**Author:** [@mmv](https://discourse.julialang.org/u/mmv)\
**Replies:** 2\
**Last updated:** [March 31, 2023, 11:50pm UTC](https://discourse.julialang.org/t/writing-a-zsh-script-to-test-a-julia-project/96897 "2023-03-31T23:50:48Z")

</div>

Hi! I’d like to write a zsh script to automate the testing of a Julia project by launching Julia starting the Pkg environment executing the following three commands: activate . add Test test \[project\_name\] exiting …

---

## [Setting fish shell environment variables correctly for julia shell](https://discourse.julialang.org/t/setting-fish-shell-environment-variables-correctly-for-julia-shell/90158)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 2\
**Last updated:** [November 12, 2022, 5:01pm UTC](https://discourse.julialang.org/t/setting-fish-shell-environment-variables-correctly-for-julia-shell/90158 "2022-11-12T17:01:39Z")

</div>

I need to come back to an old question. I am unable to see my system ENV variables in the julia shell. I set the env vars in fish with set -U key value like so: floswald@PTL11077 ~\> set -U JULIA\_VAR howdie floswald@PTL…

---

## [Input/output to an external process](https://discourse.julialang.org/t/input-output-to-an-external-process/78160)

<div class="topic-metadata">

**Author:** [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Replies:** 3\
**Last updated:** [March 20, 2022, 2:19pm UTC](https://discourse.julialang.org/t/input-output-to-an-external-process/78160 "2022-03-20T14:19:49Z")

</div>

Hi, I want to both read and write to an external process. It seems that if e.g. I just want to read or write to a process, there’s a nice way of doing that (from the docs): open(\`less\`, "w", stdout) do io for i =…

---

## [How to pass arguments to Cmd?](https://discourse.julialang.org/t/how-to-pass-arguments-to-cmd/73959)

<div class="topic-metadata">

**Author:** [@melonedo](https://discourse.julialang.org/u/melonedo)\
**Replies:** 5\
**Last updated:** [January 3, 2022, 5:22pm UTC](https://discourse.julialang.org/t/how-to-pass-arguments-to-cmd/73959 "2022-01-03T17:22:47Z")

</div>

For example I might call \`echo\` with argument "hello", how can I do it? Assume cmd = \`eho\` , I found that push!(cmd.exec, "hello" does the trick, but exec is not documented, is this recommended? Also, run from Base has …

---

## [Support for non-POSIX shells](https://discourse.julialang.org/t/support-for-non-posix-shells/72236)

<div class="topic-metadata">

**Author:** [@kubouch](https://discourse.julialang.org/u/kubouch)\
**Replies:** 1\
**Last updated:** [November 29, 2021, 2:55pm UTC](https://discourse.julialang.org/t/support-for-non-posix-shells/72236 "2021-11-29T14:55:21Z")

</div>

The Julia’s shell mode does not seem to work properly when a non-POSIX shell is set as the default system shell. I’m using Nushell, however, I imagine a similar issue is also present with other popular non-POSIX shells, …

---

## [Shell mode causes issues on windows](https://discourse.julialang.org/t/shell-mode-causes-issues-on-windows/51134)

<div class="topic-metadata">

**Author:** [@Rockdeldiablo](https://discourse.julialang.org/u/Rockdeldiablo)\
**Replies:** 6\
**Last updated:** [October 19, 2021, 5:27pm UTC](https://discourse.julialang.org/t/shell-mode-causes-issues-on-windows/51134 "2021-10-19T17:27:01Z")

</div>

Hi everybody, i just installed julia and i am still dealing with various settings,packages and errors. i have recently learned about julia shell mode and I was trying some standard commands with cygwin and cmd. everyth…

---

## [Understanding Shell Interactions within Julia scripts](https://discourse.julialang.org/t/understanding-shell-interactions-within-julia-scripts/67608)

<div class="topic-metadata">

**Author:** [@mwhisena](https://discourse.julialang.org/u/mwhisena)\
**Replies:** 2\
**Last updated:** [September 3, 2021, 12:53am UTC](https://discourse.julialang.org/t/understanding-shell-interactions-within-julia-scripts/67608 "2021-09-03T00:53:25Z")

</div>

Hello! I am a PhD. student hoping to use Julia for some extensive ML CFD data analysis. I am having trouble with shell scope within a Julia script. I need to source (via Linux bash shell) a bashrc file for OpenFOAM (CFD…

---

## [Julia shell command tar and pigz pipeline](https://discourse.julialang.org/t/julia-shell-command-tar-and-pigz-pipeline/66175)

<div class="topic-metadata">

**Author:** [@wuxinyu](https://discourse.julialang.org/u/wuxinyu)\
**Replies:** 2\
**Last updated:** [August 11, 2021, 7:34am UTC](https://discourse.julialang.org/t/julia-shell-command-tar-and-pigz-pipeline/66175 "2021-08-11T07:34:18Z")

</div>

I want to compress a folder in julia: tar -cvf - "source" | pigz -k -9 \> "source.tar.xz" where source is a folder I tried this in julia: run(pipeline(\`tar -cvf - "2001\_ A Space Odyssey"\` , \`pigz -k -9 \\\> "2001\_ A Spa…

---

## [From a Julia program, run a ffmpeg shell command on a folder of files to make a mp4 movie](https://discourse.julialang.org/t/from-a-julia-program-run-a-ffmpeg-shell-command-on-a-folder-of-files-to-make-a-mp4-movie/65910)

<div class="topic-metadata">

**Author:** [@nelsonah](https://discourse.julialang.org/u/nelsonah)\
**Replies:** 2\
**Last updated:** [August 6, 2021, 4:10pm UTC](https://discourse.julialang.org/t/from-a-julia-program-run-a-ffmpeg-shell-command-on-a-folder-of-files-to-make-a-mp4-movie/65910 "2021-08-06T16:10:53Z")

</div>

Presently I have a Julia script file that generates a folder of jpeg files. Then I launch Windows PowerShell in that folder and execute my ffmpeg command such as: ffmpeg -r 50 -start\_number 10001 -i i\_%5d.jpeg -c:v lib…

---

## [On run(\`export\`) vs ;export](https://discourse.julialang.org/t/on-run-export-vs-export/63479)

<div class="topic-metadata">

**Author:** [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Replies:** 1\
**Last updated:** [June 24, 2021, 3:06am UTC](https://discourse.julialang.org/t/on-run-export-vs-export/63479 "2021-06-24T03:06:58Z")

</div>

I would like to run the command export in shell mode, and it works in the REPL if I run ;export, but I need to have this inside my code so after doing research I thought it would be run(export), export inside backtick, b…

---

## [Change directory before running an external command](https://discourse.julialang.org/t/change-directory-before-running-an-external-command/59479)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 2\
**Last updated:** [April 17, 2021, 3:11pm UTC](https://discourse.julialang.org/t/change-directory-before-running-an-external-command/59479 "2021-04-17T15:11:52Z")

</div>

I have a julia file, say FileIwantToRun.jl in many folders/directories. I want to write a script that visits each of these directories and runs this file from those directories (it outputs a file that I want it to save i…

---

## [Setting number of threads and parsing arguments](https://discourse.julialang.org/t/setting-number-of-threads-and-parsing-arguments/57904)

<div class="topic-metadata">

**Author:** [@mjanun](https://discourse.julialang.org/u/mjanun)\
**Replies:** 6\
**Last updated:** [March 25, 2021, 6:36pm UTC](https://discourse.julialang.org/t/setting-number-of-threads-and-parsing-arguments/57904 "2021-03-25T18:36:34Z")

</div>

I understand that to launch Julia with multithreading from command prompt (on Windows), one has to pass the following command before launching Julia: set JULIA\_NUM\_THREADS=4 I am calling Julia from Excel/VBA using the S…

---

## [Julia package for running shell commands](https://discourse.julialang.org/t/julia-package-for-running-shell-commands/56074)

<div class="topic-metadata">

**Author:** [@ispandey81](https://discourse.julialang.org/u/ispandey81)\
**Replies:** 1\
**Last updated:** [February 26, 2021, 9:55am UTC](https://discourse.julialang.org/t/julia-package-for-running-shell-commands/56074 "2021-02-26T09:55:12Z")

</div>

Is there a julia package for running shell commands which can take command line arguments?

---

## [Start Julia directly in shell\> or pkg\> mode?](https://discourse.julialang.org/t/start-julia-directly-in-shell-or-pkg-mode/54296)

<div class="topic-metadata">

**Author:** [@QuantumBits](https://discourse.julialang.org/u/QuantumBits)\
**Replies:** 5\
**Last updated:** [January 30, 2021, 11:24pm UTC](https://discourse.julialang.org/t/start-julia-directly-in-shell-or-pkg-mode/54296 "2021-01-30T23:24:29Z")

</div>

Hi! Is it possible to start a Julia REPL from the command line directly in shell\> or pkg\> mode without having to type ; or \], respectively, after the REPL loads? For example, something like: $ julia julia\> $ julia --she…

---

## [Cannot find output of run() command](https://discourse.julialang.org/t/cannot-find-output-of-run-command/50788)

<div class="topic-metadata">

**Author:** [@ruysan](https://discourse.julialang.org/u/ruysan)\
**Replies:** 2\
**Last updated:** [January 27, 2021, 2:33am UTC](https://discourse.julialang.org/t/cannot-find-output-of-run-command/50788 "2021-01-27T02:33:41Z")

</div>

Hi! I am generating a shell cut command with a series of arguments parsed from a file header. the output of the command it redirected to a file: cut -f 1-9,14,15 input\_file \> output\_file I can print the command itsel…

---

## [A small package to run string as shell command](https://discourse.julialang.org/t/a-small-package-to-run-string-as-shell-command/6163)

<div class="topic-metadata">

**Author:** [@innerlee](https://discourse.julialang.org/u/innerlee)\
**Replies:** 8\
**Last updated:** [April 28, 2020, 12:17am UTC](https://discourse.julialang.org/t/a-small-package-to-run-string-as-shell-command/6163 "2020-04-28T00:17:11Z")

</div>

Building a string is easy, but building a Cmd is always a headache to me. So I write a small package to run strings as Cmd. Here is the task that drives me to write the package: There are some sub-folders containing .pn…

---

## [A clever way to find the available memory the host currently has free/available?](https://discourse.julialang.org/t/a-clever-way-to-find-the-available-memory-the-host-currently-has-free-available/36611)

<div class="topic-metadata">

**Author:** [@met-j](https://discourse.julialang.org/u/met-j)\
**Replies:** 4\
**Last updated:** [March 27, 2020, 9:07pm UTC](https://discourse.julialang.org/t/a-clever-way-to-find-the-available-memory-the-host-currently-has-free-available/36611 "2020-03-27T21:07:11Z")

</div>

Writing a program which uses single files to large to fit in the memory of normal desktops or laptops, I thought it would be nice to dispatch on the available memory relative to some expected required memory. In case the…

---

## [Proper escaping when building a command with nested quotes](https://discourse.julialang.org/t/proper-escaping-when-building-a-command-with-nested-quotes/31432)

<div class="topic-metadata">

**Author:** [@dapz](https://discourse.julialang.org/u/dapz)\
**Replies:** 0\
**Last updated:** [November 23, 2019, 8:23pm UTC](https://discourse.julialang.org/t/proper-escaping-when-building-a-command-with-nested-quotes/31432 "2019-11-23T20:23:35Z")

</div>

Hi, I was wondering if there is a “rule” to write commands with nested quotes that work. Here is an example with 3 nested commands (bash calling bash calling julia). My final goal is slightly different (a julia call pass…

[Next page](https://discourse.julialang.org/tag/shell/69.md?match_all_tags=true&page=1&tags%5B%5D=shell)
