wiki/_next/data/Ie9t5zutrXP6Of75Cb5xF/cli.pacman.json
2022-07-29 15:41:17 +00:00

1 line
14 KiB
JSON

{"pageProps":{"metadata":{"date":"\"2021-06-08 15:00:04 +08:00\"","date_modified":"\"2021-11-06 12:12:06 +08:00\"","language":"en","source":""},"title":"Command line: pacman","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"subcommands"},"children":[{"type":"text","value":"Subcommands"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.pacman#subcommands"},"children":[{"type":"text","value":"Subcommands"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.pacman#examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"quickstart"},"children":[{"type":"text","value":"Quickstart"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.pacman#quickstart"},"children":[{"type":"text","value":"Quickstart"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"package-search-selection"},"children":[{"type":"text","value":"Package search selection"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.pacman#package-search-selection"},"children":[{"type":"text","value":"Package search selection"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"package-removal-selection"},"children":[{"type":"text","value":"Package removal selection"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.pacman#package-removal-selection"},"children":[{"type":"text","value":"Package removal selection"}]}]}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"related-notes"},"children":[{"type":"text","value":"Related notes"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.pacman#related-notes"},"children":[{"type":"text","value":"Related notes"}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The built-in package manager of Arch Linux (among others).\nThis note is based from "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"pacman v6"}]},{"type":"text","value":" and above.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"subcommands"},"children":[{"type":"text","value":"Subcommands"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Interestingly, pacman does not have subcommands with specific options.\nInstead, they go with specific flags denoting a subcommand.\nPractically, they're just subcommands except appearing as options.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"# Rather than 'pacman install podman' or something similar.\npacman -S podman\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Here's what you can do with the package manager:\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-S"}]},{"type":"text","value":" are concerned with syncing the local database to the remote databases.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-y, --refresh"}]},{"type":"text","value":" syncs the local database to the remote database; running with this flag alone is not recommended as the package manager will have problems.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-u, --sysupgrade"}]},{"type":"text","value":" upgrades the local database; this should be used with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-y"}]},{"type":"text","value":" if you intend it for a proper operating system upgrade.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-g, --groups [GROUP]"}]},{"type":"text","value":" prints what packages belong to the given group\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-Q"}]},{"type":"text","value":" is primarily from querying information from your installed packages ranging from listing installed packages to listing all of the files owned by a certain package.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-l, --list [PACKAGES...]"}]},{"type":"text","value":" lists the files associated with the package.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-i, --info [PACKAGES...]"}]},{"type":"text","value":" prints information about the package.\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-F [FILENAME]"}]},{"type":"text","value":" are mostly query-related operations with the database.\n It also prints which package owns the given file.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-y, --refresh"}]},{"type":"text","value":" refreshes the database.\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-R"}]},{"type":"text","value":" removes installed packages.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-n, --nosave"}]},{"type":"text","value":" removes the configuration files associated with the package; this doesn't remove files from the home directory, though.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-s, --recursive"}]},{"type":"text","value":" will recursively removes dependencies that are not used anywhere else.\n"}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can see more of them in the \"Operations\" section of the manual page (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"pacman.1"}]},{"type":"text","value":").\n"}]},{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Welp, this is what you came for so let's go ahead.\n"}]},{"type":"element","tagName":"h2","properties":{"id":"quickstart"},"children":[{"type":"text","value":"Quickstart"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It's a package manager so it's supposed to do basic package manager stuff.\nAll of the shown commands are in longform with the shortform just commented for practical purposes.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"# Search for a pacakge\n# pacman -Ss podman\npacman --sync --search podman\n\n# Install a package\n# pacman -S podman\npacman --sync podman\n\n# Uninstall a package\n# pacman -Rns podman\npacman --remove --no-save --recursive podman\n\n# Upgrade the system\n# pacman -Syu\npacman --sync --refresh --upgrade\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"package-search-selection"},"children":[{"type":"text","value":"Package search selection"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With everybody's favorite fuzzy finder, "},{"type":"element","tagName":"a","properties":{"href":"/cli.fzf"},"children":[{"type":"text","value":"fzf"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"pacman --sync --quiet --search pkg | fzf --prompt \"Package to install > \" | xargs doas pacman --sync\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can also create a search selection with all of the packages with the following one-liner.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"pacman -S --list --quiet \\\n | fzf --multi --prompt \"Install package(s) > \" \\\n | xargs doas pacman -S --noconfirm\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"package-removal-selection"},"children":[{"type":"text","value":"Package removal selection"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Another interactive script with "},{"type":"element","tagName":"a","properties":{"href":"/cli.fzf"},"children":[{"type":"text","value":"fzf"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"pacman -Q --native --quiet | fzf --multi --prompt \"Remove installed package(s) > \" | xargs doas pacman -Rns --noconfirm\n"}]}]},{"type":"element","tagName":"h1","properties":{"id":"related-notes"},"children":[{"type":"text","value":"Related notes"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"pacman does not have a way to query packages that are not installed;\n for example, you cannot know what files are owned by the package unless it is installed (also you have "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"pkgfile"}]},{"type":"text","value":" for that)\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"pacman also cannot view the PKGBUILD of packages that are not installed;\n you can use the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"asp"}]},{"type":"text","value":" tool for that (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"asp show ${PACKAGE}"}]},{"type":"text","value":")\n"}]}]}]}]},"backlinks":[{"path":"/linux.distros.arch","title":"Arch Linux"}]},"__N_SSG":true}