在网上看到了很多都是说ll命令是ls -l命令的别名,但为什么在用ll命令的时候却可以输出隐藏文件并在末尾添加了一个字符说明该文件的类型,我们先来看看输入命令时所输出的列表信息:
ls -l命令:
eHunter@eHunter-VirtualBox:~$ ls -l
total 48
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Desktop
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Documents
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Downloads
-rw-r--r-- 1 eHunter eHunter 8980 2月 12 10:42 examples.desktop
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Music
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Pictures
drwxr-xr-x 13 eHunter eHunter 4096 4月 1 13:46 project
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Public
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Templates
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Videos
ll命令:
eHunter@eHunter-VirtualBox:~$ ll
total 176
drwxr-xr-x 16 eHunter eHunter 4096 4月 3 10:07 ./
drwxr-xr-x 4 root root 4096 3月 4 10:32 ../
-rw------- 1 eHunter eHunter 25380 4月 2 18:58 .bash_history
-rw-r--r-- 1 eHunter eHunter 220 2月 12 10:42 .bash_logout
-rw-r--r-- 1 eHunter eHunter 3771 4月 2 15:01 .bashrc
drwx------ 11 eHunter eHunter 4096 2月 13 10:51 .cache/
drwx------ 11 eHunter eHunter 4096 2月 27 10:37 .config/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Desktop/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Documents/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Downloads/
-rw-r--r-- 1 eHunter eHunter 8980 2月 12 10:42 examples.desktop
drwx------ 3 eHunter eHunter 4096 2月 12 11:26 .gnupg/
-rw------- 1 eHunter eHunter 10500 4月 3 09:47 .ICEauthority
-rw------- 1 eHunter eHunter 28 3月 4 14:19 .lesshst
drwx------ 3 eHunter eHunter 4096 2月 12 11:26 .local/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Music/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Pictures/
-rw-r--r-- 1 eHunter eHunter 807 2月 12 10:42 .profile
drwxr-xr-x 13 eHunter eHunter 4096 4月 1 13:46 project/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Public/
-rw-r--r-- 1 eHunter eHunter 0 2月 12 11:34 .sudo_as_admin_successful
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Templates/
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Videos/
drwxr-xr-x 2 eHunter eHunter 4096 3月 30 08:42 .vim/
-rw------- 1 eHunter eHunter 35513 4月 2 18:58 .viminfo
-rw------- 1 eHunter eHunter 180 4月 3 10:07 .Xauthority
这里将ls -l命令和ll命令相比较,很明显ll命令是ls -alF的别名,因为它将带“.”的隐藏文件也给输出到列表信息上了,并在每个文件的末尾添加了文件类型说明字符“/”,说明文件是表示的目录。
这里为什么ll命令不是输出的ls -l的信息呢?因为这里是系统默认了ll命令的快捷键为ls -alF,而不是ls -l。
具体修改方法:
① 先打开用户当前的脚本文件,在控制台输入vim ~/.bashrc
② 在91行处的alias ll='ls -alF'将其修改为alias ll='ls -l'并保存即可,这里也可以更改la和l的快捷键设置,打开的脚本文件示意如下:
66 # If this is an xterm set the title to user@host:dir
67 case "$TERM" in
68 xterm*|rxvt*)
69 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
70 ;;
71 *)
72 ;;
73 esac
74
75 # enable color support of ls and also add handy aliases
76 if [ -x /usr/bin/dircolors ]; then
77 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
78 alias ls='ls --color=auto'
79 #alias dir='dir --color=auto'
80 #alias vdir='vdir --color=auto'
81
82 alias grep='grep --color=auto'
83 alias fgrep='fgrep --color=auto'
84 alias egrep='egrep --color=auto'
85 fi
86
87 # colored GCC warnings and errors
88 #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
89
90 # some more ls aliases
91 alias ll='ls -alF'
92 alias la='ls -A'
93 alias l='ls -CF'
94
95 # Add an "alert" alias for long running commands. Use like so:
96 # sleep 10; alert
97 alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
98
99 # Alias definitions.
100 # You may want to put all your additions into a separate file like
101 # ~/.bash_aliases, instead of adding them here directly.
102 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
103
104 if [ -f ~/.bash_aliases ]; then
105 . ~/.bash_aliases
106 fi
107
108 # enable programmable completion features (you don't need to enable
109 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
110 # sources /etc/bash.bashrc).
111 if ! shopt -oq posix; then
112 if [ -f /usr/share/bash-completion/bash_completion ]; then
113 . /usr/share/bash-completion/bash_completion
114 elif [ -f /etc/bash_completion ]; then
115 . /etc/bash_completion
116 fi
117 fi
③ 重启运行控制台或者使用source ~/.bashrc进行激活就修改完成了。
④ 进行修改后的效果如下:
eHunter@eHunter-VirtualBox:~$ ll
total 48
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Desktop
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Documents
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Downloads
-rw-r--r-- 1 eHunter eHunter 8980 2月 12 10:42 examples.desktop
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Music
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Pictures
drwxr-xr-x 13 eHunter eHunter 4096 4月 1 13:46 project
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Public
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Templates
drwxr-xr-x 2 eHunter eHunter 4096 2月 12 11:26 Videos