我试图使用下面的命令将结果传递给更less,以便我可以完整地读取列表:
ls -lh | less
这样,根据各种渠道将内容输送到较less,并允许在新文件中查看列表。 相反,它覆盖了我较less的命令。 我用vi查看较less,现在确实是我所在的文件夹的列表。
我相信原因是因为当我使用命令的时候,我在/ usr / bin /文件夹内,那里的命令less了。 是的,我已经在命令日志中查看了我的步骤,只有cd和ls在覆盖之前和之后,修改时间与我运行上述命令时相匹配。 是的,我是唯一有权访问的用户。
那么现在less了已经被破坏了,我该如何重新安装那个文件呢?
服务器是CENTOS 4.9(Final),uname -a返回:
Linux server.name.com 2.6.9-89.0.16.EL#1 Tue Nov 11 17:15:02 EST 2009 i686 i686 i386 GNU / Linux
因为cPanel不再支持CENTOS 4,所以我确实需要做一次操作系统的重装/升级,但同时我还是要less一些。 我可以使用vi或更多来代替它。
—编辑添加—
我知道每个人都会反复地这样说,不可能像描述的那样发生,但是这里是一步一步完成的实际列表:
> /usr/sbin/exim -bp > /home/<username>/<filename>.log (created Feb 4 21:03) > less -N /home/<username>/<filename>.log (less was working fine) > top > df -P > cd /usr > ls -l > cd games > ls -l > cd .. > cd lib > ls -l > cd .. > ls -l > cd etc > ls -l > cd .. > cd bin > ls -lh > ls -lh | less (less reports created Feb 4 21:22) (this started trying to run every line in the listing like a shell script. I was confused about this error, so I did some looking online for an answer - none found. So I decide to send the output to a file instead.) > ls -lh > ls -lh > /home/<username>/ls (created Feb 4 21:42) > less /home/<username>/ls (output is the same with it trying to run every line in the listing as a shell script) > ls -lh > /home/sbaldwin/ls.log (wondering if calling a file ls messed up things, I retry to > output to a file) > ls -lh /home/sbaldwin/ls.log (check to see the file size) > less /home/sbaldwin/ls.log (same result as before) > less (same result) > top > more (functioning normally) > vi (functioning normally) > less (same result) > exit (tried exiting and returning, and seeing if a process is running for less) > less (same result) > vi /usr/bin/less (Now I see that it is the directory listing of '/usr/bin' > ls -lh /usr/bin/less -rwxr-xr-x 1 root root 74K Feb 4 21:22 /usr/bin/less*
对于那些certificate这是不可能发生的反对者,就是这样。 没有其他人拥有root权限,我是唯一一个login到SSH的人,没有其他的命令运行以上。 对于它的价值,也许这是一个错误, 如果你运行ls -lh | 在/ usr / bin /文件夹中less了一个链接到less的位置,它可能只是写在你的less文件。 如果你100%确定这是不可能发生的,一定要试一试。 同样,它可能仅限于CENTOS 4.9。
你发布的命令不应该覆盖更less,但是我们不要详述。
我不确定“cPanel不再支持CENTOS 4”是什么意思,但是如果CentOS 4的仓库不能在你的系统上运行,那么从CentOS发行版下载更less的RPM并强制重新安装它。
wget http://vault.centos.org/4.9/os/i386/CentOS/RPMS/less-382-4.rhel4.i386.rpm rpm -Uvh --force less-382-4.rhel4.i386.rpm
这将强制覆盖由较less的RPM安装的任何包,包括修改后的较less的二进制文件。