简体   繁体   English

lash终端中的l(小写L)命令

[英]l (lowercase L) command in bash terminal

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$ 

What is the difference between these two commands? 这两个命令有什么区别?

I tried $ which l , but there's no output. 我试过$ which l ,但是没有输出。

Also no result for $ man l . $ man l也没有结果。

I also tried unsuccesfully to Google it. 我也尝试过谷歌。

l is probably an alias for something like ls -F . l可能是ls -F类的别名。 The -F option causes ls to append / to directory names, * to executable regular files, etc. -F选项使ls附加/到目录名, *到可执行的常规文件等。

UPDATE : Based on your comment, l is aliased to ls -CF . 更新:根据您的评论, l是别名为ls -CF Single letter options can be "bundled", so ls -CF is equivalent to ls -C -F . 单字母选项可以“捆绑”,因此ls -CF等同于ls -C -F The -C option causes ls to list entries by columns. -C选项使ls按列列出条目。 This is the default if ls thinks it's writing to a terminal; 如果ls认为它正在写入终端,这是默认值; the -C option makes it behave this way unconditionally. -C选项使其无条件地以这种方式运行。 ( ls -1 lists one entry per line, which is the default if ls is *not writing to a terminal.) ls -1每行列出一个条目,如果ls *不写入终端,则为默认条目。)

type -al should show you how it's defined. type -al应该显示它是如何定义的。 It's probably set in your $HOME/.bashrc . 它可能设置在$HOME/.bashrc

(The $ is part of your shell prompt, not part of the command.) $是shell提示符的一部分,不是命令的一部分。)

The way to find if its alias is to check ~/.bashrc file 查找其别名的方法是检查〜/ .bashrc文件

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

As far as I know there is no general command 'l' that exists or even does what 'ls' does that's why your results for which l and man l are empty 据我所知,没有一般命令'l'存在,甚至没有'ls'这就是为什么你的结果为which lman l为空

Do you have something on your path called l that perhaps runs ls ? 你的路径上有什么东西叫做l或许可以运行ls吗?

it's specific bash command for "ls". 它是“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
$ 

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

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