Where can i find $PS that looks like this? - prompt

I have installed a Dracula Theme(https://draculatheme.com/iterm/) on my iTerm2, however, it doesn't seem to come with $PS parameters that give the exact same look for the prompt text with icons. I searched the internet to no avail...

The $PS parameters you see is a theme of Oh-My-Zsh.
Use command:zsh --version to see if you get zsh shell in your computer.
If it comes out the version, you have Zsh already.
Use command line to install Oh-My-Zsh:(You can go to the official website to geti the command line)
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Oh-My-Zsh is a tool to help you config Zsh.
Use command:chsh -s /bin/zsh to change your shell from Bash or other shells to Zsh.
Restart your terminal.
You will got Dracula Theme as you see in the picture, because it uses the default theme of Oh-My-Zsh.
You will find more themes of Oh-My-Zsh to change the $PS parameters. And you will learn how to edit the configuration files to change the $PS parameters.

Related

Changing shell from /bin/bash to /bin/zsh disappears programming tools?

I became very interested in Linux and wanted to customize my terminal with ZSH and powerlevel10k, but after changing and logging out, the programming tools disappears. I tried very hard to understand the reason but it did not work. I am not very familiar with the $PATH command and I do not know if it works or not. Thanks for your help.
image link => https://i.stack.imgur.com/BLeLe.jpg
Changing default shell to ZSH can help
first find the path of your ZSh shell.
type -a zsh
then change it
chsh -s /bin/zsh
now log out and log in again. One can close the Terminal app and reopen it.
After digging, I finally realized that the files that were installed with SNAP are not displayed. When I installed the file in Deb format, it became known.

Why does zsh not autocomplete custom created scripts when bash does?

I have a custom created script to change my apt sources in /home/USERNAME/Scripts. I have added this path to the secure_path variable in /etc/sudoers.
When I use bash to run my script as sudo it autocompletes just fine, but when using zsh it does not.
Because zsh doesn't have autocompletion without adding it to .zshrc.
Look for a good .zshrc with autocompletion, on GitHub for example (As a fan of Fish and Zsh, i would recommend this one)...
If .zshrc is empty/absent, it's because you probably installed zsh after creating your own user, and then ran chsh /path/to/zsh which will not give you .zshrc (in ~/).

Ubuntu Bash's Colors - How to disable colors & make it monochrome color instead?

I'm using Win10 with Ubuntu Linux installed with Bash.
I'm having trouble reading BASH multiple colors and want to switch it to monochrome color (2 colors) for easier reading.
I tried Google search and can't find the Ubuntu Bash command line for that.
If you only want to use two colors, we can add three lines to ~/.bashrc to achieve that.
We add three lines at the end of ~/.bashrc, like this:
$vi ~/.bashrc
rt LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
After add it completed, we exit this bash to flush it, then login this bash, here is my result:
Also, if you want to set other colors, we can follow this link to do it.
Here a similar case about you, please refer to it.
Update:
We can use CMD to open ubuntu bash, like this:

Where to place zsh autocompletion script on Linux?

After installing cheat (command cheat sheets from the command line), I tried to enable the autocompletion using the provided zsh script. However, I don't seem to find the correct location for the script.
So far
I fetch the cheat.zsh ;
copy it to ~/.oh-my-zsh/custom/plugins/cheat/_cheat.zsh ;
add the cheat to the plugins array in my ~/.zshrc ;
reload my shell.
Auto-completion doesn't happen when typing cheat d<TAB>.
Question
So where to place zsh auto-completion script on Linux?
I got this to work by adding cheat.zsh to the ~/.oh-my-zsh/plugins directory. Zsh checks to autoload functions on FPATH, so try:
echo $FPATH
and then either add to FPATH or move the file into a folder on the path.
This actually does a much better job of explaining it:
https://unix.stackexchange.com/questions/33255/how-to-define-and-load-your-own-shell-function-in-zsh
Let me try to help here.
I was trying something similar and this is how I was able to get it worked.
Below solution has verified with oh-my-zsh on debian distro [ubuntu]
Problem
> Your zsh isnt giving proper completion suggestions say [conda]
> This is what you get when you type in # conda tab
Solution
Find the completion script
one great location is https://github.com/clarketm/zsh-completions/tree/master/src
Download the file to completions folder [~/.oh-my-zsh/completions]
wget https://raw.githubusercontent.com/clarketm/zsh-completions/master/src/_conda ~/.oh-my-zsh/completions
Make sure the completions folder is listed under $fpath
print -l $fpath
What if its not listed
It should have normaly added with .oh-my-zsh.sh
If not append below to ~/.oh-my-zsh/oh-my-zsh.sh
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
source .zshrc
source ~/.zshrc
Execute compinit this will build ~/.zcompdump file for the functions
compinit
Troubleshooting
Due to conflicts the suggestions might not be shown try the following
rm -f ~/.zcompdump; compinit
# we are clearing the function dump stored by zsh, its safe zsh will rebuilt it.
Try source .zshrc
source ~/.zshrc
Try loggin out and login
Check the mapping in ~/.zcompdump
vi ~/.zcompdump
search for conda
[/conda]
you should see as below
'conda' '_conda'
Hope someone will find it useful, if so Happy to Help

How do I get Cygwin xterm to use bash and not sh?

Just updated cygwin to 1.7.28 on Windows 7.
Previously when starting X, the xterm would open with bash. For some reason it is now opening with sh?
What configuration changes do I need to make so that bash is the default shell again?
Not sure why this change happened.
The shortcut to open the xterm is the same as it was during my initial installation.
C:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe
But it still starts with the default shell set to sh.
I don't understand what changed.
My passwd file is the same as it was before.
It appears that everything starts fine with the standard shortcuts, but the X and xterm startups are not sourcing /etc/profile
I had /etc/shells already (upgraded from ??? to 1.7.29), might have been new with upgrade, but still didn't work (xterm running sh instead of bash). Changed permissions on bash to fix.
It was 700 changed to 755
chmod 755 /bin/bash
xterm seems to need the /etc/shells file to be present to work. Add an /etc/shells file with the following contents:
# /etc/shells: valid login shells
/bin/csh
/bin/sh
/bin/bash
/bin/tcsh
/usr/bin/csh
/usr/bin/sh
/usr/bin/bash
/usr/bin/tcsh
Chris
Run following command to set bash as default shell.
set shell=C:/cygwin/bin/bash
Note path C:/cygwin/bin/bash may vary.
(Removed answer regarding /etc/passwd)
I tried your command on my cygwin and got the same behavior, i.e. xterm loaded with /bin/sh.
However, if I simply ran startxwin.exe directly, I get an xterm loaded with /bin/bash.
Dunno if this works for you, but, worth a try.
I had the same issue with sh launching, but managed a different workaround after having issues with /etc/shells
I also wanted to get rid of the default white /bin/sh xterm that startxwin.exe created.
It turns out there's a .startxwinrc that startxwin.exe sources, so I had it do this:
# Launch prettier xterms with bash
. ./.profile
# Exit the cruddy white xterm launched by startxwin
exit
The dot-space syntax above is equivalent to "source" in bash, but is more shell-independent.

Resources