Check These Out
This replaces the current bash session with a new bash session, run as an interactive non-login shell... useful if you have changed /etc/bash.bashrc, or ~/.bashrc
If you have changed a startup script for login shells, use
$ exec bash -l
Suitable for re-running /etc/profile, ~/.bash_login and ~/.profile.
edit: chinmaya points out that
$ env - HOME=$HOME TERM=$TERM bash -s "exec bash -l"
will clear any shell variables which have been set... since this verges on unwieldy, might want to use
$ alias bash_restart='env - HOME=$HOME TERM=$TERM bash -s "exec bash -l"'
List everyone who committed to a particular project, listed alphabetically. To list by commits, add -n to the shortlog.
One of my favorite ways to impress newbies (and old hats) to the power of the shell, is to give them an incredibly colorful and amazing version of the top command that runs once upon login, just like running fortune on login. It's pretty sweet believe me, just add this one-liner to your ~/.bash_profile -- and of course you can set the height to be anything, from 1 line to 1000!
$ G=$(stty -g);stty rows $((${LINES:-50}/2));top -n1; stty $G;unset G
Doesn't take more than the below toprc file I've added below, and you get all 4 top windows showing output at the same time.. each with a different color scheme, and each showing different info. Each window would normally take up 1/4th of your screen when run like that - TOP is designed as a full screen program. But here's where you might learn something new today on this great site.. By using the stty command to change the terminals internal understanding of the size of your terminal window, you force top to also think that way as well.
# save the correct settings to G var.
$ G=$(stty -g)
# change the number of rows to half the actual amount, or 50 otherwise
$ stty rows $((${LINES:-50}/2))
# run top non-interactively for 1 second, the output stays on the screen (half at least)
$ top -n1
# reset the terminal back to the correct values, and clean up after yourself
$ stty $G;unset G
This trick from my [ http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html bash_profile ], though the online version will be updated soon. Just think what else you could run like this!
Note 1: I had to edit the toprc file out due to this site can't handle that (uploads/including code). So you can grab it from [ http://www.askapache.com/linux-unix/bash-power-prompt.html my site ]
Note 2: I had to come back and edit again because the links weren't being correctly parsed
Downloads Bluetack's level 1 IP blocklist in .p2p format, suitable for various Bittorrent clients.
Friday is the 5th day of the week, monday is the 1st.
Output may be affected by locale.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
Then pipe to 'xargs ls' for a familiar listing, possibly using find's -print0 and xarg's -0 options.
Perl alternative to list symlinks with a clumsy regexp filter: place the regex instead of he example 'libxml' and end it with a wildchar to see the results (previous cd on dir).
Is it possible change the '-l' test for '-d' and it will search for directories. [Same applies for -x and -X. See $(perldoc -f -x) for more tests].
I use it quite often when dealing with shared libraries...
Simple edit to work for OSX.
Now just add this to your ~/.profile and `source ~/.profile`