You can use iTerm2 Shell Integration via a terminal such as NewTerm. If you’re not experienced with the terminal, you most likely shouldn’t install this.
bash, zsh, and fish are supported out of the box, and will start using the shell integration once this package is installed and any open terminal windows are restarted. tcsh users will need to add
source /usr/libexec/iterm2-shell-integration/tcsh to their
imgcat: Display an image inline in the terminal
imgls: Display a directory listing with icons (requires PHP)
it2api: Access the extensive iTerm2 API (requires Python 3.6)
it2attention: Bounce the app icon in the Dock
it2check: Can be used by scripts to detect the shell integration and terminal app versions
it2copy: Copy text or files to clipboard on the host
it2ul: Download and upload files from/to a remote host
it2getvar: Read custom variables from the terminal app.
it2git: Can be added to your profile scripts to provide Git status bar integration
it2setcolor: Redefine colors in the current tab
it2setkeylabel: Configure custom Touch Bar buttons
it2universion: Switch betwene Unicode 8 and 9 compatibility modes
Not all commands are supported by NewTerm.