& ; | * ? ' " ` [ ] ( ) $ < > { } ^ # / \ % ! ~ +
# history | awk '{CMD[$2]++; count++; } \ END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' \ | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
另外一个版本
# history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort -r |uniq -c |sort -rn
jake@debian:~$ w 20:33:02 up 10:27, 2 users, load average: 0.06, 0.34, 0.57 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT jake tty7 :0 10:06 1.00s 1:33 1.01s /usr/bin/gnome- jake pts/0 :0.0 10:07 34:45m 0.93s 0.93s bash jake@debian:~$ who am i jake@debian:~$ who jake tty7 2007-11-07 10:06 (:0) jake pts/0 2007-11-07 10:07 (:0.0) jake@debian:~$ finger Login Name Tty Idle Login Time Office Office Phone jake Jake Chen tty7 Nov 7 10:06 (:0) jake Jake Chen pts/0 34 Nov 7 10:07 (:0.0)
tar -xvvf foo.tar extract foo.tar tar -xvvzf foo.tar.gz extract gzipped foo.tar.gz tar -xvvjf foo.tar.bz2 extract bizipped foo.tar.bz2 tar -cvvf foo.tar foo/ tar contents of folder foo in foo.tar
http://books.slashdot.org/article.pl?sid=08/08/13/137246&from=rss
Coloring the prompt? That was the "gee whiz!" moment that made me switch permanently. From my .zshrc:
# Import color definitions autoload colors zsh/terminfo colors# Define common and useful things to put in a prompt typeset -A prc prc[abbrevpath]='%{${fg[red]}%}%B%45<...<%~%<<%b%{${fg[default]}%}' prc[newline]=$'\n' prc[promptchar]='%(!.#.$)' prc[smiley]='%(?.%{${fg[green]}%}:).%{${fg[red]}%}:()%{${fg[default]}%}' prc[timestamp]='%B%{${fg[blue]}%}[%T]%{${fg[default]}%}%b' prc[userspec]='%B%(!.%{${fg[red]}%}.%{${fg[green]}%})%n@%m%{${fg[default]}%}%b'
# Make a spiffy prompt PROMPT="${prc[userspec]} ${prc[timestamp]} ${prc[abbrevpath]}${prc[newline]}${prc[smiley]} ${prc[promptchar]} "
# Unclutter the namespace unset prc
See how all the colors are defined in an associative array, like ${fg[green]} gets you a green foreground? Say I'm in the directory "/usr/share/media/music/albums/Pink Floyd - A Momentary Lapse of Reason". As a regular user, my prompt looks like:
kirk@athena [16:40] ...s/Pink Floyd - A Momentary Lapse of Reason :) $My name@host is green, the time is blue, and the path is red. The smiley face is green. Now, if I'm root:
$ sudo -s root@athena [16:43] ...s/Pink Floyd - A Momentary Lapse of Reason :) #My name@host is red now, and the prompt char is "#" instead of "$". But what if I run a command and it fails?
# crqecrqw zsh: command not found: crqecrqw root@athena [16:44] ...s/Pink Floyd - A Momentary Lapse of Reason :( #The green smiley face is now a red frowney face. Someone suggested a "big" prompt like that, and once I got used to it, I love it. It's very easy to see where command output stops and the next command starts, and the whole green smile vs. red frown thing is an instant visual indicator of a command's results (which sometimes isn't obvious, say if you're redirecting stderr to /dev/null). Sure, I could have done something similar in Bash, but I guarantee it would've been a whole lot less readable. I did that as an experiment to learn Zsh scripting, and I haven't deliberately used Bash since then.