{"id":20186164,"url":"https://github.com/leolanese/bash_profile","last_synced_at":"2025-04-10T06:24:38.330Z","repository":{"id":17757876,"uuid":"20613101","full_name":"leolanese/bash_profile","owner":"leolanese","description":"bash_profile, based on a Front-End Web Developer POV. I'm sharing best practices, tricks and keep the same profile across multiple development platforms","archived":false,"fork":false,"pushed_at":"2023-11-20T10:15:38.000Z","size":245,"stargazers_count":22,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2023-11-20T11:32:34.304Z","etag":null,"topics":["bash-script","darwin","linux-shell","powershell","profile","shell","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leolanese.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-06-08T08:51:39.000Z","updated_at":"2023-09-10T22:18:33.000Z","dependencies_parsed_at":"2023-11-20T11:42:16.025Z","dependency_job_id":null,"html_url":"https://github.com/leolanese/bash_profile","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2Fbash_profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2Fbash_profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2Fbash_profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2Fbash_profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leolanese","download_url":"https://codeload.github.com/leolanese/bash_profile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224556871,"owners_count":17331088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","darwin","linux-shell","powershell","profile","shell","zsh"],"created_at":"2024-11-14T03:16:13.962Z","updated_at":"2025-04-10T06:24:38.318Z","avatar_url":"https://github.com/leolanese.png","language":"Shell","readme":"# .bash_profile \n\n\u003e UPDATED: Including `zsh` \u0026 `oh my zsh`\n\n## What is the `.bash_profile`\n\nbash_profile is a configuration file for bash shell. When bash is invoked as an interactive login shell it first reads and executes commands from: \n\n### Shortcut\n\n```js\nopen -e ~/.bash_profile\nnano ~/.bash_profile\nsource ~/.bash_profile\n\nopen -e ~/.zshrc\nnano ~/.zshrc\nsource ~/.zshrc\n```\n\n## Why common `.bash_profile`\nThe idea is to share best practices, suggestions, tricks and keep the same profile across multiple development platforms easily cloning from the repository.\n\n## zsh and .bash\n\n\u003e Both `bash` and `zsh` (OSX default) are popular Unix shells, but they have different configuration files and some distinct features. When we talk about `.bash_profile` and `.zshrc`, we are referring to the \"startup files\" (or configuration files) used by these shells.\n\n### Startup Files:\n\n#### bash\n\n```js\n~/.bash_profile: Read and executed only by login shells.\n~/.bashrc: Read and executed by non-login shells (like when you open a new terminal tab).\nIn many setups, ~/.bash_profile sources (or includes) ~/.bashrc to ensure commands and settings are consistent across login and non-login shells.\n```\n\n#### zsh\n```js\n~/.zshrc: This is the primary configuration file for interactive use of zsh. It's analogous to ~/.bashrc in bash.\n~/.zprofile: Read before .zshrc during a login, similar to .bash_profile in bash.\n```\n\n### Determinate what I'm currently using\n\n```js\necho $SHELL\n```\n---\n\n## The `.zsh`\n\nApple has changed the default shell to `zsh`. Therefore you have to rename your configuration files: `.bashrc` is now `.zshrc` and `.bash_profile` is now `.zprofile`.\n\n```js\nnano ~/.zshrc\n```\n\n\u003e If you for some reason (like me) don't want to rename/move the `~/.bash_profile` file you can do the next things:\n\n```js\n// having a copy of `.bash_profile` and `.zprofile`\nedit_p\ncp ~/.bash_profile ~/.zprofile\nsource ~/.bash_profile\nsource ~/.zshrc\n```\n\n## Getting the `.zsh`\nYou can use it with or without Catalina+ OSX, and also in combination of the normal terminal.\n\n### Instalation\n```js\n// install zsh\nsudo apt install zsh\n\n// Make default shell set and logout\nchsh -s $(which zsh)\n```\n\n```js\n// If you want to make zsh our default shell\nchsh -s $(which zsh)\n```\n\n### oh my zsh\n```js\n// install oh my zsh\nsh -c \"$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"\n```\n\n### Themes\n// In order to enable a theme, set ZSH_THEME to the name of the theme in your: `~/.zshrc` (open ~/.zshrc). Then edit the: `ZSH_THEME=\"robbyrussell\"` based on any theme from: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes then: reload .zshrc:\n\n```js\n// reload zsh\nsource ~/.zshrc\n```\n\n```js\n// example themes\nZSH_THEME=\"bira\"\nZSH_THEME=\"dallas\"\nZSH_THEME=\"half-life\"\nZSH_THEME=\"aussiegeek\"\nZSH_THEME=\"avit\"\n```\n\n### Pluggins\n\nChoose from the list: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins\nadd the `plugin` to your plugins array in `~/.zshrc` (SHIFT, cmd, .) view all files there, paste plugin into plugin folder. Standard plugins can be found in `$ZSH/plugins/`\n\n```js\n// example\nplugins=(vscode zsh_reload git)\n```\n\n---\n\n## Executing commands as script on the NodeJS Playground\n\n\u003e If you like some of these command, you may find the NodeJS Playground scrips pool useful as well: [\nNodeJS-playground](https://github.com/leolanese/NodeJS-playground/tree/main/scripts)\n\n---\n## System Operation Versions\n\n### MAC version:\nA typical install of OSX won't create a `.bash_profile` for you. When you want to run functions from your command line, this is a must-have.\n\n#### Setup Startup Terminal with .bash\n```js\n// go to your home folder\ncd ~/\n\n// create your new file if you don't have it\ntouch .bash_profile\n\n// open with textEditor or nano\nopen -e ./bash_profile\nnano ./bash_profile\n```\n\n#### Alternative modificaton \n\n\u003e If we need to inject just a line we could use `\u003e\u003e`\n\n```js\necho \"alias python='python2.7'\" \u003e\u003e ~/.zshrc\n```\n\n---\n\n## Commands and alliases:\n\n### edit bash_profile\n\n```js\nopen -e ~/.bash_profile\n```\n\n### if you don't have this file, create it!\n```js\ntouch ~/.bash_profile\n```\n\n### PS1 terminal bash options\n\n* PS1 option 1\u003cbr\u003e\n![PS1 option 1](https://i.ibb.co/YTV5Qhf/Screenshot-2021-01-13-at-21-49-03.png)\n\n* PS1 option 2\u003cbr\u003e\n![PS1 option 2](https://i.ibb.co/QrtjwPj/Screenshot-2021-01-13-at-21-50-32.png)\n\n\n---\n\n## Windows version\n\n\u003e Note: `Use double quotes instead of single one`!!\n\n```js\ngit config --global alias.ci \"commit -v\"\n\ngit config --global alias.log \"log --pretty=oneline\"\n\ngit config --global alias.log1 \"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)\u003c%an\u003e%Creset' --abbrev-commit\"\n```\n\n---\n\n### :100: \u003ci\u003eThanks!\u003c/i\u003e\n#### Now, don't be an stranger. Let's stay in touch!\n\n##### :radio_button: linkedin: \u003ca href=\"https://www.linkedin.com/in/leolanese/\" target=\"_blank\"\u003e@LeoLanese\u003c/a\u003e\n##### :radio_button: Twitter: \u003ca href=\"https://twitter.com/LeoLanese\" target=\"_blank\"\u003e@LeoLanese\u003c/a\u003e\n##### :radio_button: Portfolio: \u003ca href=\"https://www.leolanese.com\" target=\"_blank\"\u003ewww.leolanese.com\u003c/a\u003e\n##### :radio_button: DEV.to: \u003ca href=\"https://www.dev.to/leolanese\" target=\"_blank\"\u003edev.to/leolanese\u003c/a\u003e\n##### :radio_button: Blog: \u003ca href=\"https://www.leolanese.com/blog\" target=\"_blank\"\u003eleolanese.com/blog\u003c/a\u003e\n##### :radio_button: Questions / Suggestion / Recommendation: developer@leolanese.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolanese%2Fbash_profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleolanese%2Fbash_profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolanese%2Fbash_profile/lists"}