CMD List [2]

1.1         df

 

Check available disk space.

 

Syntax             df [-k] [directory]

         df [-t] [-x] [-k] [-p] [-a] ... [filename]

 

Option or argument

Function

-g

Displays statistics in units of GB blocks

-k

Displays only the amount of free space in kilobytes.

-v

Displays all information for the specified file system.

Directory

Displays space on the file system where that directory resides.

 

The df listing includes lots of information about each file system (logical disk or disk partition) to which you have access, including its total size, the amount of space that’s full (used), the free space, the percentage that’s full (capacity), and, if it’s a network file system, on which file server it is.

 

Sample:

 

You are wondering how much space is on the disk on which your home directory is stored. Assuming that your username is ysg, type

 

df /home/ysg

 

e.g. fr wing: df –gv|grep bcn; df -gv ./; df –h ./ (for solaris)

1.2         diff

 

Compares two files and prints the lines in which the files differ, for ascII files. Refer cmp.

 

Syntax             diff [-b] [-i][-w] filename1 filename2

  or

         diff [-b] [-i][-w] filename1 directory1

  or

         diff [-b] [-i][-r][-w] directory1 directory2

 

Option or argument

Function

-b

Treats groups of spaces (blanks) as single spaces, so it ignores spacing differences.

-i

Ignores the difference between uppercase and lowercase letters.

-r

When you’re comparing two directories, specifies that subdirectories should be compared, too.

-w

Ignores all spaces and tabs.

filename1

Specifies one file to compare.

filename2

Specifies the other file to compare.

directory1

Specifies one directory to compare. If you tell diff to compare a file to a directory, it looks in the directory for a file of the same name and compares the two files

directory2

Specifies the other directory to compare. If you tell diff to compare two directories, it looks in both directories for files of the same name and compares all pairs of files with the same names. It also lists the names of files that are in one directory but not in the other.

 

1.3         du

Check disk space usage.

Syntax      du [-a] [-b] [-c] [-D] [-k] [-l] [-L] [-s] [-S] [-x] [filename]

 

1.4         echo

e.g.

echo $HOME

 

1.5         egrep

Searches a file for a pattern.

e.g.

egrep "\(([A-z]+|[0-9]+)\)" my.txt

 

1.6         exec

Refer &.

 

1.7         expr

Compute.

e.g.

Asterisk & Parentheses

expr \( 11 + 5 \) '*' 2

 

1.8         find

 

Finds one or more files based on rules your give, and does something to them.refer whereis.

 

Syntax             find directory [-name filename] [-user username] [-print]

 

Option or argument

Function

directory

Specifies a list of directories in which you want to begin the search. The find command searches all the subdirectories of these directories, too. If you want to start in the current directory, just type a single period(.).

-name filename

Specifies the name of the file (or files) you want to find. If you don’t know the exact name, you can use the wildcard characters ? and *.A? stands for any single character, and a * stands for a group of characters. You must quote the filename if you use wildcards.

-user username

Specifies the user who owns the files you want to find.

-print

Displays the names of files it finds. If you don’t include this option, the find command may find lots of files, but it doesn’t tell you about them.

-type f

Check if plain file, vice versa ‘–type d’ check if directory

 

 

Sample:

 

If you want to look in several places for a file, you can type several directories on the command line, like this:

 

find . /home/john –name chapter3 -print

The . (dot) tells the find command to search the current directory and its subdirectories.

 

To search for all the files you own (assuming that your username is stuart), type

 

find / -user stuart -print

The / (slash) tells the find command to search the root directory and all of its subdirectories.

 

find /hsbc/rlse_bcn/objects -type f | xargs rm

Delete all the files in this folder

find /hsbc/rlse_bcn/objects -type f -exec rm

the problem with this approach is that each time find matches a file, it invokes rm, which is a very resource-intensive strategy.

 

find ./ -type f -name "*axmh*"

find ./ -type d -name "folder"

 

1.9         finger

 

Lists the people using your computer – with their real names, not just their UNIX usernames.

 

Syntax             finger [username]

  or

         finger [@hostname]

  or

         finger [username@hostname]

 

Option or argument

Function

username

Specifies the user (or users) about whom you want more information.

hostname

Specifies the hostname of the computer about which you want information.

See also who.

 

Sample:

 

You wonder who else is using your computer. Type:

 

finger

 

To find more information about a user andrewg, type

 

finger andrewg

 

1.10     ftp

use like in DOS. Can use command like lcd / cd / put / get.

1.11     get

ftp to local host, refer put.

 

1.12     getfacl (solaris)

show access control, similar with aclget in AIX.

 

1.13     grep

 

Finds lines in one or more files that contain a particular word or phrase.

To prevent regular expressions is interpreted as wildcards, it is better to surround the regular expression with single quotes ( ' ).

Complex expression try egrep.

Search for multiple patterns at once try fgrep.

 

Syntax             grep [-i] [-l] [-n] [-v] text  filenames

 

Option or argument

Function

-E

-E flag is the same as the egrep command, except that error and usage messages are different and the -s flag functions differently.

-i

Ignores case (uppercase and lowercase) when you’re searching.

-l

Displays only the names of the files that contain the text, not the actual lines.

-n

Displays the line numbers that contain the text.

-p[Separator]

Displays the entire paragraph containing matched lines. Paragraphs are delimited by paragraph separators.

-s

Display only error message for checking.

-v

Specifies that you’re looking for lines that don’t contain the text.

text

Specifies the word or phrase to search for. If the text includes spaces or punctuation that may confuse AIX, enclose it in quotation marks.

filenames

Specifies the file(s) in which to search; to search all the files in the current directory, type * (asterisk).

 

e.g.

 

You are looking for the memo you wrote in which you mentioned microwaveable shelf-stable foods. To search all the files in the current directory, type:

 

grep “mentioned microwaveable shelf-stable” *

 

if you don’t find the file you want. You realize that the M might be capitalized, so you tell grep to ignore capitalization by typing:

 

grep –i “mentioned microwaveable shelf-stable” *

grep -n IBISCMB *.sql

 

grep -B1 -A1 "tty" /etc/passwd

display the context.

 

grep “^[a-zA-Z]” pgm.s

 

Regular Express: grep -E "MatnJobQ|UserJob"

 

find ./ -type f -name "*axmh*" | xargs grep -il "a2mh"

ls -l | grep ^d

 

<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、付费专栏及课程。

余额充值