Skip to content

Instantly share code, notes, and snippets.

@notTag
Last active April 1, 2017 18:19
Show Gist options
  • Save notTag/18a6f7e92e9fbd51e138241dbd9b42eb to your computer and use it in GitHub Desktop.
Save notTag/18a6f7e92e9fbd51e138241dbd9b42eb to your computer and use it in GitHub Desktop.
Terminal Customization (friday night)

Terminal

  • To change the terminals prompt:
    1. nano ~/.bash_profile
    2. export PS1="yourFancyPromptName\t " Displays as: yourFancyPromptName01:25:53
    3. Customization flags: "\d" – Current date "\t" – Current time "\h" – Host name "#" – Command number "\u" – User name "\W" – Current working directory "\w" – Current working directory w/ full path
    4. Slightly distracting prompt colors: force_color_prompt=yes
    5. For more details: https://man.cx/bash
  • Customize ls with flags
    1. nano ~/.bash_profile
    2. alias ls='ls -GFh' -G adds color to output
      -F adds a '/' for directories '*' for executables '@' for symlinks -h makes sizes readable -l detailed output
  • Reset PATH. Use if bash commands aren't working. This way you can edit your .bash_profile mistake (-___-)
    1. export PATH=/bin:/usr/bin:/usr/local/bin
  • Change font size on-the-fly
    1. (Command +)
    2. (Command -)
  • Divider between commands with timestamp (Modified AJ's code from OSXDaily.com)
    • Four things need to be added to your .bash_profile
    1. export PS1='$fill \t\n'"myPROMPT "
    2. fill="--- "
    3. function prompt_command { let fillsize=${COLUMNS}-9 fill="" while [ "$fillsize" -gt "0" ] do fill="-${fill}" # fill with underscores to work on let fillsize=${fillsize}-1 done }
    4. PROMPT_COMMAND=prompt_command
  • Create separate file for aliases.
    1. nano .bash_aliases
    2. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
  • More color customization
    1. https://geoff.greer.fm/lscolors/ example use: export CLICOLOR=1 export LSCOLORS=exfxcxdxbxegedabagacad

my github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment