Centos ll 命令从哪里来的 (2020-10-26)

Centos ll 命令从哪里来的

问题

有小伙伴在群里使用 php 的 exec 无法执行 ll 命令。

来自别名

ll 并不是一个命令,而是一个别名,真实的命令是 ls -lh,这是在用户登录时默认定义的。

比如在 ./bashrc 中定义,或者在 /etc/profile.d/ 中定义。

别名定义位置

TODO

延伸

在 php 执行命令实际上是在 www 用户中执行命令,所以如果 www 的配置中没有定义 ll 就无法执行这个 ll 命令。

如何查看这个命令是来自哪里的,可以使用 which 命令查看。
比如 which ll 就会返回这个是什么命令的别名。

ll='ls -lh'
		/usr/bin/ls

笔记

附录

How to Create Bash Aliases https://linuxize.com/post/how-to-create-bash-aliases/

What command is the alias ll for? https://askubuntu.com/questions/1033998/what-command-is-the-alias-ll-for

Alias files of the Centos https://forums.centos.org/viewtopic.php?t=3156

版本

  • v0.1.2
  • 2020-10-26
  • 建伟 F4NNIU

posted on 2020-10-23 16:19  建伟F4nniu  阅读(602)  评论(0编辑  收藏  举报

导航