Colorised highlighting in ls command - shell

When doing ls on my Ubuntu 15.10 machine, I get a colorised highlighting for directories.
How can I remove this highlighting?

I guess ls is an alias on Ubuntu - you can check that by executing alias ls in a terminal.
Try unalias ls in a terminal, afterwards you should see no coloring
Update:
To remove only the highlighting, edit your env. var. LS_COLORS e.g. to use the style of Ubuntu 14.04 execute LS_COLORS="$LS_COLORS:di=01;34"
For more details you could have a look at this answer.
Note: To add your alias again, execute alias ls='ls --color=auto' again

Related

How to echo OS X bash alias' command to terminal after calling it (like !cmd)?

In ~/.bash_profile aliases are defined, eg. alias vaguppro='vagrant up --provision
What I want is an echo of vagrant up --provision after typing vaguppro in the terminal.
Similar to when one types ls -hal in the terminal, then again type !ls. There's an echo of ls -hal in the terminal before execution.
SOME SOLUTIONS
vaguppro='vagrant up --provision'
alias vaguppro='echo $vaguppro && $vaguppro'
or andlrc's function solution below.
You may find this shortcut useful:
shell-expand-line (M-C-e)
Expand the line as the shell does. This performs alias and his‐
tory expansion as well as all of the shell word expansions. See
HISTORY EXPANSION below for a description of history expansion.
In other words, if you write vaguppro and press Ctrl+Alt+E in bash' default Emacs mode, it will expand aliases in the current line and turn it into vagrant up --provision. You can then press enter to run as usual.
!ls is a history expansion that searches your command history for ls and expands to the found command. As a bonus the expansion is also printed to the terminal.
To get the same behavior with your aliases, I think you would need to convert it to a function and print it manually:
vaguppro() {
echo "vagrant up --provision"
vagrant up --provision "$#"
}
I almost always recommend people using functions over aliases, unless it for adding colors for grep, ls, ...
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias cd..='cd ..'

Alias - command not found

I am trying create own aliases in terminal (Mac OS X Yosemite 10.10.1).
I added this lines:
alias apr='sudo apachectl restart'
alias setvhost='sudo nano /etc/apache2/extra/httpd-vhosts.conf'
alias setdns='sudo nano /etc/hosts'
to this files: (I know that lines should be only in one of the following files)
~/.profile
~/.bash_profile
~/.bashhrc
but after restart this aliases not working. After type apr i get zsh: command not found: apr
What I doing wrong?
Which file is best for set aliases?
EDIT/ANSWER:
I am using Oh My ZSH! so my default shell is ZSH and setting of symlinks is currently in ~/.zshrc
Looks like your default shell is zsh, not bash; zsh will not read .bashrc etc. at startup. Change your default shell to bash and retry.

Bash alias doesn't work in cygwin

Can someone please explain to me how to set up bash aliases? I am using cygwin on windows 8.
I added alias my_first_alias='git status' at the end of /.bashrc file. Typing my_first_alias into cygwin results in -bash: my_first_alias: command not found.
Trying to restart cygwin, running . .bashrc doesn't help with that.
The syntax of your alias command is correct and should be working as long as the alias command is actually being executed. It sounds like your .bashrc file is not being loaded when you start your bash shell. Make sure you have the following in your ~/.bash_profile file:
[[ -s ~/.bashrc ]] && source ~/.bashrc
Also make sure that the location of .bashrc and .bash_profile are in your home directory. Above you have referenced /.bashrc. I doubt "/" is your home directory. You can determine the location of your home directory from the shell by entering the command:
cd; pwd

Unable to successfully execute some commands in Cygwin

I installed Cygwin64 in my 64-bit Windows 7 machine. The following commands failed executing, however, by displaying the error messages below. Could you help providing a resolution please?
$ ll
-bash: ll: command not found
$ clear
-bash: clear: command not found
However, the command ls -l worked...
$ ls -l
total 0
Also i tried by un-commenting the following line in .bashrc file in my home dir -
# alias ll='ls -l'
But it didn't help either!
After you uncomment the alias, you should start a new Cygwin shell for it to take effect. The .bashrc file is actually a script that is sourced when bash starts.
clear is not a Cygwin (Unix) command. Just use Ctrl-L instead.

Colored files in Windows terminal via Cygwin?

I have Cygwin installed on my Win7 laptop and by editing my Windows path variable I'm able to get Linux commands in my Windows command terminal. My Question is there a way to get colored file output to transfer to the Windows command line?
Through Cygwin I obviously just alias my .bashrc file, but from Googling and checking Cygwin FAQs I can't find any way to reference that file in a Windows prompt. Although 'ls --color=auto' does work, is there a way to alias this through the Windows command line in any way?
#Al G - Yes. I already can use commands by editing my PATH to include the Cygwin /bin directory but I was wondering if there was a way to carryover aliases. However I was able to answer my own question:
Using naitve Windows aliasing via DOSKEY I can create an alias for ls to auto color file types like this:
DOSKEY ls=ls --color=auto
Put the alias in the .bash_profile (create if not present), not in .bashrc.
In my case:
alias ls='ls --color=auto -la'

Resources