Zsh command line history manipulation is achieved through setopt and fc commands. The ‘setopt’ command configures options like HIST_IGNORE_ALL_DUPS to ignore duplicate entries, or SHARE_HISTORY to share history across all sessions. For instance, ‘setopt HIST_IGNORE_ALL_DUPS’ will prevent repeated commands from being logged.
The ‘fc’ command manipulates the history directly. ‘fc -l’ lists recent commands, while ‘fc -e -‘ edits the last command with a text editor. You can also use ‘fc -s old=new’ to replace parts of previous commands.