Check available disk space.
Syntax df [-k] [directory]
df [-t] [-x] [-k] [-p] [-a] ... [filename]
Option or argument
|
Function
|
-g
|
|
-k
|
|
-v
|
|
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)
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
|
|
-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.
|
Check disk space usage.
Syntax du [-a] [-b] [-c] [-D] [-k] [-l] [-L] [-s] [-S] [-x] [filename]
e.g.
echo $HOME
Searches a file for a pattern.
e.g.
egrep "\(([A-z]+|[0-9]+)\)" my.txt
Refer &.
Compute.
e.g.
Asterisk & Parentheses
expr \( 11 + 5 \) '*' 2
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
|
|
-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"
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
|
|
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
use like in DOS. Can use command like lcd / cd / put / get.
ftp to local host, refer put.
1.12 getfacl (solaris)
show access control, similar with aclget in AIX.
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
|
|
-i
|
|
-l
|
|
-n
|
|
-p[Separator]
|
|
-s
|
|
-v
|
|
text
|
|
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
分享到:
相关推荐
14. `tlist` 和 `kill`:这两个命令是用于查看和结束进程的,通常在系统调试和故障排除中使用。 15. `del` 和 `move`:文件管理命令,`del`用于删除文件,`/S /Q`选项可以递归删除目录及其内容而不提示,`move`用于...
如`dir /b | sort > list.txt` 会排序目录中的文件并保存到`list.txt`,然后可以使用`fc /l list.txt list_sorted.txt` 比较排序前后的差异。 3. **统计分析**:`find`命令可以计数特定字符或字符串。如`type file....
List<String> commands = Arrays.asList("cmd", "/c", "dir"); ProcessBuilder pb = new ProcessBuilder(commands); Process process = pb.start(); ``` **JavaScript调用命令行** 在JavaScript中,由于安全...
* -k [ 1 | 2 ] remove [ replace ] control characters:删除或替换控制字符。 八、其他选项 * -y display_width:指定显示宽度。 * -Y display_width:指定显示宽度。 * -b on error batch abort:在错误时中止...
##### 2. **`net user`** - **创建用户**: ```cmd net user 用户名 密码 add ``` 创建一个新的用户账户,并设置初始密码。 - **激活 guest 用户**: ```cmd net user guest active yes ``` 激活guest...
process->start("cmd.exe", QStringList() ); ``` 这里,`"/c"`参数告诉CMD执行完`notepad.exe`后关闭,`notepad.exe`则是我们要启动的外部程序。 接下来,我们关注如何处理子进程的输出。QProcess提供了`...
process.start("cmd.exe", QStringList() ); process.waitForFinished(); ``` 这里的`start`方法启动了CMD进程,并通过`/c`参数传递了执行"dir"命令的指令。`waitForFinished`确保我们等待命令执行完成后再继续执行...
2. `perl-Test-Harness-3.28-3.el7.noarch.rpm`: 提供了测试框架,用于编写和运行Perl模块的测试套件。 3. `perl-ExtUtils-MakeMaker-6.68-3.el7.noarch.rpm`: 是Perl模块构建工具,用于创建Makefile,帮助开发者...
在CMD中,标准输出通常使用数字`1`表示,而标准错误输出则使用数字`2`表示。通过使用`2>&1`,我们可以将标准错误输出重定向到标准输出,从而将两者合并为一个输出流。例如: ```cmd mycommand > mylog.txt 2>&1 ```...
OracleParameter param = cmd.Parameters.Add("return_value", OracleDbType.Varchar2, ParameterDirection.ReturnValue); param.ArrayBindSize = myList.Count; param.CollectionType = OracleCollectionType....
2. **事件选择**: `trace-cmd list`可以列出所有可用的内核事件,用户可以根据需求选择要追踪的事件。 3. **查看日志**: `trace-cmd report`命令将追踪数据转化为可读的报告,帮助分析系统行为。 4. **保存/加载**...
### 遍历CheckBoxList,获得选中项的值动态绑定CheckBoxList #### 知识点一:CheckBoxList概述及应用场景 **CheckBoxList** 是ASP.NET Web Forms中一个非常有用的控件,它允许用户选择一个或多个选项。CheckBoxList...
2. Windows CMD的`mkdir`和`copy`命令 3. 异常处理和错误检查 4. 操作系统兼容性考虑 5. 安全编码实践 在实际项目中,如果频繁进行此类操作,建议使用Java的I/O和NIO库,或者第三方库如Apache Commons IO,它们提供...
#### 2. **用户账户管理** - `net user`:用于添加、修改或查看用户账户信息。 - `net user û /add`:创建新用户û。 - `net user guest /active:yes`:激活Guest账户。 - `net user ʻ`:显示所有用户列表。 ...
- `tlist -t` 列出系统中的所有进程,`kill -F 进程名` 强制结束进程(需要安装额外工具)。 5. **文件操作**: - `del` 命令用于删除文件,`del /F 文件名` 可删除只读文件,`del /S /Q 目录` 删除指定目录下的...
* firewall-cmd --zone=dmz --list-ports 这将显示 dmz zone 中所有打开的端口。 firewall-cmd 命令还可以用于添加端口到 zone,例如: * firewall-cmd --zone=dmz --add-port=8080/tcp 这将添加 8080 端口到 ...
2. **用户与组管理**: - `net user`:创建、查看或修改用户账户。`net user guest /active:yes`激活guest用户。 - `net localgroup`:管理本地组,如将用户添加到管理员组。 3. **服务管理**: - `net pause` ...
16. `tlist -t`和`kill -F`: 分别用于列出和结束进程,通常在Support Tools中。 17. `del`和`rmdir`: 用于删除文件和目录,`-F`选项可删除只读文件,`/S`和`/Q`分别用于删除目录及其内容,且不提示确认。 18. `...
### CMD常用命令解析 #### 一、Ping命令详解 **命令格式:** ``` ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [[-r count] | [-s count]] [-j computer-list | -k computer-list] [-w timeout] ...