1、使用sudo,会导致配置的alias不可用,比如说sudo ll,会提示找不到命令
原因:
From the bash manual:
Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. The shell maintains a list of aliases that may be set and unset with the alias and unalias builtin commands.
The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias. The characters ‘/’, ‘$’, ‘`’, ‘=’ and any of the shell metacharacters or quoting characters listed above may not appear in an alias name. The replacement text may contain any valid shell input, including shell metacharacters. The first word of the replacement text is tested for aliases, but a word that is identical to an alias being expanded is not expanded a second time. This means that one may alias ls to "ls -F", for instance, and Bash does not try to recursively expand the replacement text. If the last character of the alias value is a space or tab character, then the next command word following the alias is also checked for alias expansion.
Bash only checks the first word of a command for an alias, any words after that are not checked. That means in a command like sudo ll, only the first word (sudo) is checked by bash for an alias, ll is ignored. We can tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value.
解决方案:
Add the following line to your ~/.bashrc:
alias sudo='sudo '
摘自:http://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo
2、执行"ls --color"命令,看到的文件颜色的含义
颜色的展现是由配置决定的,我们可以使用dircolors命令,来查看颜色配置
The colors of files when viewed in ls (or more specifically ls --color) by system settings. Use dircolors -p to view a whole list of your configuration.
In that output I see:
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
Your example has a red background and white foreground, so I would look for a code with 37 (white) and 41 (red).
$ dircolors -p | grep 37 | grep 41
SETUID 37;41 # file that is setuid (u+s)
And we see that it's setuid
摘自:http://superuser.com/questions/202783/what-does-it-mean-for-the-file-name-to-be-shown-with-red-background
3、执行ls命令,显示的文件右上角有星,表示什么意思?
表示该文件是可执行文件
4、在shell中打开一个程序,导致不能关闭该shell,因为shell的关闭也会给在该shell中打开的程序发送一个关闭信号
解决方案:nohup command &
以上命令,默认把结果输出到nohup.out中,如果我们不需要这些输出,可以再结合
"/dev/null"和"重定向命令"
即nohup command>/dev/null &
比如nohup ./eclipse >/dev/null &