最近,我尝试通过 WinSCP 连接到我的 GeeXbox,但收到错误,指示ls
无法解析 的输出。
显然,我的ls
不包含时间戳!可能是什么原因以及我该如何纠正?请参阅下面的示例输出:
$ ls -la
total 96
drwxrwxr-x 17 root root 4096 .
drwxrwxr-x 17 root root 4096 ..
lrwxrwxrwx 1 root root 7 bin -> usr/bin
-rw-rw-r-- 1 root root 39779 config
drwxr-xr-x 13 root root 3980 dev
drwxrwxr-x 29 root root 4096 etc
我的特别ls --help
优惠是:
$ ls --help
BusyBox v1.23.0.git (2014-05-19 13:33:13 IDT) multi-call binary.
Usage: ls [-1AaCxdlinshrSXv] [-w WIDTH] [FILE]...
List directory contents
-1 One column output
-a Include entries which start with .
-A Like -a, but exclude . and ..
-C List by columns
-x List by lines
-d List directory entries instead of contents
-l Long listing format
-i List inode numbers
-n List numeric UIDs and GIDs instead of names
-s List allocated blocks
-h List sizes in human readable format (1K 243M 2G)
-r Sort in reverse order
-S Sort by size
-X Sort by extension
-v Sort by version
-w N Assume the terminal is N columns wide
--color[={always,never,auto}] Control coloring
答案1
通常,作为“专用设备”的系统会使用名为 BusyBox 的工具。您可以阅读更多有关BusyBox项目,但简而言之,该项目提供了典型工具的精简版本,例如ls
等。
在我安装的也使用 BusyBox 的 XBMC 上,ls
当我执行ls -l
.还有一个额外的开关-e
可以生成时间日期信息。
# ls --help
BusyBox v1.21.0 (2013-01-22 19:16:54 CET) multi-call binary.
Usage: ls [-1AaCxdLHRFplinsehrSXvctu] [-w WIDTH] [FILE]...
List directory contents
-1 One column output
-a Include entries which start with .
-A Like -a, but exclude . and ..
-C List by columns
-x List by lines
-d List directory entries instead of contents
-L Follow symlinks
-H Follow symlinks on command line
-R Recurse
-p Append / to dir entries
-F Append indicator (one of */=@|) to entries
-l Long listing format
-i List inode numbers
-n List numeric UIDs and GIDs instead of names
-s List allocated blocks
-e List full date and time
-h List sizes in human readable format (1K 243M 2G)
-r Sort in reverse order
-S Sort by size
-X Sort by extension
-v Sort by version
-c With -l: sort by ctime
-t With -l: sort by mtime
-u With -l: sort by atime
-w N Assume the terminal is N columns wide
--color[={always,never,auto}] Control coloring
所以我假设您遇到了两种情况之一。
- 您的 BusyBox 版本在输出中不包含时间戳
-l
。顺便说一句,我怀疑情况是否如此。 mount
由于必须跟踪此信息所涉及的开销,文件系统通过选项禁用了时间戳跟踪。
例如,有一些选项noatime
将禁用文件系统上的访问时间跟踪。
$ mount -v
/dev/mmcblk0p1 on /flash type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)