Win 10 bash shell and highlighting of the directories in console - bash

I implemented bash shell into my windows 10 as "Bash on Ubuntu on Windows".
And now I just want to remove the highlight from folders in console.
Additionally I use bashIt library to change design of my console but I don't know how to change that hightlight :(

I find an answer and if somebody need it there is solution.
You need to add this :
export LS_COLORS=$LS_COLORS:'ow=1;34:';
into your .bashrc file
More information here :
http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors
or here :
https://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console

Related

Git Bash .sh Script on windows to change directory does not work. Basic change directory in .sh script [duplicate]

This question already has answers here:
How to run 'cd' in shell script and stay there after script finishes?
(7 answers)
Closed last year.
Trying to make a script to automate activating a virtual environment for my Django project. I am running 'BIT BASH' on the windows 10 operating system. I have a feeling Windows 10 may be where my issues lie. Could anyone confirm this?
Here is my script which I save as activatevirt.sh.
I run it by starting up the 'bit bash' command line program. Then to run the script,
I enter the line:
sh activatevirt.sh
Commands such as echo work, but for some reason file system navigation commands are what seem to fall apart. This is why I suspect the issue to be the fact I'm doing this in windows 10 whereas others trying to offer help may be running on a Unix system. Please consider this if offering a solution.
If someone could simply give a simple brief bit of code that does nothing more than to change the directory in Bit Bash using a .sh script, I would be very grateful as I need to automate much more than just this, but this is where I am currently stuck. Below here is the code which doesn't work atm!
cd c:
cd virt
cd scripts
source activate
whoami
Errors which show up: line 1 no such file or directory c:
I think you mean "git" bash? Try /C, or possibly /mnt/c, instead of c:.
You can use a single path too:
cd /C/virt/scripts
Or just source it without changing directory:
source /C/virt/scripts/activate
Note unix style (forward) slashes to separate directories, as opposed to Microsoft style backslashes (\).
There's also sh /C/virt/scripts/activatevirt.sh for example.

Need to update shell in PyCharm to zsh

Started taking the 'Programming for everyone' course on Coursera to learn python. Ive downloaded 2 text editors. Atom and Pycharm. When I open the terminal both say, "The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh."
Please understand I'm totally new. This is the first time I've ever used a text editor or terminal so don't know where to run this or how to straighten this out. Im using a 2015 MacBook Pro running 10.15.7Image is screenshot of editor and terminal in pycahrm im in.
Yeah, it sucks. I had the same problem with Pycharm, but this solution worked for me.
1- Change zsh to bash
$ /bin/bash
2 - Get the commands back like (cd, ls, clear ...)
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
3 - Get the profile back
. /etc/profile
After that your porfile will look like this "username:" instead of this "%n#%m %1~ %#"
One more thing, if you using mac, open your terminal and check preference. In the preferences go to General -> Shells open with -> if it is Default Login shell which means you are using zsh, you should change to Command (complete path): and add /bin/bash in the space below so that your default change to bash.
I hope it was useful for you, and for the people looking for answers. Cause, I wasted an hour looking for solution that JetBrain Pycharm and Apple couldn't provide.

Changing the VSCode integrated shell's prompt on MacOS X

Having just installed VScode I have noticed as it uses Bash by default on OSX, with the shell's default prompt of bash-3.2$; consequently, I cannot see the current working directory. It means having to type 'pwd' and 'ls' quite frequently which is obvious quite tedious.
I have tried changing the default shell in the settings to
"terminal.integrated.shell.osx": "/Applications/Utilities/Terminal.app"
or
"terminal.integrated.shell.osx": "/Applications/iTerm.app"
This doesn't seem to work, have I made a mistake here?
I would also like to know if I am limited to bash, can I configure it to display the working directory instead of simply bash-3.2$ ?
See this screenshot of how the VSCode integrated terminal looks by default
Thanks in advance!
I use Ubuntu, and only add the following lines to the end of ~/.bashrc:
if [ "$TERM_PROGRAM" = "vscode" ]; then
PS1='\$ '
fi
Try it and let me know if it works on your OS.
You can set your prompt to contain the current working directory by defining PS1 as follows:
PS1="\w $"
The $ is just some visual sugar. There all manner of things you can have your prompt display. Put the definition in your ~/.bashrc or ~/.profile for it to be set when you login.
Check out the Controlling the Prompt section of the GNU Bash manual for details.
If you are not accustomed to editing your bash init files you can do it with Visual Studio Code by going to View->Command Palette and execute the following command (one-time only):
Install 'Code' command in path
Then open the integrated terminal and type the following:
code ~/.bashrc
Then add the PS1 definition to the bottom of that file.

Textmate tutorial terminal mac-osx

I have installed Textmate editor on my terminal and I am looking for some tutorial to discover Textmate's command lines ? Does anyone has a some links ?
Best,
Newben
The textmate bin that is optionally installed for command line access is really nothing but a simple manner to open files in the OSX gui application.
That said, there are a few handy shortcuts. -w issues a "wait" while opening the file, thus following commands in a sequence will wait until the document is closed to execute. For example:
alias bashrc="mate -w ~/.bashrc; source ~/.bashrc"
That said, if you are looking for a good command set for using within the gui itself, let me know and I will fill in a list of handy commands (it has been my default editor for 6 years now).
Edit: Here are the beginnings of my TextMate docs. I currently have the Cheat Sheet in a state that should prove useful. I will be adding to it and writing up some more extensive docs in the near future.
TextMate Cheat Sheet
You can invoke it from the command line with:
mate path/to/file/you/want/to/edit.txt
You can use more than one file, space separated. To see more options do:
mate --help
This if you installed the commandline option. which you can also do from preferences at any time (its just a symlink)

Cygwin automatic script launch

Im trying to automatically run a script using Cygwin via CMD. I basically created a BAT file that goes to the directory and executes an .SH file. SH files are accosiated with Cygwin, and I tried something like "cygwin update.sh" in the command line. But all it really does is open Cygwin. I want Cygwin to automatically run the script file. Is there any easy way to do this, I've been trying to find but can't. Thank you!
You'll want to call the shell script with a particular shell, e.g. bash.
When having Cygwin open, call which bash to figure out where the binary is located. Cygwin also comes with tools that can convert paths between Cygwin and Win32 form, which is pretty helpful in cases like yours.
There is one other thing that may work, depending on your setup. There is an environment variable named PATHEXT which declares file extensions that are deemed "executable" by CMD. This can be used to your advantage, if Windows is configured so that the shell's "open" verb executes the correct shell for the file extension .sh (in your case).
Good luck.
From Cygwin Terminal, read man mintty. Try something like the following from a Windows Command Prompt:
c:\cygwin\bin\mintty --hold always --exec /cygdrive/c/path/to/bash/script.sh
I also found this!
http://rothmanshore.com/2011/01/26/kick-off-a-cygwin-script-from-a-windows-bat-file-with-a-different-working-directory/
I didn't quite understand it at first, but then it worked as I wanted it. Just if anyone knows, is there a way to make the script run without the CMD window open?? Thanks

Resources