Tag Info

New answers tagged

0

Also tree has an option to force colors on: tree -C | less -r And so on for ls: ls -lR --color | less -r


0

I'm not sure if this is exact answer, but at http://linuxcommand.org/lc3_adv_tput.php I found several functions testing tput for colorizing BASH. I hope it helps. #!/bin/bash echo "tput colors test" echo "================" echo echo "tput setaf/setab [0-9] ... tput sgr0" echo for fg_color in {0..7}; do set_foreground=$(tput setaf $fg_color) for ...


0

While it's not that hard to replicate, your screenshot likely came from tldp.org; the bottom of that page contains a script that outputs the table you see: To help myself remember what colours are available, I wrote a script that output all the colours to the screen. Daniel Crisman has supplied a much nicer version which I include below: #!/bin/bash # # ...


2

This has nothing to do with bash, it is purely an effect of the terminal's behavior, specifically scroll. When you reach the bottom of the screen, and start to type on the next line, the terminal creates a new blank line by pushing everything up one line. (In older terminals this destroys the top line. In newer terminals the top line is just pushed into the ...


1

Add this to last line of your ~/.bashrc: unalias ls and type source ~/.bashrc


0

To be pragmatic, you can always replace your ls with a small shell function that post-processes the output of ls. ls is often already an shell alias (to see use: type ls). Though you can use the same name for the function, it is preferable to use a slightly different name like ll to avoid any ambiguity. You soon get used to typing ll instead of ls. Here is ...


1

You might also want to take a look at lwatch: tail -f /var/log/syslog | lwatch --input -


2

The file you need to remove, or edit if you prefer, is: kateschemearc, which is usually located in a folder like $HOME/.config/ (the name of your .kde file may be .kde4 or something similar). Remove that file and all default colour schemes are restored.


6

The indexed color palette has the actual rendering open to interpretation - on actual hardware, there were different standards (especially brown vs. dark yellow, brown is more useful and nicer to look at). Just check out this: https://en.wikipedia.org/wiki/Color_Graphics_Adapter On terminal emulators, it depends on the configuration. Most emulators have a ...


2

I found the answer after I posted an issue on Oh-My-Zsh's repository. Color in tree rely on LS_COLORS, which is not set by Zsh by default; but my ~/.zshrc set the variable after I hit "use default setting" option, with a single line eval "$(dircolors -b)" which looks insignificant. After installing Oh-My-Zsh, the setting is moved to ...


2

In addition to looking at the file extension, source-highlight has some other ways of detecting the language. You could annotate your shell script files like this: The shabang line: put #!/bin/sh or #!/bin/bash on the first line of the file. Emacs-style file type annotations: add a comment like # -*- shell -*- or # -*- bash -*- in the file (doesn't need to ...


3

yaegashi has the right idea, although I would do it like this: cdc() { for path do command=(source-highlight --out-format=esc -o STDOUT --failsafe) case "${path##*/}" in .*) command+=(-s sh) ;; esac "${command[@]}" -i "$path" done } --failsafe acts like cat if the language can't be ...


2

Define your cdc function as cdc() { for fn do if [[ "${fn##*/}" == .* ]] then source-highlight --src-lang=sh --out-format=esc -i "$fn" else source-highlight --out-format=esc -i "$fn" fi 2> /dev/null || /bin/cat "$fn" done } for fn do is short for for fn in "$@"; do. ...


3

Specify -s sh only when $fn looks like a dot file. cdc() { for fn in "$@"; do OPTIONS="-f esc" case "${fn##*/}" in .*) OPTIONS="$OPTIONS -s sh" ;; esac source-highlight $OPTIONS -i "$fn" 2>/dev/null || \cat "$fn" done } alias cat=cdc You can add other custom file name matching rules in case.



Top 50 recent answers are included