CMD List [6]

1.1         zcat

 

displays the contents of a gzipped or compressed file on the screen.

 

Syntax             zcat filenames

 

Option or argument

Function

Filenames

Specifies the compressed files you want to display.

 

The zcat command does the same thing as gunzip –c. See also gzip and gunzip.

 

Sample

 

You want to see the contents of a gzipped text file called important.stuff.gz. Type

 

zcat important.stuff.gz

 

2          Key

2.1         <Ctrl> [c]/[d]

Ctrl + C – cancel; Ctrl + D - exit

 

2.2         <Esc> [k]/[u]

<Esc>k displays the previous command that has been executed. User can press “k” more times to continually browse the sent commands.

On the contrary, <Esc>u will display the executed command that follows the displaying command.

 

3          Symbol

3.1         Comment ( # )

3.2         File redirection (> or >> or <)

< redirects input; > redirects output; >> redirects output and appends the information to the existing file.

e.g.

who > users (output of 'who' save into users)

who >> users (output of 'who' append after users)

true > access.log (clean file)

echo '' > access.log (clean file)

wc -l < users (count the line of users)

 

3.3         pipe ( | )

e.g.

|more - 'f' for forward, 'b' for backward, 'q' for quit, 'h' for help, '/' for search.

|pg     - 'q' for quit, 'h' for help.

cat users | wc -l (ditto)

ps | sort (sort process)

 

3.4         &

 

Set the command/script running in the backend.

e.g.

sort date > out &

nohup ksh /SAS/FTEND/sys/admin/pgm/sh/startMatnJobQ.sh 1>/dev/null 2>&1 &

 

stdin, stdout, stderr的文件描述符分别是0, 1, 2. 对于其他那些需要打开的文件, 保留了文件描述符39.

e.g.

&>filename       # stdoutstderr都重定向到文件"filename".

M>&N      # "M"是一个文件描述符, 如果没有明确指定的话默认为1.

0<&-, <&-       关闭stdin.

1>&-, >&-       关闭stdout.

 

exec 3>> ${OUT}

exec 2>&3

exec 1>&3

 

3.5         dot (.)

UNIX programs can never, ever modify the environment of their parents. A program can only modify the environment that later will be passed to its children.

If you write a program that executes the cd command, that cd will be effective within your program - but when the program finishes, you'll be back in your original (parent) shell. To solve it, use . or source command.

The source and . command read a script file into the current shell instead of starting a child shell.

e.g. Add below statement in the xxx.sh

. ${TOOLSCP}/wsd_db_mst_ld.sh $1 $2

 

3.6         Special directories (. or .. or /)

Dot directory: the current location.

Dot-dot directory: moves up one level, to the parent directory.

Slash: root

 

3.7         ‘’ “” ``

Same as Perl.

compare with Double quotes (“”), Apostrophe (‘’): 1 – can’t replace variable 2 – 反斜线不支持转义字符. 3 – 可以跨多行.

'' – Single Quote / Apostrophe, string no variable replacement

"" - Double quotes, string with variable replacement

`` - Backquote / Backtick, run the command, generate output as input

 

3.8         Wildcard

 

Option or argument

Function

?

Any one of character.

*

Zero or more characters.

[abc]  [a-c]

Either of a b c.

[!abc]  [!a-c]

Neither of a b c.

^x  ^[abc]

Start with x; start with either of a b c.

x$  [abc]$

End with x, end with either of a b c.

 

3.9         \

按文本含义解释后面接着的字符

 

3.10     Escape Sequence in Strings

符号

含义

\0

匹配空字符(ASCII NUL)。

\NNN

2 to 3 bytes of octal,最大值为\377

\n

匹配前面第n个捕获字串(十进制)。

\a

匹配警钟字符(BEL)。

\A

如果在字串的开头为真

\b

匹配退各字符(BS)。backspace

\b

在字边界为真

\B

不在字边界时为真

\cX

Control Character, e.g. \cC for control-C, \c[ for ESC, \c? for DEL.

\C

匹配一个字节(C字符),甚至在utf8中也如此(危险)

\d

匹配任何数字字符

\D

匹配任何非数字字符

\e

匹配逃逸字符(ASCII ESC,不是反斜杠)。

\E

结束大小写(\L\U)或者掩码(\Q)转换

\f

匹配进页字符(FF)。form feed

\G

如果在前一个m//g的匹配结尾位置时为真

\l

只把下一个字符变成小写

\L

\E以前的字母都变成小写

\n

匹配换行符字符(通常是NL,但是在Mac上是CR)。newline

\N{NAME}

匹配命名字符(\N{greek:Sigma})。

\p{PROP}

匹配任何有命名属性的字符

\P{PROP}

匹配任何没有命名属性的字符

\q

do not look for special pattern characters

\Q

引起(消元)直到\E前面的字符

\r

匹配返回字符(通常是CR,但是在Mac上是NL)。carriage return

\s

匹配任何空白字符。 [ \t\n\r\f]

\S

匹配任何非空白字符。

\t

匹配水平制表符(HT)。

\u

只把下一个字符变成标题首字符force next letter into uppercase

\U

大写(不是标题首字符)\E 以前的字符。

\w

匹配任何字符(字母数字加"_" )。 e.g. \w_

\W

匹配任何非字字符。 [^a-zA-Z0-9_]

\x{HEX}

1 to 2 bytes hex. If use {} then no limit to bytes of hex, may for Unicode.

\X

匹配Unicode里的组合字符序列字串。

\z

只有在字串结尾时为真

\Z

在字串结尾或者在可选的换行符之前为真。

 

3.11     Default variables

HOME

Home directory. e.g. echo $HOME

USER

User ID.

PATH

Which directories to search and the searched order.

SHELL

C shell (sh) or Korn shell (ksh).

set

Just type ‘set’ to check all.

 

3.12     Return code

0                    match

1     no match

>1   syntax error or file was inaccessible

 

<think>好的,用户的问题是在CMD中运行“ollama list”命令没有显示输出,需要解决这个问题。首先,我需要根据提供的引用资料来分析可能的原因和解决方案。 首先,引用[1]提到安装完成后在cmd输入“ollama”命令会显示相关信息,这说明安装成功的基础验证步骤。但用户现在的问题是“ollama list”没有输出,可能安装有问题或者路径配置不正确。需要确认ollama是否正确安装,可以运行“ollama”命令看是否有帮助信息,如果没有,可能需要重新安装。 接下来,引用[2]提到cmd中找不到mysql命令的问题,这通常是因为环境变量没有配置正确。类似地,如果ollama的可执行文件路径没有添加到系统PATH中,cmd可能无法找到ollama命令。因此,检查环境变量设置是一个关键点。 引用[3]指出在默认路径运行ollama可能导致问题,比如回答不正常,建议更换路径或使用其他方法调用。这可能意味着ollama在特定路径下才能正常工作。用户可能需要切换当前工作目录到ollama的安装路径或模型存储路径,再运行命令。例如,使用“cd”命令切换到F盘的ollama目录,再执行“ollama list”。 引用[4]提到模型文件可能未正确安装到指定位置,比如模型文件被下载到C盘而不是预期的F盘,导致命令无法列出模型。因此,需要检查模型存储路径是否正确,并确保模型已正确下载。用户可能需要重新下载模型到正确的路径,或者在正确的路径下运行命令。 综合以上信息,可能的解决方案步骤包括:1. 验证ollama是否正确安装;2. 检查环境变量配置;3. 切换cmd的工作目录到ollama的安装或模型路径;4. 确保模型已正确下载;5. 重启系统或服务。需要逐步排除这些可能性,并指导用户操作。</think>针对CMD中运行`ollama list`命令无输出的问题,以下是分步解决方案: ### 第一步:验证Ollama安装状态 1. 在CMD输入`ollama`命令 - 若显示版本信息和使用说明(如示例图),则基础安装正常[^1] - 若提示`"ollama" 不是内部或外部命令`,说明需要配置环境变量 ### 第二步:检查环境变量配置 1. 右键点击【此电脑】→【属性】→【高级系统设置】→【环境变量】 2. 在系统变量中确认`Path`是否包含Ollama安装路径(默认路径为`C:\Program Files\Ollama`) 3. 若路径缺失,手动添加后重启CMD[^2] ### 第三步:切换工作目录(关键步骤) 1. 输入`cd /d F:\ollama`(假设模型存储路径为F盘) 2. 执行`ollama list` *此操作可规避默认路径下的异常行为[^3]* ### 第四步:检查模型下载状态 1. 在目标路径下执行`ollama run deepseek-r1:8b` - 若开始下载模型,说明之前未正确安装模型 - 下载完成后再次执行`ollama list`即可显示模型[^4] ### 第五步:系统级重启 1. 以管理员身份运行CMD 2. 依次执行: ```shell ollama stop ollama serve ``` 3. 新开CMD窗口再次尝试
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值