Sunday, October 31, 2010

Run any set of commands while launching Terminal

Many times we want some default set of commands to run in terminal whenever we start a new instance of it and there's a way to avoid typing the commands every time you login......
All you need is to add the commands in ~/.bashrc Configuration file.

I have taken the example of printing some message but you can almost write any command and make it run.

  1. Open Terminal. Applications>Accessories>Terminal
  2. Type gedit ~/.bashrc in terminal. You can use any editor you want. I am using gedit over here. You can also make changes inside terminal only if you are comfortable with vi editor. 
  3. Just write the commands you want to run!! for example:
echo "THIS IS MY FIRST POST ON THIS BLOG"
 


This is how it will look. Notice that the command ran as soon as terminal was started. So you can write all kind of commands and make them run.




Tip: you can also run shell scripts. And do all sort of crazy things..:P

Note: Commands requiring root privileges won't run directly. They will ask for password once.

No comments:

 
Copyright 2009 ENDEAVOR