Handy aliases

37 views
Skip to first unread message

Carles Sentis

unread,
May 7, 2013, 2:57:28 PM5/7/13
to galwa...@googlegroups.com
Today at work came up with a new handy alias for bash to just display the directories in a folder

alias lsd='ls -d */'

So, I'd like to know what other handy aliases people have in their .bash_aliases file

Andrew Gallagher

unread,
May 13, 2013, 6:27:39 PM5/13/13
to galwa...@googlegroups.com
On 07/05/2013 19:57, Carles Sentis wrote:
>
> So, I'd like to know what other handy aliases people have in their
> .bash_aliases file

function rscreen() { ssh -t $* 'screen -dR || bash' ;}

Andrew

Carles Sentis

unread,
May 14, 2013, 3:41:46 PM5/14/13
to galwa...@googlegroups.com
@Andrew What does it actually do?



Andrew

--
You received this message because you are subscribed to the Google Groups "Galway Linux Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to galway-lug+...@googlegroups.com.
To post to this group, send email to galwa...@googlegroups.com.
Visit this group at http://groups.google.com/group/galway-lug?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



gerryk

unread,
May 14, 2013, 3:46:29 PM5/14/13
to galwa...@googlegroups.com
Looks like it SSHes to a box specified on the commandliine, and runs screen followed by bash. Screen is handy because if your session dies, you can reconnect to it when next you SSH in.
--

Gerard Ryan

unread,
May 14, 2013, 4:27:41 PM5/14/13
to galwa...@googlegroups.com
On 05/14/2013 08:46 PM, gerryk wrote:
> Looks like it SSHes to a box specified on the commandliine, and runs screen
> followed by bash. Screen is handy because if your session dies, you can
> reconnect to it when next you SSH in.
>
> On 14 May 2013 20:41, Carles Sentis <heep...@gmail.com> wrote:
>> @Andrew What does it actually do?
>>
>> On Mon, May 13, 2013 at 11:27 PM, Andrew Gallagher <ab.gal...@gmail.com
>>> wrote:
>>> function rscreen() { ssh -t $* 'screen -dR || bash' ;}

See also 'byobu' -- I always install it where I use screen. Gives a kind
of status bar with helpful info, and because that refreshes regularly, I
get timed out a lot less! :)

Gerard Ryan

unread,
May 14, 2013, 4:39:10 PM5/14/13
to galwa...@googlegroups.com
Also (again, not an alias): check out
https://github.com/nojhan/liquidprompt for an adaptive prompt!

Here's also a pretty great prompt for when using Git (I think it's more
useful than what's in the liquidprompt above):
https://github.com/matthewmccullough/dotfiles/blob/master/bash_gitprompt


Carles Sentis

unread,
May 14, 2013, 5:14:07 PM5/14/13
to galwa...@googlegroups.com
I've been using liquidprompt for a while and I quite like it. Handy if you are working in a git folder...


Andrew Gallagher

unread,
May 14, 2013, 6:18:26 PM5/14/13
to galwa...@googlegroups.com
On 14/05/2013 20:46, gerryk wrote:
> Looks like it SSHes to a box specified on the commandliine, and runs
> screen followed by bash. Screen is handy because if your session dies,
> you can reconnect to it when next you SSH in.

Yep, this alias automatically reconnects to a running screen, or failing
that starts a new screen, or if screen fails (say it isn't installed on
the remote machine) it fires up a plain bash. My bread and butter.

Andrew.

Antóin Óg Ó Cuinneagáin

unread,
May 15, 2013, 4:40:42 AM5/15/13
to galwa...@googlegroups.com
similar time saving, just in case some don't know is bash completion
http://bash-completion.alioth.debian.org/

it will complete well known command arguments.
e.g ssh <TAB> will show a list of known hosts
svn <TAB> will autocomplete svn commands

You can write your own completions also


gerryk

unread,
May 15, 2013, 6:45:51 AM5/15/13
to galwa...@googlegroups.com
While these are all great... TBH, I find that I hop from server to server so frequently that I rarely get round to setting most of this stuff up.
That said... one of the first things I do on a new box is install git and clone my .dotfiles from github.
--

Gerard Ryan

unread,
May 15, 2013, 7:15:40 AM5/15/13
to galwa...@googlegroups.com
I'll be creating a little ansible playbook soon for configuring 'nice to have' stuff like this on a server. That way I can just aim it at any server that I use and have things the way I want them :)
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Carles Sentis

unread,
May 15, 2013, 9:17:18 AM5/15/13
to galwa...@googlegroups.com
There must be an easy way to migrate your home folder across computers. My blog is kinda dead as of late but sometime ago I wrote a post to sync firefox addons across pc's using dropbox, would be nice to have something similar like a script that does it on the background without human interaction. Probably a combination of git and rsync may do the trick from the top of my head. Needs more investigating...

 

Carles Sentis

unread,
May 15, 2013, 9:17:51 AM5/15/13
to galwa...@googlegroups.com

gerryk

unread,
May 15, 2013, 9:21:40 AM5/15/13
to galwa...@googlegroups.com
Yeah... that sort of thing is interesting. The whole home directory might be a bridge too far... it would probably enforce version alignment, but stuff like bookmarks, .dotfiles, .vimrc and .[zsh|bash]rc and so forth, definitely.

gerryk

unread,
May 15, 2013, 9:32:32 AM5/15/13
to galwa...@googlegroups.com
Cheers for that.


On 15 May 2013 14:17, Carles Sentis <heep...@gmail.com> wrote:



--

Carles Sentis

unread,
May 15, 2013, 11:27:39 AM5/15/13
to galwa...@googlegroups.com
That's the thing that makes it interesting or a bit complicated the fact that you can't just synch the whole home folder but a selected items like .dotfiles and also perhaps some of the .dotfolders with application specific settings...

I guess ideally would be something that runs on startup and logging off to run a rsync and git commands every time. Issue could be for merge conflicts while running git.

gerryk

unread,
May 15, 2013, 11:46:41 AM5/15/13
to galwa...@googlegroups.com

I read the blog post. Interesting, but I'm sure that you can't just copy in XPI like that. Certainly not signed ones anyhow.
Also... What's with the click and paste a link? It's not bloody windows.

I think a custom solution, using rsync as you described, sounds like a good one to investigate.

Carles Sentis

unread,
May 15, 2013, 3:59:38 PM5/15/13
to galwa...@googlegroups.com
ha ha!! thanks for the feedback. Syncing firefox addons with dropbox works very well. I've been using it for a good while now. At least it works with the addons i have.

I will definitely look into the automation of the saving part of the home folder once I have some time. There's a little bug eating me away right now...

Carles Sentis

unread,
May 21, 2013, 1:35:44 PM5/21/13
to galwa...@googlegroups.com
This is a git alias but I thought it suited the thread.

To view the changes from a commit:

  • git config --global alias.changed 'show --pretty="format:" (to add it to .gitconfig)

and then:

  • git changed bAda55 (to view commit changes)
  • git changed --name-only bAda55 (to view the files changes)
  • git changed --name-only bAda55..ff0021 (lists files modified between those commits)
  • etc...

Carles Sentis

unread,
May 22, 2013, 1:08:28 PM5/22/13
to galwa...@googlegroups.com
A couple of aliases for git I use which I found sometime ago in stackoverflow

  • git config --global alias.lg1 'log --graph --format=format:"%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)" --abbrev-commit --date=relative'
  • git config --global alias.lg2 'log --graph --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n"" %C(white)%s%C(reset) %C(dim white)- %an%C(reset)" --abbrev-commit'
and then to use:

  • git lg1
  • git lg2

This is another alias for bash to prettify json's from terminal:

  • alias json='python -mjson.tool'

and the to use I can just do:

  • $ echo '{"name":"myname"}' | json

gerryk

unread,
May 22, 2013, 1:16:19 PM5/22/13
to galwa...@googlegroups.com

Oh, I like those json ones. Gonna steal them.

Antóin Óg Ó Cuinneagáin

unread,
May 22, 2013, 1:31:27 PM5/22/13
to galwa...@googlegroups.com
Another thing one might like to do is customise your bash prompt....you can add the output of any command to it
One time I had it show the current svn branch name
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html

Carles Sentis

unread,
May 22, 2013, 1:41:21 PM5/22/13
to galwa...@googlegroups.com
@Antoin I use liquid prompt for this which Gerard already mentioned --> https://github.com/nojhan/liquidprompt

Antóin Óg Ó Cuinneagáin

unread,
May 22, 2013, 4:54:41 PM5/22/13
to galwa...@googlegroups.com
sorry didn't see that....just downloaded now...looks cool

Nicola Di Marzo

unread,
May 25, 2013, 10:00:34 AM5/25/13
to galwa...@googlegroups.com
Hi,

Try this one:
/sbin/modinfo $(/sbin/lsmod|cut -d" " -f1)|grep -E '(description|filename)'

I call it "everymod", it lists description and filename of every module loaded by the system.

Pretty similar, but this it lists every man page/description in PATH:

for x in ${PATH//:/ }; do cd $x; whatis *; done | sort

Hope all you're well,
cheers
Nicola

Gerard Ryan

unread,
May 25, 2013, 12:12:27 PM5/25/13
to galwa...@googlegroups.com
On 05/25/2013 03:00 PM, Nicola Di Marzo wrote:
> Hi,
>
> Try this one:
>
> /sbin/modinfo $(/sbin/lsmod|cut -d" " -f1)|grep -E '(description|filename)'
>
> I call it "everymod", it lists description and filename of every module
> loaded by the system.
>
> Pretty similar, but this it lists every man page/description in PATH:
>
> for x in ${PATH//:/ }; do cd $x; whatis *; done | sort
>
> Hope all you're well,
> cheers
> Nicola

Hi Nikola,

Thanks for those, they look like they could be useful sometimes!

Here's one that you probably shouldn't have an alias for (or even use):

:(){ :|:& };:

from http://en.wikipedia.org/wiki/Fork_bomb :D

Could really mess with someone's head if you aliased that to ls or
something common like that!

Nicola Di Marzo

unread,
May 25, 2013, 12:31:56 PM5/25/13
to galwa...@googlegroups.com
:D ops. I usually run 'em as scripts or commands.
But here we're actually talkin' about aliases, maybe i'm little bit OT
Hope you will find 'em useful anyway.
Cheers
>

Carles Sentis

unread,
May 27, 2013, 10:18:30 AM5/27/13
to galwa...@googlegroups.com
Thanks Nicola...


--
You received this message because you are subscribed to the Google Groups "Galway Linux Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to galway-lug+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages