logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).

#1 27-10-2022 10:26:23

jettero
Membre
Lieu : Lausanne (suisse)
Distrib. : Debian GNU/Linux Bookworm
Noyau : Linux 5.18.0-4-amd64
(G)UI : gdm3
Inscription : 09-03-2016

[RÉSOLU] Terminal façon "Kali linux"

Bonjour à tous,

J'ai eu l'occasion de tester Kali et notamment le terminal de la dernière version. Ce terminal offre un tas de facilités et au niveau graphique je le trouve super.

J'ai fouillé un peu et j'ai vu qu'on pouvait modifier le fichier ~/.bashrc pour changer le look de son terminal

Après quelques recherches, je ne trouve toujours pas un script qui donnerait l'apparence et les fonctionnalités que j'ai vues sur le terminal Kali.

En gros, pour ne pas mettre une image sur le forum, l'invite de commande se présente sur 2 lignes reliées entre-elles.

Aussi, quand tu tapes les commandes il te les affiche en gris avant de les confirmer.

Bref, si qqun a une idée !

Merci

Dernière modification par jettero (27-10-2022 19:28:23)

Hors ligne

#2 27-10-2022 11:59:22

otyugh
CA Debian-Facile
Lieu : Quimperlé/Arzano
Distrib. : Debian Stable
Inscription : 20-09-2016
Site Web

Re : [RÉSOLU] Terminal façon "Kali linux"

Sous Kali, fait un

echo $PS1



et copie-le ici pour en faire profiter les autres cool


virtue_signaling.pngpalestine.png

En ligne

#3 27-10-2022 13:12:45

arpinux
CA Debian-Facile
Lieu : Montréal d'aude
Distrib. : nakeDeb
Noyau : Linux 6.1 amd64
(G)UI : sway - i3wm - fluxbox
Inscription : 30-06-2016
Site Web

Re : [RÉSOLU] Terminal façon "Kali linux"

oh la bonne idée !!
je saute sur l'occasion pour lancer un fil de discussion ad hoc sur le prompt big_smile => https://debian-facile.org/viewtopic.php?id=32576

nous sommes tous différents ... c'est notre point commun ...
Association Debian-Facile - Les cahiers du débutant - ISO Debian-Facile - 3hg - nakeDeb
GNU/Linux©2006-2024

En ligne

#4 27-10-2022 13:45:04

jettero
Membre
Lieu : Lausanne (suisse)
Distrib. : Debian GNU/Linux Bookworm
Noyau : Linux 5.18.0-4-amd64
(G)UI : gdm3
Inscription : 09-03-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

Voilà le retour :

%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n㉿%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]
└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset}




Où faudrait-il mettre cette commande ?

Du moment que j'étais sur Kali, j'ai aussi profité de copier le fichier .bashrc dans son ensemble. Ensuite sur Debian, j'ai fait un backup de mon fichier et j'ai remplacé l'original avec les commandes de celui de Kali.

Bon d'un point de vue esthétique, c'est pas mal, mais par contre, ça ne me remet pas les commandes en gris que j'ai déjà tapées.

Peut-être est-ce un réglage dur l'application ?

Dernière modification par jettero (27-10-2022 14:05:09)

Hors ligne

#5 27-10-2022 14:16:59

otyugh
CA Debian-Facile
Lieu : Quimperlé/Arzano
Distrib. : Debian Stable
Inscription : 20-09-2016
Site Web

Re : [RÉSOLU] Terminal façon "Kali linux"

Ben normalement il suffit de faire un

PS1='letruc'



Mais le code marche pas chez moi, probablement parce que c'est pour un autre shell que bash ?

echo $SHELL




Bon d'un point de vue esthétique, c'est pas mal, mais par contre, ça ne me remet pas les commandes en gris que j'ai déjà tapées.


Je connais pas.

Dernière modification par otyugh (27-10-2022 14:18:18)


virtue_signaling.pngpalestine.png

En ligne

#6 27-10-2022 15:06:55

Croutons
Membre
Distrib. : Debian12
Noyau : Linux 6.1.0-13-amd64
(G)UI : Fluxbox(NakeDeb)
Inscription : 16-12-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

après tout dépend du terminal utilisé
y'en a qui gère des profils avec des palettes de couleurs qui change légèrement la couleur de PS1
et d'autre qui font appel au fichier ~/.Xressources

jettero a écrit :

En gros, pour ne pas mettre une image sur le forum, l'invite de commande se présente sur 2 lignes reliées entre-elles.


kali-linux-terminal2.png

Dernière modification par Croutons (27-10-2022 17:04:50)


-->les cahiers du debutant<--      WikiDF-->Découvrir les principales commandes Linux<-- 
L' expérience, c'est le nom que chacun donne à ses erreurs. Oscar Wilde

En ligne

#7 27-10-2022 17:57:42

Croutons
Membre
Distrib. : Debian12
Noyau : Linux 6.1.0-13-amd64
(G)UI : Fluxbox(NakeDeb)
Inscription : 16-12-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

$PS1='┏━━${debian_chroot:+($debian_chroot)} \e[01;32m\u\e[m@\e[0;36m\h\e[m \e[01;34m\w\e[m\n┖─$'


sa marche pas mal
c'est des caractères spéciaux filets je pense, il suffit de passer la souris sur le symbole pour avoir le code
https://fr.wikipedia.org/wiki/Table_des … t%C3%A8res

Dernière modification par Croutons (27-10-2022 18:14:07)


-->les cahiers du debutant<--      WikiDF-->Découvrir les principales commandes Linux<-- 
L' expérience, c'est le nom que chacun donne à ses erreurs. Oscar Wilde

En ligne

#8 27-10-2022 19:01:25

jettero
Membre
Lieu : Lausanne (suisse)
Distrib. : Debian GNU/Linux Bookworm
Noyau : Linux 5.18.0-4-amd64
(G)UI : gdm3
Inscription : 09-03-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

Bien vu il s'agit de zsh et pas de bash.

Et pour le truc qui affiche les commandes en gris dernièrement tapées, ça donne ça :

file-R01762c66f5bfc8d1127b9ab6648f86bd

J'ai commencé à taper "apt" et il colle derrière en gris la suite de la commande. Je trouve ça pratique.

Bon, j'ai donc installé zsh, il est dans les dépôts.

Après j'ai ouvert mon terminal et je suis passé en zsh et j'ai copié le lien commençant par SP1= le truc wink

Mais ça n'est pas encore ça.

file-Rbc13771ce7210a6bcd1d13f5c672382e

Bon ok, mes couleurs sont un peu glauques, mais c'est pour montrer que :

1) l'invite de commande n'a pas le même look que la première image qui est tirée de Kali directement et
2) j'ai retapé "sudo apt..." mais il ne m'affiche pas la suite de la commande en gris comme l'image du haut.

Je continue de chercher....

D'ailleurs comme zsh n'utilise pas le même fichier de conf que .bashrc il doit y avoir un moyen de copier le fichier de conf depuis kali et de le mettre sur debian, non ?

Dernière modification par jettero (27-10-2022 19:04:37)

Hors ligne

#9 27-10-2022 19:17:09

jettero
Membre
Lieu : Lausanne (suisse)
Distrib. : Debian GNU/Linux Bookworm
Noyau : Linux 5.18.0-4-amd64
(G)UI : gdm3
Inscription : 09-03-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

Bon j'ai tenté de copier le fichier .zshrc de kali et l'installer sur ma deb...

Bon, le look ça y est ! Mais la fonction que je trouve super, non... il y a peut-être un plugin pour ça

Je cherche encore...

Hors ligne

#10 27-10-2022 19:20:30

Croutons
Membre
Distrib. : Debian12
Noyau : Linux 6.1.0-13-amd64
(G)UI : Fluxbox(NakeDeb)
Inscription : 16-12-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

Ah ok , c'est une recherche dans l'historique
il y aurait pas fzf d'installé dans kali?

-->les cahiers du debutant<--      WikiDF-->Découvrir les principales commandes Linux<-- 
L' expérience, c'est le nom que chacun donne à ses erreurs. Oscar Wilde

En ligne

#11 27-10-2022 19:28:04

jettero
Membre
Lieu : Lausanne (suisse)
Distrib. : Debian GNU/Linux Bookworm
Noyau : Linux 5.18.0-4-amd64
(G)UI : gdm3
Inscription : 09-03-2016

Re : [RÉSOLU] Terminal façon "Kali linux"

EUREKA

Hum je m'emporte mais... ça y est ! En fait zsh offre une grande quantité de plugins, la liste est longue.

Mais une qui semble prisée et que je cherchais est un paquet qui s'installe depuis les dépôts : zsh-autosuggestions

Et cette fois c'est tout bon.

Il ne me reste plus qu'à fixer zsh comme système par défaut à la place de bash et le tour sera joué.

Hors ligne

#12 27-10-2022 21:08:47

otyugh
CA Debian-Facile
Lieu : Quimperlé/Arzano
Distrib. : Debian Stable
Inscription : 20-09-2016
Site Web

Re : [RÉSOLU] Terminal façon "Kali linux"

Alors je crois que c'est indiqué dans /etc/passwd
Par exemple

implijer:x:1000:1001:implijer:/home/implijer:/bin/bash


virtue_signaling.pngpalestine.png

En ligne

#13 27-10-2022 21:22:05

kawer
Membre
Lieu : Earth
Distrib. : Debian Stable
Noyau : Current
(G)UI : Xfce
Inscription : 08-10-2013

Re : [RÉSOLU] Terminal façon "Kali linux"

Bonsoir,

jettero a écrit :

EUREKA
Il ne me reste plus qu'à fixer zsh comme système par défaut à la place de bash et le tour sera joué.



Pour fixer le shell par défaut :

chsh


Mot de passe : ********
Changing the login shell for $USER
Enter the new value, or press ENTER for the default
   Login Shell [/usr/bin/bash]: /usr/bin/zsh
 



Kali semble utiliser zsh avec un framework genre ohmyzsh ?, leurs .zshrc :

# ~/.zshrc file for zsh non-login shells.
# see /usr/share/doc/zsh/examples/zshrc for examples

setopt autocd              # change directory just by typing its name
#setopt correct            # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt ksharrays           # arrays start at 0
setopt magicequalsubst     # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch           # hide error message if there is no match for the pattern
setopt notify              # report the status of background jobs immediately
setopt numericglobsort     # sort filenames numerically when it makes sense
setopt promptsubst         # enable command substitution in prompt

WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word

# hide EOL sign ('%')
export PROMPT_EOL_MARK=""

# configure key keybindings
bindkey -e                                        # emacs key bindings
bindkey ' ' magic-space                           # do history expansion on space
bindkey '^[[3;5~' kill-word                       # ctrl + Supr
bindkey '^[[1;5C' forward-word                    # ctrl + ->
bindkey '^[[C' forward-word                       # ctrl + ->
bindkey '^[[1;5D' backward-word                   # ctrl + <-
bindkey '^[[D' backward-word                      # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history    # page up
bindkey '^[[6~' end-of-buffer-or-history          # page down
bindkey '^[[Z' undo                               # shift + tab undo last action

# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case insensitive tab completion

# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups       # ignore duplicated commands history list
setopt hist_ignore_space      # ignore commands that start with space
setopt hist_verify            # show command with history expansion to user before running it
#setopt share_history         # share command history data

# force zsh to show the complete history
alias history="history 0"

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# 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, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  # We have color support; assume it's compliant with Ecma-48
  # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  # a case would tend to support setf rather than setaf.)
  color_prompt=yes
    else
  color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PROMPT=$'%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)──}(%B%F{%(#.red.blue)}%n%(#.?.㉿)%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
    RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'

    # enable syntax-highlighting
    if [ -f /home/placeDirectoryorUserNameHere/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && [ "$color_prompt" = yes ]; then
  # ksharrays breaks the plugin. This is fixed now but let's disable it in the
  # meantime.
  # https://github.com/zsh-users/zsh-syntax-highlighting/pull/689
  unsetopt ksharrays
  . /home/placeDirectoryorUserNameHere/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
  ZSH_HIGHLIGHT_STYLES[default]=none
  ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=red,bold
  ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
  ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
  ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
  ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
  ZSH_HIGHLIGHT_STYLES[path]=underline
  ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
  ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
  ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[command-substitution]=none
  ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[process-substitution]=none
  ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
  ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
  ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
  ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
  ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta
  ZSH_HIGHLIGHT_STYLES[assign]=none
  ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
  ZSH_HIGHLIGHT_STYLES[named-fd]=none
  ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
  ZSH_HIGHLIGHT_STYLES[arg0]=fg=green
  ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
  ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
  ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
  ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
  ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
  ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
  ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
    fi
else
    PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%# '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    TERM_TITLE='\e]0;${debian_chroot:+($debian_chroot)}%n@%m: %~\a'
    ;;
*)
    ;;
esac

new_line_before_prompt=yes
precmd() {
    # Print the previously configured title
    print -Pn "$TERM_TITLE"

    # Print a new line before the prompt, but only if it is not the first line
    if [ "$new_line_before_prompt" = yes ]; then
  if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
      _NEW_LINE_BEFORE_PROMPT=1
  else
      print ""
  fi
    fi
}

# enable color support of ls, less and man, and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
    alias diff='diff --color=auto'
    alias ip='ip --color=auto'

    export LESS_TERMCAP_mb=$'\E[1;31m'     # begin blink
    export LESS_TERMCAP_md=$'\E[1;36m'     # begin bold
    export LESS_TERMCAP_me=$'\E[0m'        # reset bold/blink
    export LESS_TERMCAP_so=$'\E[01;33m'    # begin reverse video
    export LESS_TERMCAP_se=$'\E[0m'        # reset reverse video
    export LESS_TERMCAP_us=$'\E[1;32m'     # begin underline
    export LESS_TERMCAP_ue=$'\E[0m'        # reset underline

    # Take advantage of $LS_COLORS for completion as well
    zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'

# enable auto-suggestions based on the history
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
    . /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    # change suggestion color
    ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi
 

Dernière modification par kawer (27-10-2022 21:32:55)


Songez à ce que vous avez été, à ce que vous êtes, et à ce que vous serez un jour, et vous deviendrez humbles. Saint Vincent de Paul
La maladie la plus constante et la plus mortelle, mais aussi la plus méconnue de toute société, est l’indifférence. Abbé Pierre
Carpe diem, quam minimum credula postero. Horace

Hors ligne

Pied de page des forums