简体   繁体   English

ls和-lh / usr在NodeJ中是什么意思?

[英]What does ls and -lh/usr mean in NodeJs?

在NodeJs中使用子进程模块时, ls-lh/usr代表什么?

If you're referring to the example for spawn() : 如果您引用的spawn()示例

var spawn = require('child_process').spawn,
    ls    = spawn('ls', ['-lh', '/usr']);

// ...

ls is, from left to right: ls是从左到右:

  • A variable referring to the ChildProcess instance created and returned by spawn() . 一个变量,该变量引用由spawn()创建并返回的ChildProcess实例。
  • The name of a common unix/linux command for listing the contents of a directory . 列出目录内容的通用unix / linux命令的名称。

The snippet is equivalent to executing the following command in a shell/terminal, where spaces separate the command and arguments: 该代码段等效于在shell /终端中执行以下命令,其中空格将命令和参数分隔开:

ls -lh /usr

Which will try to list the contents of the /usr directory, specifying -lh as 2 combined options to output in " long listing format " ( -l ) with " human readable sizes " ( -h ). 它将尝试列出/usr目录的内容,将-lh指定为2个组合选项,以具有“ 人类可读大小 ”( -h )的“ 长列表格式 ”( -l )输出。

It assumes the system running the code has a compatible ls command or executable. 假定运行代码的系统具有兼容的ls命令或可执行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM