[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71833":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},71833,"try","binpash\u002Ftry","binpash","Inspect a command's effects before modifying your live system","",null,"Shell",5433,78,5,26,0,1,36.69,"MIT License",false,"main",true,[24,25,26,27,28],"administration","containers","shell","tools","virtualization","2026-06-12 02:02:55","# try\n\n\u003Cimg src=\"docs\u002Ftry_logo.png\" alt=\"try logo\" width=\"100\" height=\"130\">\n\n\"Do, or do not. There is no try.\"\n\nWe're setting out to change that: `try cmd` and commit---or not.\n\n## Description\n[![Main workflow](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Factions\u002Fworkflows\u002Ftest.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Factions\u002Fworkflows\u002Ftest.yaml)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue)](#license)\n[![issues - try](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues\u002Fbinpash\u002Ftry)](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Fissues)\n\n`try` lets you run a command and inspect its effects before changing your live system. `try` uses Linux's [namespaces (via `unshare`)](https:\u002F\u002Fdocs.kernel.org\u002Fuserspace-api\u002Funshare.html) and the [overlayfs](https:\u002F\u002Fdocs.kernel.org\u002Ffilesystems\u002Foverlayfs.html) union filesystem.\n\nPlease note that `try` is a prototype and not a full sandbox, and should not be used to execute\ncommands that you don't already trust on your system, (i.e. network calls are all allowed)\n\n\u003Cimg src=\"docs\u002Ftry_pip_install_example.gif\" alt=\"try gif\">\n\n## Getting Started\n\n### Dependencies\n\n`try` relies on the following Debian packages\n\n* `attr` (for `getfattr`)\n* `pandoc` and `autoconf` (if working from a GitHub clone)\n\nIn cases where overlayfs doesn't work on nested mounts, you will need either\n[mergerfs](https:\u002F\u002Fgithub.com\u002Ftrapexit\u002Fmergerfs) or [unionfs](https:\u002F\u002Fgithub.com\u002Frpodgorny\u002Funionfs-fuse). `try` should be able to autodetect them, but you can specify the path to mergerfs or unionfs with -U (e.g. `try -U ~\u002F.local\u002Fbin\u002Funionfs`)\n\nTo run `try`'s test suite (`scripts\u002Frun_tests.sh`), you will need:\n\n* `bash`\n* `expect`\n* `curl`\n\n`try` has been tested on the following distributions:\n\n* `Ubuntu 20.04 LTS` or later\n* `Debian 12`\n* `Fedora 38`\n* `Centos 9 Stream 5.14.0-325.el9`\n* `Arch 6.1.33-1-lts`\n* `Alpine 6.1.34-1-lts`\n* `Rocky 9 5.14.0-284.11.1.el9_2`\n* `SteamOS 3.4.8 5.13.0-valve36-1-neptune`\n\n*Note that try will only work on [Linux\n5.11](https:\u002F\u002Fgithub.com\u002Ftorvalds\u002Flinux\u002Fcommit\u002F92dbc9dedccb9759c7f9f2f0ae6242396376988f)\nor higher for overlayfs to work in a user namespace.*\n\n### Installing\n\nThere are three ways to install try:\n\n1. **The quick and janky way: grab the script.** You only need the [`try` script](https:\u002F\u002Fraw.githubusercontent.com\u002Fbinpash\u002Ftry\u002Fmain\u002Ftry). Put it in your `PATH` and you're ready to go. You won't have documentation or utility support, but it should work as is.\n\n2. **By cloning the repository.** Run the following:\n```ShellSession\n$ git clone https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry.git\n$ autoconf && .\u002Fconfigure && make && sudo make install\n```\nYou should now have a fully featured `try`, including the support utilities (which should help `try` run faster) and manpage. Run `make test` to confirm that everything works.\n\n3. **By using a source distribution.** Download `try-XXX.tgz` from [the release page](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Freleases). You can get the latest prerelease by downloading [`try-latest.tgz`](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Freleases\u002Fdownload\u002Flatest\u002Ftry-latest.tgz). You can then install similarly to the above:\n```ShellSession\n$ git clone https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry.git\n$ .\u002Fconfigure && make && sudo make install\n```\n\nThe repository and source distribution are slightly different: the repository does not include the `configure` script (generated by `autoconf`) or the manpage (generated by `pandoc`), but the source distribution does.\n\n#### Arch Linux\n\n`try` is present in [AUR](https:\u002F\u002Faur.archlinux.org\u002Fpackages\u002Ftry), you can install it with your preferred AUR helper:\n\n```shellsession\nyay -S try\n```\n\nor manually:\n\n```shellsession\ngit clone https:\u002F\u002Faur.archlinux.org\u002Ftry.git\ncd try\nmakepkg -sic\n```\n\n#### Nix\u002FNixOS\n\n`try` is present in [nixpkgs](https:\u002F\u002Fsearch.nixos.org\u002Fpackages?channel=unstable&show=try&from=0&size=50&sort=relevance&type=packages&query=try) and maintained by us.\n\n```shellsession\nnix-shell -p try\n```\n\n## Example Usage\n\n`try` is a higher-order command, like `xargs`, `exec`, `nohup`, or `find`. For example, to install a package via `pip3`, you can invoke `try` as follows:\n\n```ShellSession\n$ try pip3 install libdash\n... # output continued below\n```\n\nBy default, `try` will ask you to commit the changes made at the end of its execution.\n\n```ShellSession\n...\nDefaulting to user installation because normal site-packages is not writeable\nCollecting libdash\n  Downloading libdash-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (254 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 254.6\u002F254.6 KB 2.1 MB\u002Fs eta 0:00:00\nInstalling collected packages: libdash\nSuccessfully installed libdash-0.3.1\nWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https:\u002F\u002Fpip.pypa.io\u002Fwarnings\u002Fvenv\n\nChanges detected in the following files:\n\n\u002Ftmp\u002Ftmp.zHCkY9jtIT\u002Fupperdir\u002Fhome\u002Fgliargovas\u002F.local\u002Flib\u002Fpython3.10\u002Fsite-packages\u002Flibdash\u002Fast.py (modified\u002Fadded)\n\u002Ftmp\u002Ftmp.zHCkY9jtIT\u002Fupperdir\u002Fhome\u002Fgliargovas\u002F.local\u002Flib\u002Fpython3.10\u002Fsite-packages\u002Flibdash\u002F_dash.py (modified\u002Fadded)\n\u002Ftmp\u002Ftmp.zHCkY9jtIT\u002Fupperdir\u002Fhome\u002Fgliargovas\u002F.local\u002Flib\u002Fpython3.10\u002Fsite-packages\u002Flibdash\u002F__init__.py (modified\u002Fadded)\n\u002Ftmp\u002Ftmp.zHCkY9jtIT\u002Fupperdir\u002Fhome\u002Fgliargovas\u002F.local\u002Flib\u002Fpython3.10\u002Fsite-packages\u002Flibdash\u002F__pycache__\u002Fprinter.cpython-310.pyc (modified\u002Fadded)\n\u002Ftmp\u002Ftmp.zHCkY9jtIT\u002Fupperdir\u002Fhome\u002Fgliargovas\u002F.local\u002Flib\u002Fpython3.10\u002Fsite-packages\u002Flibdash\u002F__pycache__\u002Fast.cpython-310.pyc (modified\u002Fadded)\n\u003Csnip>\n\nCommit these changes? [y\u002FN] y\n```\n\nSometimes, you might want to pre-execute a command and commit its result at a later time. Running `try -n` will print the overlay directory on STDOUT without committing the result.\n\n```ShellSession\n$ try -n \"curl https:\u002F\u002Fsh.rustup.rs | sh\"\n\u002Ftmp\u002Ftmp.uCThKq7LBK\n```\n\nAlternatively, you can specify your own existing overlay directory using the `-D [dir]` flag:\n\n```ShellSession\n$ mkdir rustup-sandbox\n$ try -D rustup-sandbox \"curl https:\u002F\u002Fsh.rustup.rs | sh\"\n$ ls rustup-sandbox\ntemproot  upperdir  workdir\n```\n\nAs you can see from the output above, `try` has created an overlay environment in the `rustup-sandbox` directory.\n\nManually inspecting upperdir reveals the changes to the files made inside the overlay during the execution of the previous command with *try*:\n\n```ShellSession\n~\u002Ftry\u002Frustup-sandbox\u002Fupperdir$ du -hs .\n1.2G    .\n```\n\nYou can inspect the changes made inside a given overlay directory using `try`:\n\n```ShellSession\n$ try summary rustup-sandbox\u002F | head\n\nChanges detected in the following files:\n\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.profile (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.bashrc (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.rustup\u002Fupdate-hashes\u002Fstable-x86_64-unknown-linux-gnu (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.rustup\u002Fsettings.toml (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.rustup\u002Ftoolchains\u002Fstable-x86_64-unknown-linux-gnu\u002Flib\u002Flibstd-8389830094602f5a.so (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.rustup\u002Ftoolchains\u002Fstable-x86_64-unknown-linux-gnu\u002Flib\u002Frustlib\u002Fetc\u002Flldb_commands (modified\u002Fadded)\nrustup-sandbox\u002F\u002Fupperdir\u002Fhome\u002Fubuntu\u002F.rustup\u002Ftoolchains\u002Fstable-x86_64-unknown-linux-gnu\u002Flib\u002Frustlib\u002Fetc\u002Fgdb_lookup.py (modified\u002Fadded)\n```\n\nYou can also choose to commit the overlay directory contents:\n\n```ShellSession\n$ try commit rustup-sandbox\n```\n\nYou can also run `try explore` to open your current shell in try, or `\u002Ftry\nexplore \u002Ftmp\u002Ftmp.X6OQb5tJwr` to explore an existing sandbox.\n\nTo specify multiple lower directories for overlay (by merging them together), you can use the `-L` (implies `-n`) flag followed by a colon-separated list of directories. The directories on the left have higher precedence and can overwrite the directories on the right:\n\n```ShellSession\n$ try -D \u002Ftmp\u002Fsandbox1 \"echo 'File 1 Contents - sandbox1' > file1.txt\"\n$ try -D \u002Ftmp\u002Fsandbox2 \"echo 'File 2 Contents - sandbox2' > file2.txt\"\n$ try -D \u002Ftmp\u002Fsandbox3 \"echo 'File 2 Contents - sandbox3' > file2.txt\"\n\n# Now use the -L flag to merge both sandbox directories together, with sandbox3 having precedence over sandbox2\n$ try -L \"\u002Ftmp\u002Fsandbox3:\u002Ftmp\u002Fsandbox2:\u002Ftmp\u002Fsandbox1\" \"cat file1.txt file2.txt\"\nFile 1 Contents - sandbox1\nFile 2 Contents - sandbox3\n```\n\nIn this example, `try` will merge `\u002Fsandbox1`, `\u002Fsandbox2` and `\u002Fsandbox3` together before mounting the overlay. This way, you can combine the contents of multiple `try` sandboxes.\n\n\n## Known Issues\nAny command that interacts with other users\u002Fgroups will fail since only the\ncurrent user's UID\u002FGID are mapped. However, the [future\nbranch](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Ftree\u002Ffuture) has support for uid\u002Fmapping;\nplease refer to the that branch's readme for installation instructions for the\nuid\u002Fgidmapper (root access is required for installation).\n\nShell quoting may be unintuitive, you may expect `try bash -c \"echo a\"` to work,\nhowever, try will actually execute `bash -c echo a`, which will not result in\n`a` being printed. [We are currently not planning on resolving this\nbehavior.](https:\u002F\u002Fgithub.com\u002Fbinpash\u002Ftry\u002Fissues\u002F155#issuecomment-2078556237)\n\nPlease also report any issue you run into while using the future branch!\n\n## Version History\n\n* v0.2.0 - 2023-07-24\n  - Refactor tests.\n  - Improved linting.\n  - Hide `try`-internal variables from scripts.\n  - Style guide.\n  - Testing in Vagrant.\n  - Support nested mounts.\n  - Resolve issues with `userxattr`.\n  - Better support for `unionfs`.\n  - Use `\u002Fbin\u002Fsh`, not `\u002Fbin\u002Fbash`.\n  - `-i` flag to ignore paths.\n  - Interactive improvements.\n\n* v0.1.0 - 2023-06-25\n  - Initial release.\n\n## See Also\n\n[checkinstall](http:\u002F\u002Fcheckinstall.izto.org\u002F) (unmaintained)\n\ncheckinstall keeps track of all the files created or modified by your\ninstallation script, builds a standard binary package and installs it in your\nsystem. This package can then be easily installed, managed, and removed using\nthe package manager of your Linux distribution. It helps in maintaining a clean\nand organized system by keeping track of installed software and its\ndependencies.\n\n## License\n\nThis project is licensed under the MIT License - see LICENSE for details.\n\nCopyright (c) 2023 The PaSh Authors.\n","`try` 是一个用于在实际修改系统前预览命令效果的工具。它通过利用 Linux 的命名空间（经由 `unshare`）和 overlayfs 联合文件系统，提供了一种安全的方式来测试命令的效果。用户可以在执行潜在危险操作前先使用 `try` 检查其影响，避免对生产环境造成意外损害。此项目适用于需要谨慎处理系统更改的各种场景，如服务器维护、开发环境配置等。请注意，`try` 仍处于原型阶段，并非完整的沙箱环境，不建议用于执行不可信的命令。",2,"2026-06-11 03:38:51","high_star"]