日期:2014-05-16  浏览次数:20848 次

那些有意思的linux命令
who 查看当前登录的所有用户名/时间/方式
whoami 当前登录用户名
who am i 当前登录用户名/时间/方式

which
manual手册:
which returns the pathnames of the files (or links) which would be exe‐
cuted in the current environment, had its arguments been given as com‐
mands in a strictly POSIX-conformant shell. It does this by searching
the PATH for executable files matching the names of the arguments. It
does not follow symbolic links.
就是说 which 是根据PATH在当前环境中寻找可执行的文件或连接

whereis
manual手册:
whereis locates source/binary and manuals sections for specified files.
The supplied names are first stripped of leading pathname components
and any (single) trailing extension of the form .ext, for example, .c.
Prefixes of s. resulting from use of source code control are also
dealt with. whereis then attempts to locate the desired program in a
list of standard Linux places.
定位到制定名字的源文件,二进制文件和手册

whatis
manual手册
whatis - display manual page descriptions 主要是从手册里拿到简短描述
Each manual page has a short description available within it. whatis
searches the manual page names and displays the manual page descrip‐
tions of any name matched.

name may contain wildcards (-w) or be a regular expression (-r). Using
these options, it may be necessary to quote the name or escape (\) the
special characters to stop the shell from interpreting them.

index databases are used during the search, and are updated by the
mandb program. Depending on your installation, this may be run by a
periodic cron job, or may need to be run manually after new manual
pages have been installed. To produce an old style text whatis data‐
base from the relative index database, issue the command:
whatis -M manpath -w '*' | sort > manpath/whatis
where manpath is a manual page hierarchy such as /usr/man.

type
type命令用来显示指定命令的类型。一个命令的类型可以是如下之一
alias 别名
keyword 关键字,Shell保留字
function 函数,Shell函数
builtin 内建命令,Shell内建命令
file 文件,磁盘文件,外部命令
unfound 没有找到
它是Linux系统的一种自省机制,知道了是那种类型,我们就可以针对性的获取帮助


sl          -- ls敲错时,跑小火车的命令
cowsay      --“狐狸叫”    #cowsay -f daemon "help me"
nethack     --有人说,如果一生人只做一件事的话,那就玩Nethack吧。经典游戏!!
cat和tac


:(){ :|:& };:     --fork bomb,你懂得。
神马不懂,看这里看这里
注解如下:
:() # 定义函数,函数名为":",即每当输入":"时就会自动调用{}内代码
{ # ":"函数开始标识
: # 用递归方式调用":"函数本身
| # 并用管道(pipe)将其输出引至...(因为有一个管道操作符,因此会生成一个新的进程)
: # 另一次递归调用的":"函数
# 综上,":|:"表示的即是每次调用函数":"的时候就会生成两份拷贝
& # 调用间脱钩,以使最初的":"函数被杀死后为其所调用的两个":"函数还能继续执行
} # ":"函数结束标识
; # ":"函数定义结束后将要进行的操作...
: # 调用":"函数,"引爆"fork bomb
其中函数名“:”只是简化的一例,实际实现时可以随意设定,一个较易理解(将函数名替换为“forkbomb”)的版本如下:
forkbomb(){ forkbomb|forkbomb & } ; forkbomb


试试这个: who is cleverest? who is sb?

yes命令, output a string repeatedly until killed
输出很多个y,可以用来对付选择很多y/n的应用

fortune命令,随机输出一句话,或者是一句英文名言,
fortune-zh命令 随机一首唐诗宋词
ubuntu下安装:
sudo apt-get install fortune
sudo apt-get install fortune-zh
又可以看些东西,蛮有意思的


cal 9 1752,打印日历,但是这个月非常有意思(在9月2日后居然跳到了14日了),这是有原因的:
在1582年,罗马教皇格列高里十三世宣布改历(由于闰年积累的原因),要求从1582年的10月4的下一天定为格列历10月15日,中间跳过了10天,在意大利、西班牙等国家都这样处理了,其他的天主国家也很快跟着这么做了,但是新教国家不愿意修改,而且希腊等东正教国家直到20世纪初才修改,所以这个改革在英国及其殖民地(包括美国)在1752年9月2日后面跟着的就是9月14日。但是在windows下,由于电脑的日期无法调回到那个时候(1980再往前就是2099年了),看来这段历史要靠Linux才能了解到了。
这个,呵呵了


xev - print contents of X events
xeyes - a follow the mouse X demo
factor - factor numbers
shred - overwrite a file to hide its contents, and optionally delete it #文件粉碎机,话说连英文发音都这么独特


cmatrix - simulates the disp