perplexity-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Perplexity CLI Skill

Perplexity CLI 技能

Overview

概述

Perplexity CLI is a command-line interface for Perplexity AI that allows AI-powered searches directly from the terminal with support for multiple models, streaming output, and file attachments.
Perplexity CLI是Perplexity AI的命令行界面,允许直接在终端中进行AI驱动的搜索,支持多模型、流式输出和文件附件。

Prerequisites

前提条件

bash
undefined
bash
undefined

Verify installation

验证安装

perplexity --help
undefined
perplexity --help
undefined

Quick Reference

快速参考

CommandDescription
perplexity "query"
Search with default settings
ModeFlagDescription
pro
--mode pro
Deep search with reasoning (default)
deep-research
--mode deep-research
Comprehensive research
命令描述
perplexity "query"
使用默认设置进行搜索
模式参数描述
pro
--mode pro
带推理的深度搜索(默认)
deep-research
--mode deep-research
全面研究

Common Operations

常见操作

Basic Query

基础查询

bash
perplexity "What is quantum computing?"
bash
perplexity "What is quantum computing?"

Query with Specific Mode

使用特定模式查询

bash
perplexity "Explain neural networks" --mode pro
bash
perplexity "Explain neural networks" --mode pro

Read Query from File, Save Response

从文件读取查询,保存响应

bash
perplexity -f question.md -o answer.md 
bash
perplexity -f question.md -o answer.md 

Query with Sources

带来源的查询

bash
perplexity "Climate research" --sources web,scholar 
bash
perplexity "Climate research" --sources web,scholar 

All Flags

所有参数

FlagShortDescription
--mode
Search mode
--sources
-s
Sources: web,scholar,social
--language
-l
Response language (e.g., en-US, pt-BR)
--file
-f
Read query from file
--output
-o
Save response to file
参数简写描述
--mode
搜索模式
--sources
-s
来源:web、scholar、social
--language
-l
响应语言(例如:en-US、pt-BR)
--file
-f
从文件读取查询
--output
-o
将响应保存到文件

Best Practices

最佳实践

  1. Use
    --mode deep-research
    for comprehensive research tasks
  2. Use
    -f
    and
    -o
    flags for batch processing
  1. 对于全面研究任务,使用
    --mode deep-research
  2. 使用
    -f
    -o
    参数进行批量处理

Piping and Scripting

管道与脚本使用

bash
undefined
bash
undefined

Pipe query from stdin

从标准输入传递查询

echo "What is Go?" | perplexity
echo "What is Go?" | perplexity

Use in scripts

在脚本中使用

RESPONSE=$(perplexity "Quick answer" --mode pro 2>/dev/null)
RESPONSE=$(perplexity "Quick answer" --mode pro 2>/dev/null)

Batch processing

批量处理

cat questions.txt | while read q; do perplexity "$q" -o "answers/$(echo $q | md5sum | cut -c1-8).md" done
undefined
cat questions.txt | while read q; do perplexity "$q" -o "answers/$(echo $q | md5sum | cut -c1-8).md" done
undefined