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

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.

Related

How to enable 'gx' in Vim? Mine doesn't work anymore

I have tried wiping my .vimrc, uninstalling all plugins, updating Vim, trying different shells, etc. but I absolutely can't get 'gx' to work over a given URL. I have used it before and it worked fine, it even use to open up my finder directory if I 'gx'ed on a blank line. I tried running 'gx' over numerous URLs, above them, below them, adding "/" at the end, etc. Still no luck. I am simply at my wits end trying to figure out why it no longer works when it use to. Sometimes it will open a URL in a blank buffer with the buffer name equal to the URL and other times nothing happens. I would be grateful to anyone who actually knew what the hell is going on with this stupid thing.
I am on the latest version of OS X and have the latest version of Vim.
UPDATE
I found the answer to this question but still am not quite sure why it worked and my original approach didn't.
Original Approach
I installed iTerm2 and was forced to set Preferences >Profiles >General >Command >Command >/usr/local/bin/zsh -l. Even though I ran $ chsh -s /usr/local/bin/zsh and added /usr/local/bin/zsh to /etc/shells, I could not get >Profiles >General >Command >Login (radio button) to work.
I would either get an error message in Terminal or the window would simply flash and disappear in iTerm. However, running my profile command /usr/local/bin/zsh -l in my mind should have forced the shell to run in login mode (the same mode as my default) but it caused major issues in vim where I couldn't get any shell command or function that relied on shell commands to work (e.g :!ls, gx).
ANSWER
Moreover, I finally managed to get everything working perfectly after running chsh -s /bin/bash (e.g. back to its default). Suddenly, I was able to run both Terminal and iTerm with the radio button for Login checked and all my issues went away. It should be noted that I tried to chsh -s /usr/local/bin/zsh and received an error that I didn't receive the first time--something about a non-standard login shell.
This wasn't good enough though because I really wanted to use my Homebrew zsh (and bash) shells since they are more current. Finally, I found the answer, I ran sudo dscl . change /users/$USER UserShell /bin/bash /opt/local/bin/zsh and I was then able to leave the Login radio button checked and actually use -zsh for the first time without any issues.
NOW MORE QUESTIONS
My questions now are: 1.) Why didn't my original profile command, /usr/local/bin/zsh -l work as though it was my default Login shell? Aren't they the same (e.g. a login shell is a login shell)? 2.) If I update /etc/shells with /usr/local/bin/zsh why would I receive a "non-standard shell error"? 3.) I read the MAN page on dscl but don't understand how that actually changed my Login shell when chsh -s /new/shell/path didn't work? 4.) Does ANYBODY really know what the heck is going on here?!
If you are a moderator please let me know if I should break these questions up into different posts but this is sort of a big issue and I can't believe I am the only one who has had this problem as I couldn't find ANY Q & As that thoroughly explained what is going on. Thank you all in advance for your help!
I'm on OS X and running the following command in vim worked for me:
:let g:netrw_browser_viewer='open'
See also this similar answer for Fedora:
:let g:netrw_browsex_viewer="setsid xdg-open"
I had the exact same problem, and it ended-up getting resolved (+quite a few bonuses) from this small but effective plugin:
https://github.com/stsewd/gx-extended.vim
Adds support for partial URLs, markdown URLs, 'Plugin' -> github paths, etc. It is much better behaved than netrw.

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.

How to fix path variable in bash on Mac OSX Snow Leopard

This might be a noob question, but I need help. I screwed up my terminal by trying to alter my path variable using the following command:
$ sudo nano .profile
Before I did that, if I were to type:
$ echo $PATH
I would get: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
When I opened .profile in nano it told me that the file didn't exist. I figured that made sense, since I had never edited this file before. I proceeded to enter a path to a directory I was using for a php framework and saved the file.
After I saved the file, I noticed that none of my bash commands are working. Now I can't do anything from the terminal. I can't even edit .profile in nano because it says -bash: nano: command not found
I'm clearly new to working with the terminal. I feel completely lost. Please provide some guidance on how to restore the terminal to working condition.
Use absolute paths.
$ /usr/bin/sudo /usr/bin/nano .profile
If you add something to a path, never just do
PATH=/path/to/something
instead do
PATH=$PATH:/path/to/something
By the way, you shouldn't/don't have to use sudo to edit your own file, such as .profile. Use sudo only when you need to edit the file which doesn't to belong to your account.
I had the same problem!
The way I solved was writing the follow command in the terminal:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin
Hope it can be useful for you

Screen and Cygwin: no tab completion?

I'm having some problems working with my development environment. Specifically, after I invoke the screen utility from within Cygwin I lose the ability to do tab completion. Before I invoke screen however tab completion works just fine.
I messed around with setting different values for the TERM env variable (VT100, xterm etc) but without success. It must be something trivial but I have no idea anymore. Does StackOverflow have any suggestions for me?
when you issue 'screen' from inside cygwin it might put you in another shell like /bin/sh instead of /bin/bash (and bash is where you're getting the tab completion from).
To fix the problem you could edit your .screenrc file (found in your home directory) and add in this line:
shell bash
Then try running screen again and you should see tab completion work within this new window.
The problem is that bash needs to be run as a login shell in order to have tab completion in the default cygwin setup. If you run bash in a cygwin bash you won’t have tab completion either. To set screen to run bash in login mode, add this line to your ~/.screenrc file:
shell -bash
I had a similar problem with git autocompletion not working when using screen on a linux machine, but wasn't due to a different shell. I fixed it using this question: Git autocomplete in screen on mac os and doing the following:
Get the git autocompletion script
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -OL
why would you want that hanging around?
mv git-completion.bash .git-completion.bash
add this line to your ./bashrc
source ~/.git-completion.bash
Then in your terminal
source ~/.bashrc
That worked for me.
(I imagine after three years you've probably solved your problem, but I hope this helps someone else)

getting vi and rxvt to work in cygwin

I am trying to use rxvt on my cygwin w win XP but the terminal appears and disappears. What could be wrong? This is true for all except rxvt-native . I have tried a few commands found online but with no success. I include 2 I have tried:
start C:\cygwin\bin\rxvt.exe -sb -sl 3000 -fg gray -bg black -fn "Lucida Console-14" -e /bin/bash --login -i
.
path C:\cygwin\bin;%path%
ssh-agent rxvt -e bash --login -i
Another problem I am facing is trying to get vi to work in my cygwin bash shell. Setting term to xterm or vt100 does not work. Hitting enter, I see a string 78 or some other issue pops up. I have never modified my .inputrc.
My main issue was trying to get vi to work properly. I just found out that if I run
/etc/postinstall/terminfo.sh.done , I can now navigate properly in vi. The 78 (newline) M still appears but at least I can navigate in vi.
Feb 25 - This problem went away after a few windows updates. Would it make sense to ANSWER my question on the basis that this is longer reproducible?
Can't answer the first question, but have you tried invoking rxvt from its shortcut in the Cygwin folder of the start menu?
Regarding the second question, the TERM variable tells applications what terminal they're running in, so if you set it to 'xterm' while running in the Cygwin console (where normally TERM=cygwin), they'll be sending xterm control sequences that the Cygwin console doesn't understand. So basically: don't do that!
Btw, you might also be interested in Cygwin's mintty package, which is another terminal that doesn't need an X server. Installing it also creates a start menu shortcut in the Cygwin folder.
I would assume you need an X server running.
You could install Cygwin/X
One thing which may not have been clear was that the whole exercise was to get vi to work. vim did not work either at that time. But after some windows update, the problem went away. Closing it...

Resources