Преглед на тема
Mrejata.net » Linux & Windows » Linux
 Принтиране на темата
Color console linux
admin
Ще ви дам примерен код как да си направите консолата на линукса цветна.

Изпилнете командите:
Свали сорса  Код
cd



Свали сорса  Код
pico .bash_profile



И поставете следния код:
Свали сорса  Код
# ~/.profile: executed by Bourne-compatible login shells.

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

mesg n



Запазете файла [Ctrl+X] Y [ENTER]
След което отворете създайте файла .bashrc
Свали сорса  Код
pico .bashrc



И поставете следните редове:
Свали сорса  Код
# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '

umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias c='clear'
# alias reboot='sudo reboot'
# alias poweroff='sudo poweroff'
# alias mount='sudo mount'
# alias eject='sudo eject'
# alias mountcd='sudo mount /dev/hdc /mnt/cdrom'
# alias umountcd='sudo umount /dev/hdc'

#
NONE="\[\033[0m\]"
BK="\[\033[0;30m\]" #Black
EBK="\[\033[1;30m\]"
RD="\[\033[0;31m\]" #Red
ERD="\[\033[1;31m\]"
GR="\[\033[0;32m\]" #Green
EGR="\[\033[1;32m\]"
YW="\[\033[0;33m\]" #Yellow
EYW="\[\033[1;33m\]"
BL="\[\033[0;34m\]" #Blue
EBL="\[\033[1;34m\]"
MG="\[\033[0;35m\]" #Magenta
EMG="\[\033[1;35m\]"
CY="\[\033[0;36m\]" #Cyan
ECY="\[\033[1;36m\]"
WH="\[\033[0;37m\]" #White
EWH="\[\033[1;37m\]"
unset LESS
export PAGER=less

#

if [ `id -un` != root ]; then
  PS1="[${EGR}\u:${EBL} \W${NONE}]$ "
else
  PS1="[${ERD}\u:${EYW} \W${NONE}]# "
fi

umask 022
#
 export LS_OPTIONS='--color=auto'
 eval "`dircolors`"
 alias ls='ls $LS_OPTIONS -p'
 alias ll='ls $LS_OPTIONS -l'
 alias l='ls $LS_OPTIONS -lA'
# Siguren li si
 alias rm='rm -i'
#
 alias cp='cp -i'
#
 alias mv='mv -i'
#
 alias less="less -I -R"
#
#
 alias grep="grep --color=auto"
#
 export EDITOR=vim

function apt-search()
{
search=`apt-cache search $1 | awk -F" " '{print $1}'`

for i in $search;
do
if(dpkg -l | grep $i > /dev/null )
then
echo -e "Package: \e[00;36m`apt-cache show $i | grep -m 1 Section | awk -F" " '{print $2}'`/$i\e[00m"
echo -e "\e[00;32m\t* Installed \n\t\t>>> `apt-cache show $i | grep -m 1 Version`\e[00m"
echo -e "\e[00;32m\t\t>>> `apt-cache show $i | grep -m 1 Size`\e[00m\n"
else
echo -e "Package: \e[00;36m`apt-cache show $i | grep -m 1 Section | awk -F" " '{print $2}'`/$i\e[00m"
echo -e "\e[00;31m\t! Not installed. \e[00m"
echo -e "\e[00;32m\t\t>>> Available `apt-cache show $i | grep -m 1 Version` \e[00m"
echo -e "\e[00;32m\t\t>>> `apt-cache show $i | grep -m 1 Size`\e[00m\n"
fi
done
}

function apt-depend()
{
dep=`LC_ALL=C apt-cache depends $1 | grep Depends | awk -F" " '{print $2}'`

echo -e "\e[00;32m>>> \e[00;36m`apt-cache show $1 | grep -m 1 Section | awk -F" " '{print $2}'`/$1 \e[00;32m<<<\e[00m\n"
for i in $dep ;
do
if (dpkg -l | awk -F" " '{print $2}' | grep -x $i > /dev/null)
then
if(apt-cache show $i > /dev/null)
then echo -e "\e[00;32m>>> \e[00;36m`apt-cache show $i | grep -m 1 Section | awk -F" " '{print $2}'`/$i\e[00m"
fi
echo -e "\t\e[00;32m * Installed\e[00m"
echo -e "\t\t\e[00;32m>>> `apt-cache show $i | grep -m 1 Version`\e[00m\n"
else
if(apt-cache show $i > /dev/null)
then echo -e "\e[00;32m>>> \e[00;36m`apt-cache show $i | grep -m 1 Section | awk -F" " '{print $2}'`/$i\e[00m"
fi
echo -e "\t\e[00;31m ! Not installed\e[00m"
echo -e "\t\t\e[00;32m>>> Available `apt-cache show $i | grep -m 1 Version`\e[00m\n"
fi
done
}

#by BADATA

# Colors

Black="$(tput setaf 0)"
BlackBG="$(tput setab 0)"
DarkGrey="$(tput bold ; tput setaf 0)"
LightGrey="$(tput setaf 7)"
LightGreyBG="$(tput setab 7)"
White="$(tput bold ; tput setaf 7)"
Red="$(tput setaf 1)"
RedBG="$(tput setab 1)"
LightRed="$(tput bold ; tput setaf 1)"
Green="$(tput setaf 2)"
GreenBG="$(tput setab 2)"
LightGreen="$(tput bold ; tput setaf 2)"
Brown="$(tput setaf 3)"
BrownBG="$(tput setab 3)"
Yellow="$(tput bold ; tput setaf 3)"
Blue="$(tput setaf 4)"
BlueBG="$(tput setab 4)"
LightBlue="$(tput bold ; tput setaf 4)"
Purple="$(tput setaf 5)"
PurpleBG="$(tput setab 5)"
Pink="$(tput bold ; tput setaf 5)"
Cyan="$(tput setaf 6)"
CyanBG="$(tput setab 6)"
LightCyan="$(tput bold ; tput setaf 6)"
NC="$(tput sgr0)"       # No Color

# Functions
spin ()
{
echo -ne "$White-"
echo -ne "$LightGray\b|"
echo -ne "$LightGreen\bx"
sleep .02
echo -ne "$DarkGrey\b+$RC"
}

typetext1 ()
{
sleep .02
echo -ne "$LightGreen W"
sleep .02
echo -ne e
sleep .02
echo -ne l
sleep .02
echo -ne c
sleep .02
echo -ne o
sleep .02
echo -ne m
sleep .02
echo -ne e
sleep .02
echo -ne " "
sleep .02
echo -ne t
sleep .02
echo -ne o
sleep .02
echo -ne " "
sleep .02
echo -ne "$HOSTNAME $NC"
sleep .02
}
typetext2 ()
{
sleep .02
echo -ne "$LightGreen E"
sleep .02
echo -ne n
sleep .02
echo -ne j
sleep .02
echo -ne o
sleep .02
echo -ne y
sleep .02
echo -ne " "
sleep .02
echo -ne y
sleep .02
echo -ne o
sleep .02
echo -ne u
sleep .02
echo -ne r
sleep .02
echo -ne " "
sleep .02
echo -ne s
sleep .02
echo -ne t
sleep .02
echo -ne a
sleep .02
echo -ne y
sleep .02
echo -ne "! "
sleep .02
}

dots ()
{
sleep .5
echo -ne "$LightGreen ."
sleep .5
echo -ne .
sleep .5
echo -ne .
sleep .8
echo -ne "$DarkGrey done"
}

#Distribution
DISTRO="Unknown Distro"
DISTRO='Slackware'

memfree="`cat /proc/meminfo | grep MemFree | cut -d: -f2 | cut -dk -f1`";
memtotal="`cat /proc/meminfo | grep MemTotal | cut -d: -f2 | cut -dk -f1`";
memfreepcnt=$(echo "scale=5; $memfree/$memtotal*100" | bc -l);

# Welcome screen

clear;
echo -e "";
for i in `seq 1 15` ; do spin; done; typetext1; for i in `seq 1 15` ; do spin; done ;echo "";
echo "";
echo -ne "$DarkGrey Hello $LightGreen$USER $DarkGrey!";
echo ""; sleep .3;
echo "";
echo -ne "$DarkGrey Today is: $LightGreen`date`";
echo ""; sleep .3;
# echo -ne "$DarkGrey Last login:$LightGreen `last | grep $USER | awk '{print $4" "$6" "$5" "$9}'`$DarkGrey at$LightGreen `$
echo ""; sleep .3;
echo "";
echo -ne "$DarkGrey Loading system information"; dots;
echo ""; sleep .3;
echo "";
echo -ne "$DarkGrey Distro: $LightGreen $DISTRO";
echo "";
echo -ne "$DarkGrey Kernel: $LightGreen `uname -smri`";
echo "";
echo -ne "$DarkGrey CPU:   $LightGreen `grep "model name" /proc/cpuinfo | cut -d : -f2`";
echo "";
echo -ne "$DarkGrey Speed:  $LightGreen`grep "cpu MHz" /proc/cpuinfo | cut -d : -f2` MHz";
echo "";
echo -ne "$DarkGrey Load:   $LightGreen `w | grep up | awk '{print $10" "$11" "$12}'`";
echo "";
echo -ne "$DarkGrey RAM:    $LightGreen `cat /proc/meminfo | head -n 1 | awk '/[0-9]/ {print $2}'` KB";
echo "";
echo -ne "$DarkGrey Usage:  $LightGreen $memfreepcnt %"
echo "";
echo -ne "$DarkGrey IP:     $LightGreen bakalov.info";
echo "";
echo -ne "$DarkGrey Uptime: $LightGreen `uptime | awk {'print $3" "$4" "$5'} | sed 's/:/ hours, /' | sed -r 's/,$/ minutes/$
echo ""; sleep .3;
echo "";
for i in `seq 1 21` ; do spin; done; typetext2; for i in `seq 1 20` ; do spin; done ;echo "";
echo "" $NC;

# Fancy bash

PS1='\[$Blue\]\[$Yellow\]\u\[$Blue\]@\[$Yellow\]\h\[$Blue\]:\[$Red\]\w\[$Blue\]\$\[$NC\] '
#PS1="$LightBlue[$Red\u$LightBlue@$Red\H$LightBlue:$Red\w$LightBlue]$White$ "


 
http://mrejata.us
admin
За хора които работят с nano или pico
За целта е нужно редактирането на файла /etc/nanorc
за потребителите ползващи Дебиан не е нужно да го създават нужно е само да поставят кода.

Свали сорса  Код
pico /etc/nanorc



Свали сорса  Код
# Use auto-indentation
set autoindent

# Backup files to filename~
set backup

# Use cut to end of line with ^K by default
set cut

# Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

# Don't convert files from DOS/Mac format
set noconvert

# Don't follow symlinks when writing files
# set nofollow

# Don't display the help lists at the bottom of the screen
# set nohelp

# Don't wrap text at all
set nowrap

# Use smooth scrolling as the default
set smooth

# Use this spelling checker instead of the internal one.  This option
# does not properly have a default value.
set speller "aspell -c"

# Allow nano to be suspended with ^Z
# set suspend

# Use this tab size instead of the default; it must be greater than 0
# set tabsize 8

# Save automatically on exit, don't prompt
# set tempfile
# Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

# Disallow file modification, why would you want this in an rc file? ;)
# set view

#Color Syntax Highlighting
syntax "c-file" "\.(c|h)$"
color red "\<[A-Z_]{2,}\>"
color green "\<(float|char|int|void|static|const|struct)\>"
color brightyellow "\<(if|while|do|else|case|switch)\>"
color brightcyan "^#(  )*(define|include|ifn?def|endif|elif|else|if)"
color brightyellow "<[^=       ]*>" ""(.|[^"])*""
color brightyellow start=""(\\.|[^\"])*\\( |   )*$" end="^(\\.|[^\"])*""
color brightblue "//.*"
color brightblue start="/\*" end="\*/"

syntax "HTML" "\.html$"
color blue start="<" end=">"
color red "&[^;        ]*;"

syntax "TeX" "\.tex$"
color green "\\.|\\[A-Za-z]*"
color magenta "[{}]"
color blue "%.*"

syntax "mutt"
color green "^>.*"

syntax "php" ".*/*.php$"
color brightwhite "\{|\}|\."
color red "('[^']*')"
color red "\"[^\"]*\""
color brightblue "(\$([[:alpha:]_]|->)*)"
color brightgreen "((\$(([[:alpha:]_0-9])+\->)+)[[:alpha:]_0-9]+\()"
color  " (if|else if|else|return|case|break)"
color  "\|\||\?|!|\||&&|=|;|\(|\)"
color red "false|true"
color brightwhite "[[:space:]]+debug|[[:space:]]+echo|\$this\->debug"
color cyan "//.*"
color cyan start="/\*" end="\*/"

syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
color cyan "^\.ds [^ ]*"
color cyan "^\.nr [^ ]*"
color brightmagenta "\\."
color brightmagenta "\\f."
color brightmagenta "\\f\(.."
color brightmagenta "\\s(\+|\-)?[0-9]"
color cyan "(\\|\\\\)n."
color cyan "(\\|\\\\)n\(.."
color cyan start="(\\|\\\\)n\[" end="]"
color brightgreen "^\. *[^ ]*"
color  "^\.\\\".*$"
color green "(\\|\\\\)\*."
color green "(\\|\\\\)\*\(.."
color green start="(\\|\\\\)\*\[" end="]"
color brightred "\\\(.."
color brightred start="\\\[" end="]"
color brightcyan "\\\\\$[1-9]"

syntax "perl" "\.p[lm]$"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efi$
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|i$
color cyan start="[$@%]" end="( |\\W|-)"
color  "".*"|qq\|.*\|"
color white "[sm]/.*/"
color white start="(^use| = new)" end=";"
color green "#.*"
color yellow start="<< 'STOP'" end="STOP"

syntax "Java source" "\.java$"
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|$
color red ""[^"]*""
color yellow "<(true|false|null)>"
color blue "//.*"
color blue start="/\*" end="\*/"
color brightblue start="/\*\*" end="\*/"

syntax "nanorc" "[\.]*nanorc$"
color white "^ *(set|unset).*$"
color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingd$
color brightwhite "^ *syntax [^ ]*"
color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
color white "^ *color\>.*"
color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
color magenta "^ *color\>"
color green "^#.*$"

syntax "bash" "\.sh$"
color brightblack "#.*"
color brightyellow "\(" "\)" "\{" "\}"
color red "\<[A-Z_]{2,}\>"
color red "[\$\*\'\`\|\=]"
color brightblue "\[.*\]"
color green "\<-e\>" "\<-d\>" "\<-f\>" "\<-r\>" "\<-g\>" "\<-u\>" "\<-u\>" "\<-w\>" "\<-x\>" "\<-L\>"
color green "\<-eq\>" "\<-ne\>" "\<-gt\>" "\<-lt\>" "\<-ge\>" "\<-le\>" "\<-s\>" "\<-n\>" "\<-z\>"
color brightwhite "\.*"




Ето и снимка.
mrejata.net/images/snapshot6.png
Редактирана от admin на 24-11-2015 12:38
 
http://mrejata.us
FAUS
Много полезна информация Smile Cool
 
https://mrejata.net
admin
FAUS писа:
Много полезна информация Smile Cool


Пробва ли е вече
И на мен ми харесва
 
http://mrejata.us
FAUS
Дам. Пробвах, какво става с тебе требе да приказвам с теб за нещо. Smile Cool
 
https://mrejata.net
Отидете до форум
Вход
Потребител

Парола



Не сте потребител?
Натиснете тук за да се регистрирате.

Забравихте паролата си?
Поискате си нова тук.
Downloads

New Downloads

NAVIGON-Europe ...
NAVIGON Europe ...
NAVIGON Europe ...
NAVIGON Europe ...
µTorrent 3.4.1 ...
BitTorrent 7.9....
ProgDVB 7.04.2 ...
ProgDVB 7.04.2 ...
Wine 1.7.17
sakis3g
Wise Disk Clean...
DAEMON Tools Li...
opam
TurboFTP 6.30 B...
Skype 6.3.73.10...
FileZilla 3.7.0...
ChrisTV 5.75
BSPlayer Pro 2....
Rotativki
SquirrelMail + ...

Top 10 Downloads

n-Track Studio ... [7578]
Super MP3 Downl... [7417]
Registry Mechan... [7394]
Microsoft Secur... [7346]
Hiren`s v10.0.9 [6952]
K-Lite Mega Cod... [6489]
Rotativki [6452]
BitComet 1.21 F... [6394]
Slax + Hiren's ... [4473]
WinSetup From USB [4121]
Ново от Калдата