web-dev-qa-db-fra.com

Clone de terminal Mac OS X pour Ubuntu

J'aimerais définir le thème Max OS X Terminal pour Ubuntu Terminal. J'aime beaucoup les polices et les couleurs. Voici à quoi ressemble le terminal Mac:

Source de l'image

Il y a peu de choses que je veux voir dans le terminal Ubuntu:

  • Je souhaite remplacer username@desktop:~/Dropbox$ par le nom d'utilisateur et le nom de l'ordinateur au format suivant: desktop:Dropbox username$

  • Je souhaite modifier la police du terminal pour qu'elle ressemble à celle du terminal Mac.

  • Je souhaite changer le jeu de couleurs pour qu'il ressemble au jeu de couleurs du terminal Mac.

Est-ce possible? Comment?


Notez que je ne veux pas changer le thème Ubuntu. J'utilise Unity avec le thème par défaut, mais je souhaite modifier uniquement les paramètres du terminal, car c'est l'application la plus utilisée par moi.

18
Ionică Bizău

Changer le style de l'invite

Pour modifier le format d'invite, ajoutez les lignes suivantes dans le fichier ~/.bashrc:

### Prompt style
export PS1="\033[0;33m\h:\W \u\$ \e[m"

Maintenant, le terminal ressemble à ceci:

Police de terminal

Intall Monaco police. Vous pouvez l'exécuter dans un terminal:

curl -kL https://raw.githubusercontent.com/cstrap/monaco-font/master/install-font-ubuntu.sh | bash

Avertissement : Vous pouvez avoir des problèmes avec cette police dans le navigateur. Ceci est discuté ici .

Puis définissez la police du terminal pour utiliser Monacao: allez à Edit -> Profile Preferences et changez la police:

Schéma de couleur

Enregistrez le contenu suivant dans un fichier XML:

<gconfentryfile>
  <entrylist base="/apps/gnome-terminal">
    <entry>
      <key>global/active_encodings</key>
      <schema_key>/schemas/apps/gnome-terminal/global/active_encodings</schema_key>
      <value>
        <list type="string">
            <value>
              <string>UTF-8</string>
            </value>
            <value>
              <string>current</string>
            </value>
        </list>
      </value>
    </entry>
    <entry>
      <key>global/confirm_window_close</key>
      <schema_key>/schemas/apps/gnome-terminal/global/confirm_window_close</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>global/default_profile</key>
      <schema_key>/schemas/apps/gnome-terminal/global/default_profile</schema_key>
      <value>
        <string>Default</string>
      </value>
    </entry>
    <entry>
      <key>global/profile_list</key>
      <schema_key>/schemas/apps/gnome-terminal/global/profile_list</schema_key>
      <value>
        <list type="string">
            <value>
              <string>Default</string>
            </value>
        </list>
      </value>
    </entry>
    <entry>
      <key>global/use_menu_accelerators</key>
      <schema_key>/schemas/apps/gnome-terminal/global/use_menu_accelerators</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>global/use_mnemonics</key>
      <schema_key>/schemas/apps/gnome-terminal/global/use_mnemonics</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>keybindings/close_tab</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/close_tab</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;w</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/close_window</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/close_window</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;q</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/copy</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/copy</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;c</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/detach_tab</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/detach_tab</schema_key>
    </entry>
    <entry>
      <key>keybindings/full_screen</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/full_screen</schema_key>
      <value>
        <string>F11</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/help</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/help</schema_key>
      <value>
        <string>F1</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/move_tab_left</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/move_tab_left</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;Page_Up</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/move_tab_right</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/move_tab_right</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;Page_Down</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/new_profile</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/new_profile</schema_key>
    </entry>
    <entry>
      <key>keybindings/new_tab</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/new_tab</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;t</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/new_window</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/new_window</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;n</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/next_tab</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/next_tab</schema_key>
      <value>
        <string>&lt;Control&gt;Page_Down</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/paste</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/paste</schema_key>
      <value>
        <string>&lt;Ctrl&gt;&lt;Shift&gt;v</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/prev_tab</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/prev_tab</schema_key>
      <value>
        <string>&lt;Control&gt;Page_Up</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/reset</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/reset</schema_key>
    </entry>
    <entry>
      <key>keybindings/reset_and_clear</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/reset_and_clear</schema_key>
    </entry>
    <entry>
      <key>keybindings/save_contents</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/save_contents</schema_key>
      <value>
        <string>disabled</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/set_terminal_title</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/set_terminal_title</schema_key>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_1</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_1</schema_key>
      <value>
        <string>&lt;Alt&gt;1</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_10</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_10</schema_key>
      <value>
        <string>&lt;Alt&gt;0</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_11</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_11</schema_key>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_12</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_12</schema_key>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_2</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_2</schema_key>
      <value>
        <string>&lt;Alt&gt;2</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_3</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_3</schema_key>
      <value>
        <string>&lt;Alt&gt;3</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_4</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_4</schema_key>
      <value>
        <string>&lt;Alt&gt;4</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_5</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_5</schema_key>
      <value>
        <string>&lt;Alt&gt;5</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_6</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_6</schema_key>
      <value>
        <string>&lt;Alt&gt;6</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_7</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_7</schema_key>
      <value>
        <string>&lt;Alt&gt;7</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_8</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_8</schema_key>
      <value>
        <string>&lt;Alt&gt;8</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/switch_to_tab_9</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_9</schema_key>
      <value>
        <string>&lt;Alt&gt;9</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/toggle_menubar</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/toggle_menubar</schema_key>
    </entry>
    <entry>
      <key>keybindings/zoom_in</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/zoom_in</schema_key>
      <value>
        <string>&lt;Ctrl&gt;plus</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/zoom_normal</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/zoom_normal</schema_key>
      <value>
        <string>&lt;Ctrl&gt;0</string>
      </value>
    </entry>
    <entry>
      <key>keybindings/zoom_out</key>
      <schema_key>/schemas/apps/gnome-terminal/keybindings/zoom_out</schema_key>
      <value>
        <string>&lt;Ctrl&gt;minus</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/allow_bold</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/allow_bold</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/alternate_screen_scroll</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/alternate_screen_scroll</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/background_color</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/background_color</schema_key>
      <value>
        <string>#0D0D19192626</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/background_darkness</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/background_darkness</schema_key>
      <value>
        <float>0.5</float>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/background_image</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/background_image</schema_key>
      <value>
        <string></string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/background_type</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/background_type</schema_key>
      <value>
        <string>solid</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/backspace_binding</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/backspace_binding</schema_key>
      <value>
        <string>ascii-del</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/bold_color</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/bold_color</schema_key>
      <value>
        <string>#000000000000</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/bold_color_same_as_fg</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/bold_color_same_as_fg</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/cursor_blink_mode</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/cursor_blink_mode</schema_key>
      <value>
        <string>system</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/cursor_shape</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/cursor_shape</schema_key>
      <value>
        <string>block</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/custom_command</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/custom_command</schema_key>
      <value>
        <string></string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/default_show_menubar</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/default_show_menubar</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/default_size_columns</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/default_size_columns</schema_key>
      <value>
        <int>80</int>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/default_size_rows</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/default_size_rows</schema_key>
      <value>
        <int>24</int>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/delete_binding</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/delete_binding</schema_key>
      <value>
        <string>escape-sequence</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/encoding</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/encoding</schema_key>
      <value>
        <string>current</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/exit_action</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/exit_action</schema_key>
      <value>
        <string>close</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/font</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/font</schema_key>
      <value>
        <string>Monaco Bold 10</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/foreground_color</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/foreground_color</schema_key>
      <value>
        <string>#D3D1D7D7CFCF</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/icon</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/icon</schema_key>
      <value>
        <string></string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/login_Shell</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/login_Shell</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/palette</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/palette</schema_key>
      <value>
        <string>#000000000000:#F5F579780000:#7373D2D11615:#D554C1D77F49:#40DAC851F332:#CECE5C5B0000:#C1C07D7C1110:#7373D2D11615:#262626262626:#EDEDD4D40000:#7373D2D11615:#EFEF29292929:#0000ABAAFFFF:#BAB99F9F0000:#E9E8B9B86E6E:#ADAD7F7FA8A7</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scroll_background</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scroll_background</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scroll_on_keystroke</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scroll_on_keystroke</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scroll_on_output</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scroll_on_output</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scrollback_lines</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scrollback_lines</schema_key>
      <value>
        <int>512</int>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scrollback_unlimited</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scrollback_unlimited</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/scrollbar_position</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/scrollbar_position</schema_key>
      <value>
        <string>right</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/silent_bell</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/silent_bell</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/title</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/title</schema_key>
      <value>
        <string>Terminal</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/title_mode</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/title_mode</schema_key>
      <value>
        <string>replace</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/update_records</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/update_records</schema_key>
      <value>
        <bool>true</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/use_custom_command</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/use_custom_command</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/use_custom_default_size</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/use_custom_default_size</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/use_system_font</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/use_system_font</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/use_theme_background</key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/use_theme_colors</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/use_theme_colors</schema_key>
      <value>
        <bool>false</bool>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/visible_name</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/visible_name</schema_key>
      <value>
        <string>Default</string>
      </value>
    </entry>
    <entry>
      <key>profiles/Default/Word_chars</key>
      <schema_key>/schemas/apps/gnome-terminal/profiles/Default/Word_chars</schema_key>
      <value>
        <string>-A-Za-z0-9,./?%&amp;#:_=+@~</string>
      </value>
    </entry>
  </entrylist>
</gconfentryfile>

Importez ensuite le jeu de couleurs en exécutant la commande suivante:

gconftool-2 --load terminal-color-scheme.xml

... où terminal-color-scheme.xml est le nom du fichier XML contenant le contenu ci-dessus.

Après cela, votre terminal ressemblera à celui ci-dessous:

25
Ionică Bizău

La plupart d’entre nous travaillons avec une invite Shell. Par défaut, la plupart des distributions Linux affichent le nom d’hôte et le répertoire de travail en cours. Vous pouvez facilement personnaliser votre invite pour afficher des informations qui vous sont chères. Le contrôle est contrôlé via une variable shell spéciale.

Pour afficher le paramètre d'invite actuel, utilisez

echo $PS1

La sortie sera comme ci-dessous, la votre serait la même si vous n'aviez pas joué auparavant

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

Pour modifier computername@username en Username, utilisez

PS1="User name : "

pour rendre ce changement permanent, utilisez edit /.bashrc by-

vi $HOME/.bashrc

et ajoutez la ligne -

export PS1="\e[0;31m[\u@\h \W]\$ \e[m"

Si vous souhaitez ajouter d'autres éléments tels que la date et tout à l'invite, faites-le moi savoir, je vais ajouter d'autres informations.

Votre deuxième question est sur le point de changer les polices, pour cet outil unity Tweak, soit à partir du centre logiciel Ubuntu, soit via un terminal -

Sudo apt-get install unity-Tweak-tool

et et changez la police et la taille selon vos désirs.

troisièmement, je n'ai aucune idée de changer le jeu de couleurs d'ubuntu en tant que MAC, je ne suis pas un fan de MAC, mais oui, vous pouvez changer la couleur de votre invite comme expliqué ci-dessous-

Pour définir une invite de couleur verte, tapez la commande suivante:

$ export PS1="\e[0;32m[\u@\h \W]\$ \e[m "

Modifiez le code de couleur selon vos souhaits dans le tableau ci-dessous.

COLOUR CODES

Et si vous souhaitez modifier la couleur de police complète du terminal, accédez à terminal - modification - préférence et utilisez la couleur de police personnalisée comme -

Terminal preference

C'est ce que tout ce que je sais, je ne sais pas comment vous pouvez le changer pour des motifs comme le montre votre question ..

Conseil supplémentaire - Pour que cela ressemble exactement à une utilisation mac http://www.noobslab.com/2013/10/mac-os-x-mbuntu-1310-pack-is-ready.html .

J'espère que cela vous a aidé.

2
Sukupa91

Pour l'invite (la partie que vous affichez en tant que bureau: Nom d'utilisateur Dropbox $), voir ce document dans le projet de documentation Linux: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html Il décrit comment définir la PS1 et comment définir les couleurs de l'invite (si vous le souhaitez également)

Pour la police, vous devez connaître la police utilisée par le terminal mac osx et l’installer (si ce n’est déjà fait dans Ubuntu), puis vous pouvez la définir à l’aide des préférences de Terminal.

Pour les couleurs des fichiers, vous devrez travailler avec dir_colors. Voici un lien vers la page de manuel: http://man7.org/linux/man-pages/man5/dir_colors.5.html

Avez-vous vu cela concernant un thème Mac pour Ubuntu? http://www.noobslab.com/2013/10/mac-os-x-mbuntu-1310-pack-is-ready.html

Oui, tout cela peut être fait, mais vous devrez faire une configuration.

Vous voudrez peut-être aussi vous habituer à utiliser un fichier .bashrc personnalisé. Voici un joli tutoriel: http://news.softpedia.com/news/How-to-Customize-the-Shell-Prompt-40033.shtml

Comme pour toute chose, conservez des copies de sauvegarde des fichiers originaux, au cas où.

1
John Kirchner