I've spent years curating a collection of Mac bash aliases and shortcuts to make my life easier. My full .bash_profile is below, feel free to take whatever you find useful and put it to good use.
- I have never used a Mac before. I recently went to an Apple store and tried to open a shell to try it out. But, I was not able to open a shell - no shortcut for it, not right-click-menu entry, nothing. How do you open a shell on a Mac? Does it even have a shell? I was assuming as Mac is a descendant of Unix, there would be something similar.
- The shell bash is an extension of sh. It stands for the Bourne Again SHell. (Oddly enough, it is not a variation of ash, the Almquist SHell, though both are Bourne shell variants. This should not be confused with the dash shell—an ash-derived shell used in some Linux distributions—whose name stands for the Debian Almquist SHell.) And so on.
- Line shell for the 90s fish is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.
- Shell Tricks: convert file urls to UNIX paths Nov 16 th, 2015; Shell Tricks: Quick line numbering Nov 24 th, 2015; Shell Tricks: list files with most text matches Apr 26 th, 2016; Shell Tricks: shorten every line of output Apr 27 th, 2016; Shell Tricks: halp - a universal help tool May 18 th, 2016; Logr: logging/debugging utility for Bash.
Bash stands for 'Bourne again shell'. There are a number of different shells that can run Unix commands, and on the Mac Bash is the one used by Terminal. If you want to make the window bigger, click on the bottom right corner and drag it outwards.
A (very) quick primer on .bash_profile for Mac Users
There is a hidden file in your Mac’s user directory named .bash_profile. This file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. Within it you can change your terminal prompt, change the colors of text, add aliases to functions you use all the time, and so much more.
Os X Shell Script
This file is often called a ‘dot file’ because the ‘.’ at the beginning of it’s name makes it invisible in the Mac Finder. You can view all invisible files in the Terminal by typing ls -al
in any directory.
How to edit your .bash_profile
For the newly initiated, here’s how you can edit the .bash_profile on your Mac. Nxpowerlite for mac.
Step 1: Fire up Terminal.app
Step 2: Type nano .bash_profile
– This command will open the .bash_profile document (or create it if it doesn’t already exist) in the easiest to use text editor in Terminal – Nano. Hp scanning software for mac.
Step 3: Now you can make a simple change to the file. Paste these lines of code to change your Terminal prompt.
Step 4: Now save your changes by typing ctrl +o
Hit return
to save. Then exit Nano by typing ctrl+x
Step 5: Now we need to *activate your changes. Type source .bash_profile
and watch your prompt change.
My .bash_profile
I have been compiling my own set of aliases and configurations for years in which time I have borrowed copiously from others who have made their aliases available online. I can claim credit for very little of what follows. I recently became aware of alias.sh, a site making sharing BASH aliases easy. Check it out.
Update: Due to popular demand, my bash profile is now available as a Gist for your forking pleasure.
Without further ado, here is my .bash_profile:
Update: If you enjoyed this post, you might also like:
A collection of Bash scripting utilities I compiled to make custom Bash programming easier.
At its core, Git is a set of command line utility programs that are designed to execute on a Unix style command-line environment. Modern operating systems like Linux and macOS both include built-in Unix command line terminals. This makes Linux and macOS complementary operating systems when working with Git. Microsoft Windows instead uses Windows command prompt, a non-Unix terminal environment.
In Windows environments, Git is often packaged as part of higher level GUI applications. GUIs for Git may attempt to abstract and hide the underlying version control system primitives. This can be a great aid for Git beginners to rapidly contribute to a project. Once a project's collaboration requirements grow with other team members, it is critical to be aware of how the actual raw Git methods work. This is when it can be beneficial to drop a GUI version for the command line tools. Git Bash is offered to provide a terminal Git experience.
What is Git Bash?
Git Bash is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience. Bash is an acronym for Bourne Again Shell. A shell is a terminal application used to interface with an operating system through written commands. Bash is a popular default shell on Linux and macOS. Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system.
How to install Git Bash
Git Bash comes included as part of the Git For Windows package. Download and install Git For Windows like other Windows applications. Once downloaded find the included .exe
file and open to execute Git Bash.
How to use Git Bash
Git Bash has the same operations as a standard Bash experience. It will be helpful to review basic Bash usage. Advanced usage of Bash is outside the scope of this Git focused document.
Free Online Linux Shell
How to navigate folders
The Bash command pwd
is used to print the 'present working directory'. pwd
is equivalent to executing cd on a DOS(Windows console host) terminal. This is the folder or path that the current Bash session resides in.
The Bash command ls
is used to 'list' contents of the current working directory. ls
is equivalent to DIR
on a Windows console host terminal.
Both Bash and Windows console host have a cd command. cd is an acronym for 'Change Directory'. cd is invoked with an appended directory name. Executing cd will change the terminal sessions current working directory to the passed directory argument.
Git Bash Commands
Git Bash is packaged with additional commands that can be found in the /usr/bin
directory of the Git Bash emulation. Git Bash can actually provide a fairly robust shell experience on Windows. Git Bash comes packaged with the following shell commands which are outside the scope of this document: Ssh
, scp
, cat
, find
.
Bash Shell For Mac
In addition the previously discussed set of Bash commands, Git Bash includes the full set of Git core commands discussed through out this site. Learn more at the corresponding documentation pages for git clone
and more.,
git commit
, git checkout
, git push
,