Solaris installed with color resolved LS

zhaozj2021-02-16  117

Solaris's default LS displayed directory or files, etc. Local.gz II, the following division is complete 1. Color output is a feature of the GUN version ls command, so you must first get this version first, you can download SunfreeWare.com.

2. Install the package with the following command:

Root @ host / var / tmp> pkgadd -d coreutils-4.5.4-sol9-sparc-local

Will prompt you the following packages will be used: 1 SMCCoreu CoreUtils (SPARC) 4.5.4

Select package (s) you wish to process (or 'all' to process all packages). (DEFAULT: ALL) [?, ??, q]: Enter ~Output Ommitted--

3. This process will install and GUN LS and other useful programs to / usr / local / bin. Check this directory.

4. Document information of these commands can be found in the / usr / local / doc, and / usr / local / man directory to read these documents to learn new commands, for example, color display:

User @ host ~> man -m / usr / local / man Dircolors

Later, confirm that MANPATH VARIABLE contains / usr / local / man.

5. You can add color display settings to the entire system. If so, you need to create a DIR_COLORS file in the / etc directory. About 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 need 'colorizes output to ttys, but not # pipes.' All 'adds color character characters to all output.' None 'Shuts Colorization # OFF. Color Tty

# Xtra 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 cots: # 30 = black 31 = red 32 = green 33 = YELLOW 34 = Blue 35 = Magenta 36 = cyan 37 = whiteTa 36 = cyan 37 = white # background color cots: # 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 ; 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; 356. Testing the new settings available, use the / usr / local / bin / ls --color command under several folders.

If you can see different colors, do the next step.

7. Now we don't want to enter / usr / local / bin / ls --color each time. You can change the PATH variable to solve this problem:

User @ host ~> export path = / usr / local / bin: $ PATH

This way, when you enter the LS, you will first search the LS naming from the / usr / local / bin path without using the default / usr / bin.

8. Now we can call this command, but we still feel trouble because we have to enter the --color option each time. So you may want to give it a alias:

User @ host ~> alias ls = 'ls --color'

It is possible that this alias cannot be used under Shell / Sbin / SH. You need to use more advanced shell such as Bash or KSH.

9. Of course, when we log out, all settings have disappeared, so we need to write this setting in your shell configuration file, for example ~ / .bashrc:

User @ host ~> echo 'export path = / usr / local / bin: $ PATH' >> ~ / .bashrc user @ host ~> echo "alias ls = 'ls --color' >> ~ / .bashrc

10. In order to make this command to all users of the system, write this last two lines into echo "alias ls = 'ls --color' >> / etc / profile;

转载请注明原文地址:https://www.9cbs.com/read-10246.html

New Post(0)