The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Cygwin first run and a few aliases

Posted by jpluimers on 2016/04/06

Cygwin first run looks like this:

Copying skeleton files.
These files are for the users to personalise their cygwin experience.

They will never be overwritten nor automatically updated.

'./.bashrc' -> '/home/jeroenp//.bashrc'
'./.bash_profile' -> '/home/jeroenp//.bash_profile'
'./.inputrc' -> '/home/jeroenp//.inputrc'
'./.profile' -> '/home/jeroenp//.profile'

jeroenp@msmxp ~
$

It will copy some default files to your profile so you can modify them.

Since Cygwin will run ~/.bash_profile on logon, and that in turn starts ~/.bashrc (see below), I’ve modified the latter to run ~/.bash_aliases and bring those a bit in sync with my regular Mac machine:


# New user-defined bash aliases file
# Is executed from a modified .bashrc file
# .bashrc is executed from .bash_profile on cygwin
# on other systems, see http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
## This is the portion in .bashrc you need to edit in cygwin to enable .bash_aliases:
## Aliases
##
## Some people use a different file for aliases
## if [ -f "${HOME}/.bash_aliases" ]; then
## source "${HOME}/.bash_aliases"
## fi
alias ls-8601='ls -l -T'
alias ls-full-8601='ls -l –time-style=full-iso'
# octal file modes through http://stackoverflow.com/questions/1795976/can-the-unix-list-command-ls-output-numerical-chmod-permissions
alias lsmod='ls -al|awk '\''{k=0;s=0;for(i=0;i<=8;i++){;k+=((substr($1,i+2,1)~/[rwxst]/)*2^(8-i));};j=4;for(i=4;i<=10;i+=3){;s+=((substr($1,i,1)~/[stST]/)*j);j/=2;};if(k){;printf("%0o%0o ",s,k);};print;}'\'''
# silence the progress meter on Cygwin with -sS via http://stackoverflow.com/questions/7373752/how-do-i-get-curl-to-not-show-the-progress-bar
alias whatismyip='curl -sS http://whatismyip.akamai.com && echo'

view raw

.bash_aliases

hosted with ❤ by GitHub

cURL has some idiosyncrasies, for instance Cygwin shows the progress meter by default, but Mac OS X does not. I wanted to disable the cURL progress meter and you heed -sS for that.

ls doesn’t show you octal file modes by default, but chown and umask use them, so I’ve got the lsmod alias through stack-overflow.

Bash initialisation

Getting your bash initialisation right can be tough. There are lengthy discussions about which .bash* files run under what circumstances:

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.