displays the contents of a gzipped or compressed file on the screen.
Syntax zcat filenames
Option or argument
|
Function
|
Filenames
|
|
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
Ctrl + C – cancel; Ctrl + D - exit
<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.
< 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)
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)
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. 对于其他那些需要打开的文件, 保留了文件描述符3到9.
e.g.
&>filename # 将stdout和stderr都重定向到文件"filename".
M>&N # "M"是一个文件描述符, 如果没有明确指定的话默认为1.
0<&-, <&- 关闭stdin.
1>&-, >&- 关闭stdout.
exec 3>> ${OUT}
exec 2>&3
exec 1>&3
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
Dot directory: the current location.
Dot-dot directory: moves up one level, to the parent directory.
Slash: root
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
Option or argument
|
Function
|
?
|
|
*
|
|
[abc] [a-c]
|
|
[!abc] [!a-c]
|
|
^x ^[abc]
|
|
x$ [abc]$
|
|
按文本含义解释后面接着的字符
符号
|
含义
|
\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
|
在字串结尾或者在可选的换行符之前为真。
|
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.
|
0 match
1 no match
>1 syntax error or file was inaccessible
分享到:
相关推荐
14. `tlist` 和 `kill`:这两个命令是用于查看和结束进程的,通常在系统调试和故障排除中使用。 15. `del` 和 `move`:文件管理命令,`del`用于删除文件,`/S /Q`选项可以递归删除目录及其内容而不提示,`move`用于...
隐藏 CMD 黑窗口的脚本通常用于在运行批处理文件或其他命令行程序时,避免显示命令提示符窗口,这样可以让用户在后台执行脚本而不会干扰到其他任务。 该文件需配合BAT脚本使用,在.vbs中将路径指向BAT脚本并运行该...
如`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中,由于安全...
* -L [ c ] list servers [ clean output ]:列出服务器。 * -p [ 1 ] print statistics [ colon format ]:打印统计信息。 * -X [ 1 ]:禁用命令、启动脚本和环境变量。 * -? show syntax summary:显示语法摘要。 ...
##### 6. **`net config`** - **显示系统网络设置**: ```cmd net config ``` 显示系统的网络配置信息。 ##### 7. **`net logoff`** - **断开共享连接**: ```cmd net logoff ``` 断开当前的共享连接。...
process->start("cmd.exe", QStringList() ); ``` 这里,`"/c"`参数告诉CMD执行完`notepad.exe`后关闭,`notepad.exe`则是我们要启动的外部程序。 接下来,我们关注如何处理子进程的输出。QProcess提供了`...
process.start("cmd.exe", QStringList() ); process.waitForFinished(); ``` 这里的`start`方法启动了CMD进程,并通过`/c`参数传递了执行"dir"命令的指令。`waitForFinished`确保我们等待命令执行完成后再继续执行...
### CMD中的重定向输出与管道操作详解 在日常的编程工作中,特别是在Windows环境下进行开发时,熟练掌握CMD命令行工具的使用技巧对于提高工作效率是非常有帮助的。本文将重点介绍CMD中的重定向输出(`>`、`>>`)...
6. `perl-Module-CoreList-2.76.02-299.el7_9.noarch.rpm`: 显示Perl核心模块的版本信息,帮助确定哪些模块已经包含在当前Perl版本中。 7. `perl-version-0.99.07-6.el7.x86_64.rpm`: 为Perl处理版本号提供支持,...
2. **事件选择**: `trace-cmd list`可以列出所有可用的内核事件,用户可以根据需求选择要追踪的事件。 3. **查看日志**: `trace-cmd report`命令将追踪数据转化为可读的报告,帮助分析系统行为。 4. **保存/加载**...
cmd.Parameters.Add(new OracleParameter("p_list", oraArray)); cmd.ExecuteNonQuery(); ``` 5. **关闭连接**: 执行完存储过程后,别忘了关闭数据库连接。 通过这种方式,C#中的自定义列表(List)可以高效地...
### 遍历CheckBoxList,获得选中项的值动态绑定CheckBoxList #### 知识点一:CheckBoxList概述及应用场景 **CheckBoxList** 是ASP.NET Web Forms中一个非常有用的控件,它允许用户选择一个或多个选项。CheckBoxList...
#### 6. **文件与目录管理** - `ipconfig`:显示所有适配器的IP地址信息。 - `del`:删除文件,支持通配符和强制删除选项。 - `del /S/Q`:递归删除目录下的所有文件和子目录。 - `move`:移动文件或重命名文件...
在Java编程中,有时我们需要执行一些系统级别的操作,如创建目录、复制文件等,这些操作在Windows系统中可以通过命令行接口(CMD)来完成。Java提供了Runtime类和ProcessBuilder类来实现这样的功能,允许我们调用...
* firewall-cmd --zone=dmz --list-ports 这将显示 dmz zone 中所有打开的端口。 firewall-cmd 命令还可以用于添加端口到 zone,例如: * firewall-cmd --zone=dmz --add-port=8080/tcp 这将添加 8080 端口到 ...
- `tlist -t`:列出系统进程(需额外安装工具)。 - `kill -F`:强制结束进程(同样需要额外安装工具)。 掌握这些CMD命令,可以帮助用户高效地进行系统管理和网络操作,尤其是在没有图形用户界面的情况下。了解...
16. `tlist -t`和`kill -F`: 分别用于列出和结束进程,通常在Support Tools中。 17. `del`和`rmdir`: 用于删除文件和目录,`-F`选项可删除只读文件,`/S`和`/Q`分别用于删除目录及其内容,且不提示确认。 18. `...