【问题标题】:l (lowercase L) command in bash terminalbash 终端中的 l(小写 L)命令
【发布时间】:2012-03-29 05:06:00
【问题描述】:
vikram@vikram-Studio-XPS-1645:~/comp$ l
3rdParty/    que.ico     SE32.EXE   start.fgx  Supp/         WebResources/
autorun.inf  Readme.txt  START.EXE  start.fgz  Walkthrough/
vikram@vikram-Studio-XPS-1645:~/comp$ ls
3rdParty     que.ico     SE32.EXE   start.fgx  Supp         WebResources
autorun.inf  Readme.txt  START.EXE  start.fgz  Walkthrough
vikram@vikram-Studio-XPS-1645:~/comp$ 

这两个命令有什么区别?

我试过$ which l,但没有输出。

$ man l 也没有结果。

我也尝试谷歌搜索失败。

【问题讨论】:

  • 是的,我无法想象用谷歌搜索这样的东西会带你到任何地方。
  • @asmeurer: It does now

标签: bash shell terminal command


【解决方案1】:

据我所知,不存在通用命令“l”,甚至不存在“ls”的作用,这就是为什么which lman l 的结果为空的原因

您的路径上是否有名为 l 的东西可能运行 ls

【讨论】:

    【解决方案2】:

    l 可能是ls -F 之类的别名。 -F 选项导致ls/ 附加到目录名称,* 附加到可执行的常规文件等。

    更新:根据您的评论,l 别名为ls -CF。单个字母选项可以“捆绑”,所以ls -CF 等价于ls -C -F-C 选项使ls 按列列出条目。如果ls 认为它正在写入终端,则这是默认设置; -C 选项使它无条件地以这种方式运行。 (ls -1 每行列出一个条目,如果ls *不写入终端,这是默认设置。)

    type -a l 应该告诉你它是如何定义的。它可能设置在您的$HOME/.bashrc 中。

    $ 是您的 shell 提示符的一部分,而不是命令的一部分。)

    【讨论】:

    • vikram@vikram-Studio-XPS-1645:~/comp$ type l l is aliased to ls -CF' ...谢谢,我明白了.. !!
    • 酷。我知道which,但不知道type -a
    【解决方案3】:

    它是“ls”的特定 bash 命令。

    ilia@Latitude-E6410:~$ mkdir ltest
    ilia@Latitude-E6410:~$ cd ltest
    ilia@Latitude-E6410:~/ltest$ echo 321 > 321.txt
    ilia@Latitude-E6410:~/ltest$ echo 123 > 123.txt
    ilia@Latitude-E6410:~/ltest$ ls
    123.txt  321.txt
    ilia@Latitude-E6410:~/ltest$ l
    123.txt  321.txt
    ilia@Latitude-E6410:~/ltest$ whereis ls
    ls: /bin/ls /usr/share/man/man1/ls.1.gz
    ilia@Latitude-E6410:~/ltest$ whereis asdasdasd #This command doesn't exists
    asdasdasd:
    ilia@Latitude-E6410:~/ltest$ whereis l #Results of "whereis l" and "whereis asdasdasd" are same
    l:
    ilia@Latitude-E6410:~/ltest$ sh #Try "l" in sh
    $ ls #"ls" is working
    123.txt  321.txt
    $ l #But "l" doesn't
    sh: 2: l: not found
    $ 
    

    【讨论】:

    • 这根本不是 Bash 命令。公认的答案说明了一切:它是由用户创建的文件或发行版的维护者在某处定义的别名。顺便说一句,whichwhereis 是(在 Bash 中)确定命令/函数/别名是什么的坏方法。改用type -atype -a l 会给你一些信息(但不是定义的地方)。
    • 是的,它是 ls -CF 的别名,对不起。
    【解决方案4】:

    判断其别名的方法是查看~/.bashrc文件

    $sudo cat ~/.bashrc | grep 'alias l='
    alias l='ls -CF'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      • 2019-01-19
      • 2012-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多