13 Januari 2018

Cara Mempercantik Terminal Kali Linux

Tags

Cara Mempercantik terminal kali linux - kali ini saya akan berbagi cara mempercantik tampilan terminal kali linux dengan 3 cara yang berbeda, sebelumnya saya bosan dengan tampilan bawaannya

Terminal Linux biasanya Tampilannya polos dan tidak ada hiasan - hiasan kaya gitulah, kali ini saya memposting cara mempercantik tampilan terminal kali linux agar lebih bagus, dan tidak bosan saat di lihat tentunya.


Ok langsung saja mauk ke tutorial cara untuk Mempercantik Terminal:

1. Cara pertama

Cara yang pertama ini sangat mudah dan simpel, ok dari pada penasaran langsung saja baca tutorialnya.

  • Masuk ke terminal dan install figlet, dengan mengetik
apt-get install figlet

  •  Setelah penginstalan selesai, ketik
gedit .bashrc

  • Setelah itu akan otomatis masuk text editor yang berisi tulisan, tulisan itu adalah .bashrc (tampilan terminal) deafult kamu. Tambahkan tulisan di bawah pada bagian paling ahir
figlet "4hmad.site"

  • Simpan dan lihat terminal kamu
note*tulisan yang saya warnai merah bisa kamu ganti.


2. Cara yang ke dua

Di cara yang ke dua lebih banyak dari pada cara yang pertama, tentunya lebih bagus ya dari cara yang pertama.
  • Pastikan figlet sudah terinstal
  • instal cowsay, dengan cara masuk terminal dan ketikkan
apt-get install cowsay

  • Jika penginstalan cowsay sudah selesai, ketik "gedit .bashrc"
  • Bila sudah masuk ke text editor yang berisi tulisan, seperti yang sudah saya sebutkan di atas yakni tulisan itu adalah .bashrc (tampilan terminal) deafult kamu. Sebaiknya di salin dan di simpan untuk cadangan bila kamu ingin ganti ke tampilan deafult
  • Copy script / tulisan di bawah dan pastekan di text editor tersebut




# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
#if ! shopt -oq posix; then
#  if [ -f /usr/share/bash-completion/bash_completion ]; then
#    . /usr/share/bash-completion/bash_completion
#  elif [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#  fi
#fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
        # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
   /usr/bin/python /usr/lib/command-not-found -- "$1"
                   return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
   /usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"
                   return $?
else
   printf "%s: command not found\n" "$1" >&2
   return 127
fi
}
fi
/usr/games/cowsay -f eyes "4hmadtutorial.blogspot.com"
echo
figlet "4hmad.site"
echo "=================================================================== "
echo -ne "${lightgreen}Today is:\t\t${red}" `date`; echo ""
echo -e "${lightgreen}Kernel Information: \t${red}" `uname -smr`
export PS1="\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;31m\]\w \[\033[1;36m\]\\$ \[\033[0m\]";


  • Simpan, keluar dan lihat hasilnya
note*tulisan yang saya warnai merah bisa kamu ganti.


3. Cara yang ke tiga

Pada cara yang ke tiga ini sama seperti cara yang ke dua, namun berbeda pada scrip, ya langsung saja.
  • Pastikan kamu sudah menginstall figlet dan cowsay
  • Masuk terminal dan ketikkan
gedit .bashrc

  • Setelah masuk ke text editor, copy script di bawah dan pastekan ke text editor tersebut

#!/bin/bash
#http://myaspirasi.com/
#http://myaspirasi.com/
#Kujungannya gan :D

function pre_prompt {
newPWD="${PWD}"
user="whoami"
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
datenow=$(date "+%a, %d %b %y")
let promptsize=$(echo -n "┌($user@$host ddd., DD mmm YY)(`date \"+%H:%M\"`)┐" \
                 | wc -c | tr -d " ")
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ]
do
    fill="${fill}─"
        let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
then
    let cutt=3-${fillsize}
    newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
fi

}

PROMPT_COMMAND=pre_prompt

export black="\[\033[0;38;5;0m\]"
export red="\[\033[0;38;5;1m\]"
export orange="\[\033[0;38;5;130m\]"
export green="\[\033[0;38;5;2m\]"
export yellow="\[\033[0;38;5;3m\]"
export blue="\[\033[0;38;5;4m\]"
export bblue="\[\033[0;38;5;12m\]"
export magenta="\[\033[0;38;5;55m\]"
export cyan="\[\033[0;38;5;6m\]"
export white="\[\033[0;38;5;6m\]"
export coldblue="\[\033[0;38;5;33m\]"
export smoothblue="\[\033[0;38;5;111m\]"
export iceblue="\[\033[0;38;5;45m\]"
export turqoise="\[\033[0;38;5;50m\]"
export smoothgreen="\[\033[0;38;5;42m\]"
export myred="\[\033[01;31m\]"


case "$TERM" in
xterm)
   PS1="$myred┌─[$green\u@\h \$(date \"+%a, %d %b %y\")$myred]─\${fill}[$green\$(date \"+%H:%M\")\
$myred]──┐\n$myred└─[$green\$newPWD$myred]─>$white "
   ;;
screen)
   PS1="$white┌─[$myred\u@\h \$(date \"+%a, %d %b %y\")$white]─\${fill}[$myred\$(date \"+%H:%M\")\
$white]──┐\n$white└─[$myred\$newPWD$white]─>$white "
   ;; 
   *)
   PS1="┌─(\u@\h \$(date \"+%a, %d %b %y\"))─\${fill}─(\$newPWD\
)─┐\n└─(\$(date \"+%H:%M\") \$)─> "
   ;;
esac

# bash_history settings: size and no duplicates and no lines w/ lead spaces
exportHISTCONTROL="ignoreboth"
export HISTSIZE=1024

# aliases #############################################

# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'

# some more ls aliases
alias ll='ls -lhX'
alias la='ls -A'
alias ldir='ls -lhA |grep ^d'
alias lfiles='ls -lhA |grep ^-'
#alias l='ls -CF'

# To see something coming into ls output: lss
alias lss='ls -lrt | grep $1'

# To check a process is running in a box with a heavy load: pss
alias pss='ps -ef | grep $1'

# usefull alias to browse your filesystem for heavy usage quickly
alias ducks='ls -A | grep -v -e '\''^\.\.$'\'' |xargs -i du -ks {} |sort -rn |head -16 | awk '\''{print $2}'\'' | xargs -i du -hs {}'

# cool colors for manpages
alias man="TERMINFO=~/.terminfo TERM=mostlike LESS=C PAGER=less man"

##########################################################
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
   . /etc/bash_completion
fi
   figlet "4hmad.site"

  • Simpan dan lihat hasilnya
note*biasa, tulisan yang saya warnai merah bisa di ganti

Nah itulah beberapa cara mempercantik terminal linux, terutama kali linux karena di sini saya menggunakan kali linux.

Cukup segini tutorial kali ini dan jangan lupa mampir ke postingan yang lainnya. Ets, selain mempercantik tampilan terminal kali linux, di blog ini juga ada beberapa cara mempercantik terminal termux.

Termux adalah terminal pada android, sama seperti terminal pada linux, namun dapat di operasikan di android. Untuk penjelasan lebih lengkap dapat masuk postingan yang ini tentang termux dan download termux

Baca juga cara mempercantik terminal termux

2 komentar

Wah panjang sekali bash scriptnya. Bisa untuk pengguna Linux Mint?


EmoticonEmoticon