Terminal Startup Commands

  • Home
  • Intro to Unix
  • Fundamentals
  • Skills
  • Tips and Tricks

Pages

  • What Everyone Should Know
  • Autocompletion
  • Command History
  • Teleport Home
  • Simple Text File
  • Environment Variables
  • Termial Startup Commands
  • Customize the Prompt
  • Give ls colors
  • Globbing

Related

  • Established Linux Tutorial
  • The Linux Documenting Project
  • Another Unix Tutorial

Contact

  • Contact Me
  • Improve This Tutorial

Automatically Execute Commands Starting Your Shell

Whenever you open your terminal or shell it always has its default settings. There is a way that you can keep your aliases, your settings, and your personalized settings. Most shells have a file that you can place these commands so that they run every time that the shell is opened. The file is most likely a hidden file (meaning it starts with a "." character) located in your home directory.

It depends on what shell or terminal you run. For example if you use a bash shell you can create or edit (check if the file exists first) the .bashrc file in your home folder. Place in the file your alias and modified environment settings that you want to be run every time you start your shell. Do some quick research to find out if such a file exists for the shell that you use. Here is a simplified version of my own:

% cat .bashrc
alias ll="ls -l"
alias today='date +"%A, %B %d, %Y"'
customize the prompt »

© Joseph Pecoraro 2006 - 2007