How to write a script in linux terminal colors

Note that they can still be saved into files or processed as input by programs other than the terminal. Scripts tput accepts scripts containing one command per line, which are executed in order before tput exits. By Sandra Henry-StockerUnix Dweeb, Network World Customizing your text colors on the Linux command line The different colors used on the Linux command line are intended to provide an easy way to identify files by type.

linux colors

The 31 makes the font color red. The settings cause block bd and character cd devices to be displayed with a black background, an orange font, and one other effect — the characters will be in bold.

how to write a script in linux terminal colors

The bd and cd definitions are identical to each other — 40;33;01 and have an extra setting. Pipes are special files, and this special handling makes them stand out in a directory listing. It tells echo to enable backslash escapes.

Text mode commands tput bold Select bold mode tput dim Select dim half-bright mode tput smul Enable underline mode tput rmul Disable underline mode tput rev Turn on reverse video mode tput smso Enter standout bold mode tput rmso Exit standout mode Cursor movement commands tput cup Y X Move cursor to screen postion X,Y top left is 0,0 tput cuf N Move N characters forward right tput cub N Move N characters back left tput cuu N Move N lines up tput ll Move to last line, first column if no cup tput sc Save the cursor position tput rc Restore the cursor position tput lines Output the number of lines of the terminal tput cols Output the number of columns of the terminal Clear and insert commands tput ech N Erase N characters tput clear Clear screen and move the cursor to 0,0 tput el 1 Clear to beginning of line tput el Clear to end of line tput ed Clear to end of screen tput ich N Insert N characters moves rest of line forward!

The available colors are shown below. These define display attributes by file extension rather than file type. NOTE: The command above is truncated. Sandra Henry-Stocker The "40" in the definition of pi shown above makes the file show up in the terminal or PuTTY window with a black background.

They will not be shown themselves. You've probably also come to recognize some of the distinctions — directories appearing in one color, executable files in another, etc.

Rated 5/10 based on 26 review
font color in script