Shell Configs: Difference between revisions

From Leo's Notes
This page was last edited on 8 March 2017, at 07:49.
m Text replacement - "</code>" to "}}"
removed old stuff, using git repo for configs now
Line 1: Line 1:
Below is my bash rc profile. You may copy my entire profile (wish vim and ssh keychain config) by running:
My shell configs can be viewed at https://git.steamr.com/leo/shell-configs.
 
  wget -O - http://leo.home.steamr.com/public/bash/update.sh | sh && exec bash
 
The line above will run my update script and reload bash. You may want to look at the script/archive that it downloads before running it though.
 
== Leo's .bashrc ==
 
<syntaxhighlight lang="bash" line start="1" enclose="div">
# .bashrc
#
# Solaris? Bail out using /bin/sh and skip all the
# bash fancinesses which applies mostly to linux.
#
if [ "`uname`" = "SunOS" ] ; then
    exec sh
fi
#
# The 'free' command doesn't exist in FreeBSD. Will
# run sysctl and show memory information instead.
#
if [ "`uname`" = "FreeBSD" ] ; then
    alias free="sysctl hw.physmem"
fi
#
# Alias vi to vim only if vim exists
#
command -v vim >/dev/null 2>&1
if [ $? -eq 0 ] ; then
    alias vi=vim
fi
#
# Aliases to ls and grep with nice options as default
#
alias ls="ls --color -F -h"
alias grep="grep --color=always --line-buffered"
</syntaxhighlight>
 
== Details ==
 
=== ls ===
The command:
ls --color=always -F -h
 
Flags:
--color[=auto]
Ensures that the output is colorized only to stdout. We do not want colors to go through pipes. The 'auto' value is implied as it is the default option.
-F
Prints a forward slash on directories.
-h
Prints sizes in human readable form
 
=== grep ===
The command:
grep --color=always --line-buffered
 
Flags:
--color=always
Ensures output is colored even if not going to stdout. Makes it nice when piping to {{code|more}} or {{code|less}}.
--line-buffered
As I usually deal with lines of texts, this makes piping multiple greps together work properly.  
 


The bootstrap command to load the configs is:
{{highlight|lang=terminal|code=
$ curl https://git.steamr.com/leo/shell-configs/raw/master/bootstrap.sh | sh && exec bash
}}





Revision as of 07:49, 8 March 2017

My shell configs can be viewed at https://git.steamr.com/leo/shell-configs.

The bootstrap command to load the configs is:

$ curl https://git.steamr.com/leo/shell-configs/raw/master/bootstrap.sh