Bash - Create Alias for Command

: ' Add an alias: ' alias textedit='open -a TextEdit' : ' Invoke it ' textedit filename.txt : ' When BASH is invoked as a login shell, the following files are executed in the displayed order. /etc/profile ~/.bash_profile ~/.bash_login ~/.profile ' : ' For more persistent control, create a user profile and store your alias there ' touch ~/.profile : ' Then an alias or two in .profile ' # This alias reloads this file alias reload_profile='. ~/.profile' # See alias sudo='sudo ' # This helps me edit files that my user isn't the owner of alias edit='SUDO_EDITOR="open -FWne" sudo -e' # The alias that takes me here - to editing these very aliases alias edit_profile='open -e ~/.profile' # I do a lot of web development, so I need to edit these non-owned files fairly often alias edit_hosts='edit /etc/hosts' alias edit_httpd='edit /etc/apache2/httpd.conf' alias edit_php='edit /etc/php.ini' alias edit_vhosts='edit /etc/apache2/extra/httpd-vhosts.conf' # Some of my goto commands, including one to open the php extension folder for when I need to install custom extensions alias goto_mw='goto_web; cd mindworks' alias goto_web='cd ~/Sites' # This alias recursively destroys all .DS_Store files in the folder I am currently in alias killDS='find . -name *.DS_Store -type f -delete' # Mac get stuck very often and are extremely slow and unstable on shutdowns. This forces a shutdown. alias poweroff='sudo /sbin/shutdown -h now' # Setting for the new UTF-8 terminal support in Lion / Mountain Lion export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # Adds all these paths to the PATH variable. The colon (:) is the path separator. # When you need to "add something to path" you're supposed to add the path to its executable file to this list of paths, separated by a colon. export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.