Table of Contents
Expressions
History expansion
| Expression | Example | Description |
|---|---|---|
!! |
sudo !! |
Last command-line |
!* |
vim !* |
Arguments of last command |
!^ |
vim !^ |
First argument of last command |
!$ |
vim !$ |
Last argument of last command |
!ls |
sudo !ls |
Command-line of last command starting with ls |
!ls:* |
rm !ls:* |
Arguments of last command starting with ls |
Glob qualifiers
| Expression | Example | Description |
|---|---|---|
*(.) |
ls *(.) |
Plain files |
*(/) |
ls *(/) |
Directories |
*(m0) |
ls *(m0) |
Last modified today |
*(m-4) |
ls *(m-4) |
Last modified <4 days ago |
Process Substitution
| Expression | Example | Description |
|---|---|---|
<(COMMAND) |
grep "needle" <(curl "https://haystack.io") |
Replace argument with named pipe/FIFO (read-only) with command output |
=(COMMAND) |
vim =(curl "https://haystack.io") |
Replace argument with file (writable) containing command output |
Tab Completion
| Provides helpful explanations for options and what they do. |
|---|
| ls -(tab) |
| cap (tab) |
| rake (tab) |
| ssh (tab) |
| sudo umount (tab) |
| kill (tab) |
| unrar (tab) |
ls
lslists directories first (GNU only) and with colour (applies to all aliases below).lllists with long format and human-readable sizes (applies to all aliases below).llists all files.lmlists all files using pager.lrlists recursively.lxlists sorted by extension (GNU only).lklists sorted by largest file size last.ltlists sorted by newest modification time last.lclists sorted by newest status change (ctime) last.
Utilities
getdownloads from the given URL usingaria2c,axel,wgetorcurl.mkcdcreates and changes to the given directory.mkpwgenerates a random password with the given length and set of characters.
Archives (requires module)
archivegenerates an archive based on file extension.unarchiveunarchives files based on the extensions.lsarchivelists archives contents based on the extensions.
Git
Gis short forgit.
Branch
Gblists, creates, renames, and deletes branches.Gbccreates a new branch.Gbddetaches HEAD at the tip of the current or given branch.Gbllists branches and their commits.GbLlists local and remote branches and their commits.Gbmrenames a branch.GbMrenames a branch even if the new branch name already exists.GbRresets a branch even if the branch name already exists.Gbslists branches and their commits with ancestry graphs.GbSlists local and remote branches and their commits with ancestry graphs.Gbuunsets the remote-tracking information for the current or given branch.GbGdeletes all local branches tracking remote branches that are gone.Gbxdeletes a branch.GbXdeletes a branch irrespective of its merged status.
Commit
Gcrecords changes to the repository.Gcacommits all modified and deleted files.GcAcommits all modified and deleted files interactively.Gcmcommits with the given message.Gcochecks out a branch or paths to the working tree.GcOchecks out hunks from the index or the tree interactively.Gcfamends the tip of the current branch reusing the same log message as HEAD.GcFamends the tip of the current branch.Gcpapplies changes introduced by existing commits.GcPapplies changes introduced by existing commits without committing.Gcrreverts existing commits by reverting patches and recording new commits.GcRremoves the HEAD commit.Gcsshows one or more objects (blobs, trees, tags and commits).GcScommits with GPG signature.Gcucommits with fixup message using given commit.GcUcommits with squash message using given commit.Gcvverifies the GPG signature of commits.
Conflict
GCllists unmerged files.GCaadds unmerged file contents to the index.GCeexecutes merge-tool on all unmerged files.GCochecks out our changes for unmerged paths.GCOchecks out our changes for all unmerged paths.GCtchecks out their changes for unmerged paths.GCTchecks out their changes for all unmerged paths.
Data
Gddisplays information about files in the index and the work tree.Gdclists cached files.Gdxlists deleted files.Gdmlists modified files.Gdulists untracked files.Gdklists killed files.Gdilists ignored files.
Fetch
Gfdownloads objects and references from another repository.Gfcclones a repository into a new directory.Gfmfetches from and merges with another repository or local branch.Gfrfetches from and rebases on top of another repository or local branch.Gfuprunes stale remote-tracking branches, fetches all remotes and merges.
Grep
Ggdisplays lines matching a pattern.Ggidisplays lines matching a pattern ignoring case.Ggllists files matching a pattern.GgLlists files that are not matching a pattern.Ggvdisplays lines not matching a pattern.Ggwdisplays lines matching a pattern at word boundary.
Index
Giaadds file contents to the index.GiAadds file contents to the index interactively.Giuadds file contents to the index (updates only known files).Giddisplays changes between the index and a named commit (diff).GiDdisplays changes between the index and a named commit (word diff).Girresets the current HEAD to the specified state.GiRresets the current index interactively.Gixremoves files from the index (recursively).GiXremoves files from the index (recursively and forced).
Log
Gldisplays the log.Glsdisplays the stats log.Glddisplays the diff log.Glfdisplays the diff log of a given file, continuing beyond renames.Glodisplays the one line log.GlOdisplays the one line log with authors and dates.Glgdisplays the graph log.GlGdisplays the graph log with authors and dates.Glvdisplays the log, verifying the GPG signature of commits.Glcdisplays the commit count for each contributor in descending order.Glrmanages reflog information.
Merge
Gmjoins two or more development histories together.Gmaaborts the conflict resolution, and reconstructs the pre-merge state.Gmccontinues the merge after conflicts are resolved.GmCperforms the merge but does not commit.GmFcreates a merge commit even if the merge could be resolved as a fast-forward.GmSperforms the merge and GPG-signs the resulting commit.Gmvverifies the GPG signature of the tip commit of the side branch being merged.Gmtruns the merge conflict resolution tools to resolve conflicts.
Push
Gpupdates remote refs along with associated objects.Gpfforces a push safely (with "lease").GpFforces a push.Gpapushes all branches.GpApushes all branches and tags.Gptpushes all tags.Gpcpushes the current branch and adds origin as an upstream reference for it.Gpppulls and pushes the current branch from origin to origin.
Rebase
Grforward-ports local commits to the updated upstream head.Graaborts the rebase, and checks out the original branch.Grccontinues the rebase after merge conflicts are resolved.Grimakes a list of commits to be rebased and opens the editor.Grsskips the current patch.GrSrebases and GPG-signs the commits.
Remote
GRmanages tracked repositories.GRllists remote names and their URLs.GRaadds a new remote.GRxremoves a remote.GRmrenames a remote.GRufetches remotes updates.GRpprunes all stale remote-tracking branches.GRsshows information about a given remote.GRSchanges URLs for a remote.
Stash
Gsstashes the changes of the dirty working directory.Gsaapplies the changes recorded in a stash to the working directory.Gsxdrops a stashed state.GsXdrops all the stashed states.Gsllists stashed states.Gsddisplays changes between the stash and its original parent.Gspremoves and applies a single stashed state from the stash list.Gsrrecovers a given stashed state.Gssstashes the working directory changes, including untracked files.GsSstashes the working directory changes interactively.Gswstashes the working directory changes retaining the index.Gsuunapplies (reverts) applied changes.
Submodule
GSinitializes, updates, or inspects submodules.GSaadds given a repository as a submodule.GSfevaluates a shell command in each of checked out submodules.GSiinitializes submodules.GSIinitializes and clones submodules recursively.GSllists the commits of all submodules.GSmmoves a submodule.GSssynchronizes remote URL of submodules to the value specified in.gitmodules.GSufetches and merges the latest remote changes for all submodules.GSxremoves a submodule.
Tag
Gtcreates, lists, deletes or verifies a tag object signed with GPG.Gtscreates a GPG-signed tag.Gtvverifies the GPG signature of tags.Gtxdeletes tags with given names.
Main working tree
Gwsdisplays the working tree status in short format.GwSdisplays the working tree status.Gwddisplays changes between the working tree and the index (diff).GwDdisplays changes between the working tree and the index (word diff).Gwrresets the current HEAD to the specified state, does not touch the index nor the working tree.GwRresets the current HEAD, index and working tree to the specified state.Gwccleans untracked files from the working tree (dry-run).GwCcleans untracked files from the working tree.Gwmmoves or renames files.GwMmoves or renames files (forced).Gwxremoves files from the working tree and from the index (recursively).GwXremoves files from the working tree and from the index (recursively and forced).
Working trees
GWmanages multiple working trees.GWacreates path with a new working tree.GWllists details of all working trees.GWmmoves a working tree to a new location.GWpprunes working tree information.GWxremoves a working tree.GWXremoves a working tree (forced).
Misc
G..changes the current directory to the top level of the working tree.G?looks up the aliases defined here with the given regular expressions.
Homebrew (requires module)
brewccleans the cache.brewCscrubs the cache, including downloads for the latest versions.brewdchecks your system for potential problems.breweedits given formula.brewishows information about given formula.brewIinstalls given formula.brewllists installed formulae.brewLlists installed formulae that don't depend on other installed formula.brewolists outdated installed formulae.brewrreinstalls given formula.brewsperforms a search of formula names.brewSmanages background services with macOS' launchctl daemon manager.brewuupdates Homebrew and all formulae.brewUupgrades outdated and unpinned formulae.brewxuninstalls a given formula.brewXdeletes all installed versions of given formula.
Homebrew Cask
caskis short forbrew cask.caskeedits given cask.caskishows information about given cask.caskIinstalls given cask.caskllists installed casks.caskolists outdated installed casks.caskrreinstalls given cask.casksperforms a search of cask tokens.caskUupgrades given cask or all outdated casks, if none given.caskxuninstalls given cask.caskXuninstalls even if given cask does not appear to be present.caskzzaps all files associated with given cask.
Pacman (requires module)
pacbbuilds package in the current directory, cleanups, and installs.paciinstalls, syncs, and upgrades packages.pacuinstalls, syncs, and upgrades packages (forcibly refreshes package list).pacUinstalls packages from pkg file.pacdinstalls all packages in current directory.pacrremoves package and unneeded dependencies.pacrmremoves package, unneeded dependencies, and configuration files.pacqqueries package information from remote repository.pacQqueries package information from local repository.pacssearches for package in the remote repository.pacSsearches for package in the local repository.pacollists orphan packages.pacorremoves all orphan packages.pacownlists all files provided by a given package.pacblameshows packages that own a specified file.
aur helpers
aurbclones the given package name from the AUR, builds, and installs.aurdclones the given package name from the AUR, but does not build.aurufrom a directory created withaurb, will update, build, and install the package.