| lightspeed 回复于:2004-07-24 00:40:40 |
| 去 sunfreeware.com 下载 coreutils-4.5.4-sol9-sparc-local.gz |
| plumlee 回复于:2004-07-24 01:35:11 |
| 原来这个颜色也要安装的呀?! 又学到一招 |
| 寒江獨釣 回复于:2004-07-24 04:04:20 |
| 以前这个包叫做fileutil,现在并到coreutil里面去了。光速真不错。加完包以后,还要在.bashrc 或.cshrc 加上alias ls=`/usr/local/bin/ls --color` |
| lightspeed 回复于:2004-07-24 04:31:49 |
| 寒江兄可真是多面手。 其实我是不用这些东西的, 只是回答问题而已。
很多从 Windows 及 Linux 转过来的人,动不动就要 GUI. 比如这位 就要 color. UNIX 的纯洁度越来越差了。 索性好人做到底。 Coloured ls output in 10 steps Always dreamt of having the same sort of output on your Solaris machine as you would have on Linux? Here is how you go at that. 1. Coloured output is a feature of the GNU version of ls. So you first have to obtain this version. GNU ls is in the coreutils package. You can download it from (a mirror) of sunfreeware.com. 2. Install the package using the pkgadd command: root@host /var/tmp> pkgadd -d coreutils-4.5.4-sol9-sparc-local The following packages are available: 1 SMCcoreu coreutils (sparc) 4.5.4 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: y --output ommitted-- 3. This will install GNU ls and some other useful GNU programs in /usr/local/bin. Check this directory. 4. Information about the commands can be found in /usr/local/doc and /usr/local/man. Read the documentation for the new commands, e.g. for dircolors: user@host ~> man -M /usr/local/man dircolors Lateron, make sure that the MANPATH variable includes /usr/local/man. 5. Colours can also be set system wide, in that case you need a DIR_COLORS file in /etc. It may look somewhat like this: user@host ~> cat /etc/DIR_COLORS # Configuration file for the color ls utility # This file goes in the /etc directory, and must be world readable. # You can copy this file to .dir_colors in your $HOME directory to override # the system defaults. # COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not # pipes. 'all' adds color characters to all output. 'none' shuts colorization # off. COLOR tty # Extra command line options for ls go here. # Basically these ones are: # -F = show '/' for dirs, '*' for executables, etc. # -T 0 = don't trust tab spacing when formatting ls output. OPTIONS -F -T 0 # Below, there should be one TERM entry for each termtype that is colorizable TERM linux TERM console TERM con132x25 TERM con132x30 TERM con132x43 TERM con132x60 TERM con80x25 TERM con80x28 TERM con80x30 TERM con80x43 TERM con80x50 TERM con80x60 TERM cons25 TERM xterm TERM rxvt TERM xterm-color TERM color-xterm TERM vt100 TERM dtterm TERM color_xterm # EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output) EIGHTBIT 1 # 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 NORMAL 00 # global default, although everything should be something. FILE 00 # normal file DIR 01;34 # directory LINK 01;36 # symbolic link FIFO 40;33 # pipe SOCK 01;35 # socket BLK 40;33;01 # block device driver CHR 40;33;01 # character device driver ORPHAN 01;05;37;41 # orphaned syminks MISSING 01;05;37;41 # ... and the files they point to # This is for files with execute permission: EXEC 01;32 # List any file extensions like '.gz' or '.tar' that you would like ls # to colorize below. Put the extension, a space, and the color init string. # (and any comments you want to add after a '#') .cmd 01;32 # executables (bright green) .exe 01;32 .com 01;32 .btm 01;32 .bat 01;32 .sh 01;32 .csh 01;32 .tar 01;31 # archives or compressed (bright red) .tgz 01;31 .arj 01;31 .taz 01;31 .lzh 01;31 .zip 01;31 .z 01;31 .Z 01;31 .gz 01;31 .bz2 01;31 .bz 01;31 .tz 01;31 .rpm 01;31 .cpio 01;31 .jpg 01;35 # image formats .gif 01;35 .bmp 01;35 .xbm 01;35 .xpm 01;35 .png 01;35 .tif 01;35 6. Test that your new setup works, using the /usr/local/bin/ls --color command in a couple of directories. If your colours seem ok (look also at other than plain text files), proceed to the next step. 7. Now we don't want to type /usr/local/bin/ls --color all the time. You can solve the problem by altering your PATH variable: user@host ~> export PATH=/usr/local/bin:$PATH This way, when you just type ls, the first oclearcase/" target="_blank" >ccurance in your search path will be the ls from /usr/local/bin instead of the default one from /usr/bin. 8. Now we already have the correct program when we call it, but we are lazier than that, because we don't want to type the --color option all the time either. So you might want to alias the ls command: user@host ~> alias ls='ls --color' Mind that this does not work for the common shell, /sbin/sh. You need a more advanced shell for making aliases, such as bash or ksh. 9. Of course, when you log out, all these settings are gone, so add these lines to your shell configuration file, e.g. ~/.bashrc: user@host ~> echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc user@host ~> echo "alias ls='ls --color'" >> ~/.bashrc 10. In order to make these settings available for all users on the system, put these last two lines in /etc/profile (check first, if PATH is already defined, it is cleaner to arrange the existing definition. |
| cwmould 回复于:2004-07-26 13:25:54 |
| 楼上这位老兄,好像把solaris说的是自命清高似的,有颜色不是好事,难道位老兄余凭着名字就能区分文件及目录,好眼力!难道unix就得原始,如果老兄水平这么高,不如自己去写个内核好了,什么都不加载,用什么都利自己编,这样更加纯洁(这也是我的理想,可俺做不到,只是在努力罢了,莫非这位老兄已经达到这样的顶极hacker的水平?) |
| brucewoo 回复于:2004-07-26 14:37:29 |
| ls -al的输出就可以判断是目录还是文件
-rwxr-xr-x ... 文件 drwxr-xr-x ... 目录 |
| Ryker 回复于:2004-07-26 14:54:19 |
| ls -F 好像是这个参数显示的时候后面跟个符号,而且是宽行显示 |
| Philmoon 回复于:2004-07-26 16:49:54 |
| [quote:4cfd9af306="cwmould"]楼上这位老兄,好像把solaris说的是自命清高似的,..........[/quote:4cfd9af306]
我觉得lightspeed兄实际上表达了这么一层意思,UNIX和WINDOWS实际上是两个非常不同的领域,后者是面向大众化,前者是强调专业化。因此两者的操作、管理风格非常不同,不好妄比。大众化的东西当然要方便操作、引人耳目,专业化的东西需要知识的积累和细致的分析。因此象颜色包这样的东东,UNIX厂商不是不能做,而是它不把重点放在这方面(对SUN的机器,显卡显示示器都是外设选件)。UNIX下很多软件,配置时可以用图形界面,但一些危险的操作则不放在GUI中,一定要用复杂的命令行才可以实现。UNIX这种近乎笨拙的简朴,实际是对系统管理员水平的严格要求,一种安全上的防范。 |
| cwmould 回复于:2004-07-26 17:51:34 |
| 我也理解这位老兄的大致意思,我至今使用solaris linux等5年左右了,公司的大部分应用都在这上面,而配置这些时我想没人会是从GUI上配置的(大部分估计都得自己编程),我现在看一些linux内核的书及自己在编制简单的linux 下C程序(初学者+爱好者),我也喜欢用键盘控制计算机的感觉,我觉得这是所有unix爱好者的爱好(当然比不上那些对着AS400等的高手),也是对windows用户的骄傲吧,但我绝不反对通过一些工具来改进自己的工作,这些指令我当然知道,但你想想,你是用ls -al还是用改进后的ls(靠颜色区分)方便,当你每天在使用N次的时候?而且它并不能完全达到这样的效果(区分文件与目录,区分可执行文件等,而且是看颜色的方便还是从一大行找方便?)以上只是小例子,我就是从linux与solaris的对比中感觉前者确实方便。
我的意思是说,不论是不是GUI,是不是专业者,只要是优点,我就得学,而不是守着所谓的专业(这说明你有了一定的惯性) |
| rollingpig 回复于:2004-07-26 18:14:39 |
| 当你花时间使你的ls 变得有颜色时
有人已经看了几个命令的manpage.... |
| mmmmn 回复于:2004-07-26 22:26:26 |
| 有毛病
你一次只负责装20台机器,难道还要花时间再把这个什么什么的包装上? 使用这些工具是属于个人喜好问题,不能说不使的人就不成,也不能说使就不好。 |
| 寒江獨釣 回复于:2004-07-26 22:48:45 |
| [quote:a588ea852b="cwmould"]楼上这位老兄,好像把solaris说的是自命清高似的,有颜色不是好事,难道位老兄余凭着名字就能区分文件及目录,好眼力!难道unix就得原始,如果老兄水平这么高,不如自己去写个内核好了,什么都不加载,用什么都利自?..........[/quote:a588ea852b]
几天没来,就这样热闹了。也来说两句。 <<很多从 Windows 及 Linux 转过来的人,动不动就要 GUI. 比如这位 就要 color. UNIX 的纯洁度越来越差了。>> 光速兄的意思只是他个人的意思,我也有同样的想法,当然,不是这位cwmould的了。只是想说说,过去的好时光,(the good old day ). 不是Solaris自命清高,是确实有高于一般操作系统的地方,这就是为什么我们要来这里的主要原因。他也说了,动不动就用gui, 不是说不能用gui. 保持unix的纯洁度并不是要保持它的原始。如果阁下只是要凭颜色来区分文件和目录,还是不要玩unix的好了。 |
| lightspeed 回复于:2004-07-26 22:49:16 |
| 大家各抒己见,令人耳目一新。 去过一些坛子,发觉这里的风气特别好。
对于前面我的话可能引起的误解,我表示歉意。 Linux 的贡献很大。 主要原因不在 Linux, 而是 GNU, 越来越多的主流 Unix 厂家将 GNU 版本的程序容纳其中. 但由于版权问题, 还不能正式采用. |
| 寒江獨釣 回复于:2004-07-26 22:58:59 |
| 哈,你真的是有了國士之風了。不錯。有空了給你治一方印,一樣的厚重。如何? |
| lightspeed 回复于:2004-07-26 23:11:50 |
| 知我者寒江兄也, 那就先行谢过了。 |
| cwmould 回复于:2004-07-27 10:26:51 |
| 有无颜色,本属皮毛之事(有没有它同样做事),俺也不会一天装N台solaris(我想,这不是大多数人的工作,你要偏说你的对字符的分辨能力超过对颜色那我也无话可说)。
使用solaris很多时间了,同时也在用linux,不料昨日突发奇想,为什么solaris没有颜色?顺手就问了一个问题,不料引来的了GUI与UNIX的原始之争,始料未及,不过也很高兴,毕竟能让大家都能发表自己的看法 我想观点的两方应该是坚守UNIX阵营的专业人士与像我一样UNIX的爱好者,前者一直在使用UNIX的一两种(比如solaris),因此对他们有了很深的感情,而后者可能使用的更杂一些(像我,solaris linux aix)都有接触,使用的原因或者是工作,或者是爱好。前者都是术所攻,因此也是我要问而他能答的缘故,而后者对各个系统都有了解,各家所长都有一些了解。我想争论的原因是后者可能带来了一些别的系统(包括GUI)的东东,而这些东东(不论好与坏)可能与前者某些多年形成的观点有些冲突。这些年linux的发展确实给UNIX阵营带来了相当多的用户(我就是5年前从linux开始),他们有很多的windows用户,他们确会以这样的眼光来看待UNIX,但你呢,难道你不使GUI吗(从不使windows的牛人我只见过一个)?UNIX正在处于转型期,所以这样的争论相当普遍 |
| DoTar 回复于:2005-07-01 13:13:22 |
| UNIX使用GUI干吗啊?一点用处都没有啊;又不是工作用的windows;
unix,不用的软件、服务就别装,不用的服务就别起,越精简越好,CPU和内存可是宝贵的资源啊 采购报配置,显卡就不要了吧,可擦写DVD/CDROM就不要了吧(要也可以,买回来装到自己的PC上),显示器键盘鼠标都不要了吧;买只猫还是有用的; |
| q1208c 回复于:2005-07-01 13:41:42 |
| [quote:600ad5bc63="DoTar"]UNIX使用GUI干吗啊?一点用处都没有啊;[/quote:600ad5bc63]
难道老兄你们公司的图形工作站(比如 Sun Blade 2000, 也不知道拼得对不对) 都是在 CLI 下做图的? 真强!! :em02: :em02: 呵呵, 开个玩笑. :em03: :em03: 楼主不过是想试试这个功能, 又没说没有这个功能不行. 嘿嘿, 顺便说一下, 有了这个功能也没什么坏处吧. |
| flying_boy 回复于:2005-07-01 16:51:48 |
| coreutils-4.5.4-sol9-sparc-local.gz的下载目录没有说啊?sun |
| kkjerry 回复于:2005-07-01 22:04:25 |
| 怎麼改顏色啊 |
| ycxm 回复于:2005-07-03 14:09:34 |
| Hot!hot!hot!!!
连SUN 都加并行打印口, USB口, 想来这些功能是不错的,加点COLOR 也好啊!!! 想我们一个作业十几个小时, 一个流程几个里拜, 就是要用他们听歌曲, 看电影, 可惜学业不精, 这些用途正在研究, 望同行指教. |
| wenzy98 回复于:2005-07-03 15:06:00 |
| 用unix工作,用windows娱乐!
谁干什么强就用什么,何必强求呢? |
| fjingxu 回复于:2005-08-04 17:31:56 |
| 学习学习,呵呵。 |
| cnhero 回复于:2005-08-08 10:43:28 |
| 我在SUN的 终端上,和 SSH 下面,都没有调试出来颜色,
不是安装一个 coreutil就完事的。真麻烦啊; 如果图人机界面好,就去找WINDOWS OR LINUX(其实只是使用他们比较习惯罢了) |
| Solaris12 回复于:2005-08-08 13:00:48 |
| [quote:e84a5c3cfb="cwmould"]有无颜色,本属皮毛之事(有没有它同样做事),俺也不会一天装N台solaris(我想,这不是大多数人的工作,你要偏说你的对字符的分辨能力超过对颜色那我也无话可说)。
使用solaris很多时间了,同时也在用linux,不料?..........[/quote:e84a5c3cfb] solaris ls为什么没有颜色? 答案很简单,就是SUN觉得这个特性不重要。 但是SUN觉得不重要的东西,我们个人也许却未必,很多初学者会因为bash和ls颜色而对solaris说不。 其实,大家也许没有意识到,这正是给你一个机会去改变你觉得solaris不好的地方,solaris opensource了,不喜欢的东西,就自己DIY吧。 |