Make an Alias in Bash Shell in Macos, OS X Terminal

Make an Alias in Bash Shell in Macos, OS X Terminal

7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell CCOOOOLLEESSTT GGUUIIDDEESS MENU Make an Alias in Bash Shell in macOS, OS X Terminal July 19, 2011 — 27 Comments To make aliases of macOS Unix commands in your bash shell on macOS and earlier versions, it is done via your .bash_profile file which lives in your home account directory, if the file does not already exist, just create one. Launch Terminal from the /Application/Utilities folder Go to your home directory by just entering cd followed by the ‘return’ key to enter the command: cd List your home directory contents including invisible files to see if the file already exists, use: ls -la drwxr-xr-x+ 18 ladmin staff 612 Jul 14 09:21 . drwxr-xr-x 6 root admin 204 Jul 3 18:28 .. -rw------- 1 ladmin staff 3 Jun 2 12:53 .CFUserTextEncoding -rw-r--r--@ 1 ladmin staff 6148 Jul 14 09:01 .DS_Store drwx------ 5 ladmin staff 170 Jul 3 18:44 .Trash -rw------- 1 ladmin staff 1157 Jul 14 08:59 .bash_history drwx------+ 5 ladmin staff 170 Jul 14 08:33 Desktop drwx------+ 6 ladmin staff 204 Jun 2 13:48 Documents drwx------+ 8 ladmin staff 272 Jul 3 18:10 Downloads drwx------+ 29 ladmin staff 986 Jul 3 17:49 Library drwx------+ 3 ladmin staff 102 Jun 2 12:53 Movies drwx------+ 3 ladmin staff 102 Jun 2 12:53 Music drwx------+ 4 ladmin staff 136 Jun 2 12:53 Pictures https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 1/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell drwxr-xr-x+ 4 ladmin staff 136 Jun 2 12:53 Public drwxr-xr-x+ 6 ladmin staff 204 Jul 3 18:11 Sites Create the .bash_profile file using the command line program called ‘nano’ if it doesn’t exist: nano .bash_profile bash-alias-OSX When the .bash_profile file is created you are ready to enter your alias commands. So here I am using the alias ‘l’ to alias the command ‘ls -lah’ alias l='ls -lah' In nano ‘control+o’ to write the file out and ‘control+x’ to exit the file. Refresh the bash shell environment by entering the command below: source ~/.bash_profile That’s it, now the alias will take effect. To add other aliases just start a new line, and apply the same formatting. https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 2/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell Share this: Twitter Facebook Related Back up a VPS Web Host using SSH and SCP on Mac OSX 10.6 Using SSH and SCP you can copy your remote web VPS backups to your local machine in a secure manner and then by creating a back up script you can either run the script adhoc or schedule the Setting up VVV Varying Vagrant Vagrants Generate SSH Private and Public Keys in July 19, 2011 on macOS macOS Mojave In "macOS" May 10, 2017 October 6, 2018 In "WebDev" In "macOS" Cats: macOS Tags: alias, bash, OSX, shell Sponsored Links Underneath The Ice Was A Mystery That Even Science Can't Explain Science101 22 Marvelous Photos Taken At The Airport SoGoodly Hilarious Parking Moments No One Will Forget Drivepedia Dog Refuses To Give Birth, Vet Sees Ultrasound And Realizes He's Made A Huge Mistake Articles Vally Pregnant Dog Doesn't Want To Give Birth, Vet Does Ultrasound And Then Understands Why Housediver https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 3/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell 33 Enormous Athletes That Terrify Everyone TieBreaker 27 Comments Coolest Guides on the Planet Chavez Clemons Recommend 12 t Tweet f Share Sort by Newest Join the discussion… Asaf • 2 months ago when i use `source ~/.bash_profile` it takes me into the editor of the .bash_profile file how do i correct this? △ ▽ • Reply • Share › Chuba Wub • a year ago When I do this, I get this error message. Can someone explain how to fix it? "Error writing /.bash_profile: Permission denied" △ ▽ • Reply • Share › Mark Heath > Chuba Wub • 8 months ago You should be using ~/.bash_profile not /.bash_profile. The other answer will fix the symptom but not the problem. △ ▽ • Reply • Share › krishna garikapati > Chuba Wub • a year ago sudo -s chmod 755 ./.bash_profile △ ▽ • Reply • Share › Andreas Alme • 2 years ago • edited can you add aliases with an argument? For example, if you'd like to navigate to the applications folder and open a specific app? Say that the alias could look like 'o Safari', where 'Safari' is the argument. △ ▽ • Reply • Share › Ashwani Garg > Andreas Alme • 4 months ago cd ls -la nano .bash_profile alias ht='cd /Applications/Mamp/htdocs/' press control+X Y Enter source .bash_profile Restart terminal △ ▽ • Reply • Share › Comments continue after advertisement https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 4/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell Comments continue after advertisement Mr. Devboy • 2 years ago thank you! △ ▽ • Reply • Share › Chris Myers • 2 years ago thanks! very helpful! △ ▽ • Reply • Share › RobLui • 2 years ago t h a n k y o u. 1 △ ▽ • Reply • Share › Absolute0 • 2 years ago thanks 1 △ ▽ • Reply • Share › IdontReallywolf • 2 years ago Thank you alot! 1 △ ▽ • Reply • Share › Quang Minh LE NGUYEN • 2 years ago Thanks :D △ ▽ • Reply • Share › Comments continue after advertisement Sarath Uch • 2 years ago This is really nice, that works really well. Appreciate 1 △ ▽ • Reply • Share › Tibin Geo • 3 years ago well explained 1 △ ▽ • Reply • Share › Anonymous • 3 years ago The only Tutorial, that worked for me...! Great! Thank You" △ ▽ • Reply • Share › Azol • 3 years ago Thank you. That's what I was looking for. △ ▽ • Reply • Share › Mert Gülsoy • 4 years ago Thank you. That is what i was looking for 1 △ ▽ • Reply • Share › Adam Holt • 4 years ago Thanks, nice and simple! △ ▽ • Reply • Share › Comments continue after advertisement Erick Jones • 4 years ago https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 5/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell Hallo, is there some way I can use this aliases in any folder? Like global aliases? △ ▽ • Reply • Share › Tuncay Kaplan • 6 years ago If anybody gets this error -bash: alias: samplealias: not found -bash: alias: =: not found -bash: alias: cd /DirName/: not found Probably you put spaces before and/or after = sign. Removing spaces will solve this problem. All credit goes to rorx in #MacOSX room at freenode 7 △ ▽ • Reply • Share › Landon Orr • 7 years ago Thanks, this worked great. 3 △ ▽ • Reply • Share › Brad • 7 years ago I love OSX! Well done your posts are very useful and easy to read. Thanks mate! △ ▽ • Reply • Share › Dave Woodall • 7 years ago My aliases were working great (as you have laid out here) until I upgraded to 10.8. Now it just says "-bash: l: command not found" Any ideas? 1 △ ▽ • Reply • Share › naren459 > Dave Woodall • 7 years ago check to see if your .bash_profile file is still there. if so run source ~/.bash_profile again. It should come back. △ ▽ • Reply • Share › Clarence Olivier • 8 years ago Thanks, this is just what I needed! Going a step further, would it be possible to make an application that launches the command on the terminal? △ ▽ • Reply • Share › Bob Jonson > Clarence Olivier • 7 years ago You could use Automator with a type of application and an action that runs a shell script △ ▽ • Reply • Share › Alva_ > Clarence Olivier • 7 years ago A few apps let you do that: LaunchBar, Alfred, Quicksilver,... Just create a script and associate it with an action. △ ▽ • Reply • Share › ✉ Subscribe d Add Disqus to your siteAdd DisqusAdd Disqus' Privacy PolicyPrivacy PolicyPrivacy https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 6/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell Sponsored Links Underneath The Ice Was A Mystery That Even Science Can't Explain Science101 22 Marvelous Photos Taken At The Airport SoGoodly Hilarious Parking Moments No One Will Forget Drivepedia Dog Refuses To Give Birth, Vet Sees Ultrasound And Realizes He's Made A Huge Mistake Articles Vally Pregnant Dog Doesn't Want To Give Birth, Vet Does Ultrasound And Then Understands Why Housediver https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 7/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell 33 Enormous Athletes That Terrify Everyone TieBreaker Subscribe to the Latest Posts Add in your ema Keep Me Posted! Coolest Guides o… 1.4K likes Like Page Be the first of your friends to like this Coolest Guides on the Planet about 3 years ago https://coolestguidesontheplanet https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 8/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell https://coolestguidesontheplanet .com/setting-local-develop…/ COOLESTGUIDESONTHEPLANET… Setting up a Local Devel… Pressmatic is a new WordPre… Tags 3gs 10.6 apache backup baseband Bing boot clean urls Coolest Guy on the Planet cpanel css custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect remote rsa SEO shell ssh terminal unstoppables urls Yahoo https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 9/10 7/28/2019 How to Make an Alias in macOS or OSX using Terminal and Bash Shell Donate A Beer To The Coolest Guides Copyright © 2019· Neil Gee - All Rights Reserved - Hosted by Cloudways and Vultr https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/ 10/10.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us