Files and folders in Cygwin look the same - cygwin

Does anyone know how to make files and folders look different in Cygwin?
Perhaps by bolding the folders or some other equivalent?

Nevermind. I found my solution in the ~/.bashrc file.
For anyone who comes to this post in the future, all you have to do is uncomment the following line: alias ls='ls -hF --color=tty' # classify files in colour

Related

How to move all files to subdirectories by extension name in the specified DIR directory?

How to move all files (except directories) to subdirectories by extension name in the specified DIR directory?
If I'm understanding your question correctly, globbing should help you. If you're going to be using linux for a while, I'd recommend reading up on it, as it makes using linux and bash much easier.
To directly answer your question, something like this should work:
mv *.<extension> <target directory>

Change colors on executable files in the terminal (or iTerm2)

How do I change it, so executable files don't have another color, compared to other files? I'm on macOS Sierra (10.12.6). It's the same, both in the regular Terminal:
... or in iTerm2:
It's frustating to look at. If i write chmod -x [FILENAME] then it disappears. But I don't want to change if the files are executable or not, - I want to change the color of executable files. I want my files to look like this (regardless of if it's executable or not):
I tried correcting Anshuman's answer, so it could help people with the potential same challenges. His answer pointed me in the right direction, but was pretty far from the answer to the question. So I'll post it here myself.
The LSCOLORS are set in your ~/.bash_profile (or ~/.zshrc-file, if you use Zshell) for your environment. On this page, then you can experiment a bit with the settings and see which letters changes which colors. It's in your current LSCOLORS that it's setting the color of your executable files to be another color. Here's how you find (and change) that color:
Go to your terminal and write:
echo $LSCOLORS
then it'll print out your current setup, which might be something along these lines:
Gxfxcxdxbxegedabagacad
If you then (in this case) change it to this:
GxfxcxdxDxegedabagacad
Then it would change the colors of the executable files. And what that change comes down to, is which color in your profile, it's pointing to:
set the LSCOLORS environment variable
create an alias for ls so that it shows colors by default
In your ~/.bash_profile add the following:
export LSCOLORS="EHfxcxdxBxegecabagacad"
alias ls='ls -lGH' <-----This shows in list format, follow symlinks colorized
Another way to handle this problem is to simply override "ls --color" altogether, I recently solved this problem with a simple awk script and shell wrapper called "cf".
Then you can create alias for ls like this:
alias ls='_(){ /bin/ls -F -1 -A "$#"|cf|column;};_'
See screenshots and get it from: GitHub
It also has a deb installer

How to use help cmd in Vim to view .txt files?

I'm using Vim 7.4 on Fedora 20. I unzipped all the .txt.gz files in /usr/share/vim/vim74/doc and when I try to use the help command in Vim's command line it gives an error saying E429: File "/usr/share/vim/vim74/doc/starting.txt.gz" does not exist. I did that because when I was using the help cmd before unzipping the files, it showed me some encrypted binary text. So, I thought that uzipping the filed might resolve the problem but, obviously, it didn't. Now, I don't know what to do? Can I configure the file extensions that help searches for in the /doc folder or something like that? What to do?
And yeah, I don't want to compress the files again. A way to resolve this problem without having to re-compress the files, is what I am looking for.
First, delete the old tags file:
rm /usr/share/vim/vim74/doc/tags
Then, run vim as root to regenerate help tags file:
sudo vim -c 'helptags /usr/share/vim/vim74/doc' +qall
Finally, fix vim's ability to read gz files for future convenience.

Referencing the HOME path in Cygwin aliases

I use a lot of aliases in my Cygwin .bash_profile as a way to cd to various lengthy network drives. I am also modifying this .bash_profile file frequently as new drives need to be accessed.
I'm trying to create an alias that will open my .bash_profile in a text editor and allow me to quickly edit it from anywhere. Let's use the following as an example:
alias editbash='subl ~/.bash_profile'
"subl" is another alias for the path to my Sublime Text executable.. this works fine.
My main issue is that when I execute this alias, it attempts to open a file at the following path:
C:\home\username\.bash_profile
... instead of...
C:\cygwin\home\username\.bash_profile
I have attempted to modify this alias to use the following:
alias editbash='subl /cygwin/home/username/.bash_profile'
This works, but only if I'm currently viewing something in my C: drive, which I am often not.
How can I update this alias to always reference my Cygwin user home directory, rather than the Windows home directory? Or, if it's easier, how can I always reference the C: drive in my latter example?
Try referencing the home directory as /cygdrive/c/cygwin/home/username
That should solve the problem.
You can edit you home variable in the /etc/passwd file. Use pwd to find out where you are. Then the tilde can point where you actually want it to.
The shellslash option seemed worth a try in spite of the warnings about it breaking things.
So before that, I tried a few different aliases in .bashrc - AND ONE SIMPLE THING WORKED by prepending a backslash:
alias vib='vi "\$HOME/.bashrc"'
... and works just as I wanted - Thanks!

Can I put something in in bashrc to hide text editor (~ extension) files?

I'd like to do ls without seeing all the ~ files generated by vim. Is it possible?
This is better solved from within vim, as opposed to bash.
Use
set backupdir=~/.backup,/tmp
to put all your ~ files in the ~/.backup directory. Change that directory to whatever you want. The /tmp means that it will act as a fallback to the ~/.backup directory.
If you don't want backup files to be generated at all, you can use
set nobackup
set nowritebackup
to disable it, but you will of course lose that functionality.
EDIT:
Although the above solution is still the one I recommend because you can do more with it, I just realized that ls has a -B option which will hide files ending with ~. I've aliased it myself, and never noticed. If you really want, you can alias ls -B and go with that.
EDIT v2.0:
As noted by Wesley, some platforms' ls command have different meanings for -B, some may not have it at all. I'm using the GNU ls, and it has had this switch for as long as I can remember.
Many editors use the ~ files to represent backup files. (I use this trick to hide the backup files from gedit.) To disable them from showing, add this command to your bashrc:
alias ls='ls --hide=*~'
Edit: Mac OS X ls does not appear to have this option, so it follows that BSD ls probably doesn't have it either. Ubuntu does have this option, so many Linux distributions probably do; check your manual pages. In addition, Mac ls appears to have a different -B, so consider this when using Sykora's advice.
You'll be sorrrrryyyy if you just hide them from ls. They'll still be there as far as grep and other tools are concerned except that now you can't see them. Moving them to /tmp is a much better way to go.
This problem is ESPECIALLY severe with .svn directories, which have all kinds of useless cr*p that you really don't want to edit. I don't know a solution to that one.
For Mac OS X:
brew install coreutils
echo "alias ls='/usr/local/bin/gls -B'" >> ~/.bashrc

Resources