
However, if you’re like me and often working in a git repository, it’s nice to have your current branch displayed in your prompt.

bash_prompt.Īt this point, your Terminal should look something like this: To apply your changes, simply execute the command. Remember, to exit and save your file, press Ctrl+X, then Y, then the Return key. Add this under your PS1 line: export PS1 Let’s export that and see what it looks like. The syntax might seem a bit weird, but it’s interesting to learn about if you’re curious! Basically, we’re getting the current username with \u, wrapping that in a specific colour, 0 93m, and adding in the proper escape sequences. bash_prompt file: # TERMINAL PROMPT PS1="\\u\" # username PS1 is the primary prompt displayed in the Terminal before each command. Let’s start setting up our prompt.There are a few different prompts you can customize, but we’ll stick to PS1 for this tutorial. Now, we’re going to want to make sure colours are enabled so our prompt looks nice! Add these 2 lines to do that: export CLICOLOR=1 export LSCOLORS=ExFxBxDxCxegedabagacadĬLICOLOR turns colours on, and LSCOLORS customizes them. Add this line to the top of your file: #!/usr/bin/env bash The layout I like for my prompt is - name directory (git-branch) > |įirst, let’s put a shebang at the top of our file so our system knows it’s bash. Now open up the file in the nano editor: nano. This is definitely a personal preference, so make sure to customize it to your liking!įirst, create your. bash_prompt file is going to contain the commands to set a custom bash prompt. That’s it! To save, simply press Ctrl+X, then Y, then the Return key, then apply your changes with the command. With the nano editor open, add these lines: source ~/.bash_prompt source ~/.aliases

bash_profile for is to source the other dotfiles. You could add all the configuration information in this file if you wanted, but I like to split it up for better maintainability. The nano editor should open with your new. To edit your file, run the command: nano. bash_profile file, run the command: touch. Let’s make sure we’re in the home directory. This is the first file that is read and executed when you open up your Terminal, so it’s important!
#Osx search a for a folder free#
Feel free to use vim, emacs, or whatever editor you’re most comfortable with!

To edit these files, we’ll just be using the nano editor as we only need to add and save a few lines. Over the next few steps, we’ll be creating some dotfiles to configure our Terminal experience. If you want to improve it even more though, keep following along! Step 3: Configuring. If you wanted to leave it here, you definitely could! It looks a bit better than the default.
