Skip to Main Content
HBS Home
  • About
  • Academic Programs
  • Alumni
  • Faculty & Research
  • Baker Library
  • Giving
  • Harvard Business Review
  • Initiatives
  • News
  • Recruit
  • Map / Directions
Research Computing Services
  • Online Requests
  • FAQ
  • Blog
  • Contact Us
  • About Us
  • Faculty Projects
  • Training
  • Compute Cluster & Data Storage
  • Data Practices
  • Help
  • …→
  • Harvard Business School→
  • Research Computing Services→
  • Help
    • Help
    • Online Requests
    • Technical How-To’s & Notes
    • Frequently Asked Questions
    →
  • Technical How-To’s & Notes→

Technical How-To’s & Notes

Technical How-To’s & Notes

Change Your Unix Command Prompt

Change Your Unix Command Prompt

The Unix command-line shell is a very powerful, highly customizable environment.

So it's supposed to help you be more productive, right? But not with a drab command prompt that never changes:

[jharvard@researchgrid] $

This prompt is set by the bash environment variable PS1, usually specified in one of your login scripts (~/.bashrc to be more precise. See this document on what these are and why they matter). There's a weird syntax here, but with Google, Stack Overflow, and O'Reilly's Learning the Bash Shell, there's plenty of explanation. So let's present one customization to make this always visible line a productive tool that shines!

Show Me Where I Am!

You can see that with the default prompt, we're presented with the current user and the hostname. But it would be infinitely more helpful to have bash tell me what the current directory is. Execute the following commands at your Unix prompt:

export PS1='[\u@\h \W]\$ '
echo "export PS1='[\u@\h \W]\$ ' " >> ~/.bashrc

After this your login prompt will appear as

[jharvard@researchgrid currentdir] $

where currentdir is the folder name that you are currently working in.

There are other customizations out there. The sky and your imagination are the limit!

ǁ
Campus Map
Research Computing Services (RCS) 
Harvard Business School
Baker Library, B90, 25 Harvard Way
Boston, MA 02163
Phone: 617.495.6100
Email: research@hbs.edu
→Map & Directions
→More Contact Information
→Terms Of Service
  • Make a Gift
  • Site Map
  • Jobs
  • Harvard University
  • Trademarks
  • Policies
  • Accessibility
  • Digital Accessibility
Copyright © President & Fellows of Harvard College