Make alias pemanent fast

PERMA () { echo "$@" >> ~/.bashrc; }
Simple function to permanently add an alias to your profile. Tested on bash and Ksh, bash version above. Here is the ksh version: PERMA () { print "$@" >> ~/.profile; } Sample usage: PERMA alias la='ls -a'

2
By: zlemini
2009-09-28 16:03:24

These Might Interest You

  • This command will first add an alias known only to git, which will allow you to pull a remote and first-forward the current branch. However, if the remote/branch and your branch have diverged, it will stop before actually trying to merge the two, so you can back out the changes. http://www.kernel.org/pub/software/scm/git/docs/git-pull.html Tested on git 1.5.6.1, msysgit (Windows port) Actually this is not really the way I want it. I want it to attempt a fast-foward, but not attempt to merge or change my working copy. Unfortunately git pull doesn't have that functionality (yet?). Show Sample Output


    1
    git config --global --add alias.ff "pull --no-commit -v" ; git ff
    piyo · 2009-02-13 15:30:46 2
  • example: -------------------------------------------------------------------------------------------- user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ addpi -------------------------------------------------------------------------------------------- Now that directory is in the list of fast access directories. You can switch to it anytime like this: -------------------------------------------------------------------------------------------- user@ubuntu:~$ pi internal` user@ubuntu:~/workspace/SVN/haystak-repos/trunk/internal/src$ -------------------------------------------------------------------------------------------- Please note the backquote ( the symbol that shares its key with ~ in the keyboard ) pi will switch you to that directory. To see the list of all fast access directories you have to say "cat ~/.pi"


    8
    alias pi='`cat ~/.pi | grep ' ; alias addpi='echo "cd `pwd`" >> ~/.pi'
    senthil · 2009-02-05 15:46:59 9
  • command "tinyurl google.com 123google" --> tinyurl.com/123google redirects to google Show Sample Output


    0
    tinyurl () { URL="$1";ALIAS="$2"; curl -s 'http://tinyurl.com/create.php?source=indexpage&url='"$URL"'&submit=Make+TinyURL%21&alias='"$ALIAS" >/dev/null ;}
    patrick_1994 · 2012-11-03 17:37:00 0

  • -2
    alias acs='apt-cache search'
    hide1713 · 2009-02-07 22:08:44 0

What Others Think

Many Linux distros' ~/.bashrc files are configured to look for ~/.bash_aliases. to check yours, run: grep aliases .bashrc If you see something like this: if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases Then all you need to do to save aliases is: alias > ~/.bash_aliases
unixmonkey3987 · 455 weeks and 5 days ago
alias >> ~/.bash_aliases So as to keep any existing aliases.
DaveQB · 455 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: