Hot answers tagged

36

All you need to do is type alias at the prompt and any active aliases will be listed. Aliases are usually loaded at initialization of your shell so look in .bash_profile or .bashrc in your home directory. unalias will only work for your current session. Unless you find where it is defined and loaded, it will be loaded again when you start a new Terminal ...


30

The quote marks are preventing ~ from being expanded to your home folder, so you need to either quote just the part with the space in it: ln -s ~/"Foo Bar/" Foo Note: exactly how much is quoted doesn't matter, as long as the space is in the quoted portion and the ~ isn't. ~/Foo" "Bar/, ~"/Foo Bar/", ~/Fo"o B"ar/ etc are all equivalent. You could also use ...


17

An alias contains two pieces of information: a unique identifier of the file it links to, and the path and file name of the file it links to. If you rename or move a file, and then create a new file with the path and file name that the file originally had, then any alias that linked to the original file now links to the new file. However, if you rename or ...


17

You have to press cmd + alt while dragging


13

If you use bash, add the alias commands to ~/.bashrc and save a file like this as ~/.bash_profile: . ~/.bashrc When bash is invoked as an interactive non-login shell, it reads .bashrc but not .bash_profile. When bash is it is invoked as an interactive login shell, it reads .bash_profile but not .bashrc. Terminal and iTerm open new shells as login shells ...


10

You can't pass arguments to aliases. Aliases are just text substitutions without further logic. But you can use shell functions to achieve the same result: function pman() { if [ -x /usr/bin/open ]; then man -t "$1" | open -f -a Preview else man "$1" fi } The if-then-else part is there just to make sure it also works on non-...


9

Click any file or folder, press and hold down the ⌘ Command + ⌥ Option keys, and then drag the file or folder while continuing to hold down the ⌘ Command + ⌥ Option keys. An alias appears where you release the mouse button.


9

In short you are putting your aliases in the wrong file .bashrc, that is why you need to keep running source to get the aliases working in any new login terminal instances. By default, Terminal starts the shell via /usr/bin/login, which makes the shell a login shell. On every platform (not just Mac OS X) bash does not use .bashrc for login shells (...


8

You can create soft links (a.k.a. symbolic links or symlinks) from the terminal, the same way as in any other Unix system. I'm not familiar with Dropbox so I'll make up an example assuming that there is a folder Dropbox in your home directory: cd ~ ln -s ~/Dropbox/aFolder Desktop/aFolder Note that ln takes the link to create as its second argument; think ...


8

Let's try a few experiments, and look at a few things. In a terminal emulator, such as Terminal.app in /Applications/Utilities, go to your home directory (cd ~) and create a directory (mkdir directory). Make sure you go in the directory we just created (cd directory). cd ~ mkdir directory cd directory After that, make a file; a simple text file will do: ...


7

mkalias is a binary available in a set of tools here. It can also be installed via Homebrew with brew install osxutils. This is a SH shell script that calls AppleScript to create an alias. I'm including the shell script here for future reference incase it goes missing from the nets. #!/bin/sh # make_alias # This script takes two command-line arguments: # ...


6

You can always put if [ -n "$BASH_VERSION" ] && [ -f $HOME/.bashrc ];then source $HOME/.bashrc fi into the file ~/.profile or ~/.bash_profile on mac I think. Oooor, you could just put your stuff in .profile or .bash_profile.


6

Try this on Terminal: cd ~/Desktop ln -s ~/Library/path/to/folder


5

No - aliases are a combination of a sym link pointing to a place as well as a unique file ID to track that file if it moves so the alias won't be broken if the file still resides on the original volume. (the file ID changes across volumes and an alias will only remain valid if the relative path is correct if and when the file ID half is broken by a deletion)....


5

It's possible to do it in one line of Terminal. Let's say you want to alias to the file "/Users/me/Library/Preferences/org.herf.Flux.plist". osascript -e 'tell application "Finder"' -e 'make new alias to file (posix file "/Users/me/Library/Preferences/org.herf.Flux.plist") at desktop' -e 'end tell' You should replace to file with to folder if you have a ...


5

For any app you want to add to your dock as a shortcut, the process is as follows: Launch the application. The application's icon will appear in the dock. Right click the application's icon in the dock. Go to "Options". Select "Keep in Dock". Now the application's icon will remain in the dock as a shortcut when you quit the application.


5

Hold down cmd and option when dragging.


5

Use absolute paths for the jar file: alias dsim='java -jar /path/to/dsim.jar'


4

It seems like your bash shell is looking for .profile instead of .bashrc . What you can do is make a symbolic link: ln -s ~/.bashrc ~/.profile and restart your session (close, reopen Terminal). Any future bash setting updates can be made to .profile or .bashrc.


4

It works on 10.8.2 without creating an alias. You can drag the shared folder to the sidebar. It will auto mount after you have disconnected.


4

Since Lion, in addition to storing Retina icons, it seems that an alias stores its many different sizes of icons in both the data and the resource fork (the xattr com.apple.ResourceFork). Possibly in a move away from Resource forks, while still supporting previous OSes (for now). The alias I just created contained the follow formats: is32, s8mk, ic11, il32, ...


4

It doesn't work because the cd is executed on your local machine when the ssh does terminate. Here is the way to do it: alias appl="ssh 9@lon.orb.com 'cd /opt/tomcat/instances ; exec ${SHELL} -i'"


4

I keep aliases in ~/.bash_profile. Terminal and iTerm 2 open new shells as login shells by default. When bash is invoked as an interactive login shell, it reads ~/.bash_profile but not ~/.bashrc. The terminal emulators on other platforms often open new shells as non-login shells, so for example bash reads ~/.bashrc but not ~/.bash_profile. OS X users often ...


4

The default ls provided with OSX comes from BSD and won't allow you to do what you want. Using CoreUtils ls (installed with macport it's available with the gls command) You'll get your colors using --color=always: ls -l --color=always | awk ' { k=0; for (i=0;i<=8;i++) k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i)); if (k) printf("%0o ",k); ...


4

To find aliases with mdfind, in a Terminal: mdfind kMDItemKind="Alias" This will print a list of aliases with the fully qualified pathname. Note: These are aliases created in Finder, not symbolic links created with the ln command from a Terminal or script. To use find to find symbolic links created by, as an example, ln have a look at: man find Example:...


4

Aliases aren't interpreted within shell scripts. From bash(1): Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt) So the script still calls the standard readlink which doesn't know about --help. Instead of setting expand_aliases (which you have to remember to do so on each system and ...


4

Run the following command in Terminal (it will create a symbolic link for all users): sudo ln -s /System/Library/CoreServices/Finder.app /Applications Or just for currently logged on user: ln -s /System/Library/CoreServices/Finder.app ~/Applications Finder will appear in the applications list opened with Launchpad.


3

You must use the Unix ln command from Terminal. ln -s existingname newname


3

You should have a look in /etc/profile or ~/.profile or ~/.bash_profile or ~/.bashrc Which are plausible startup files for your shell (that I assumed is bash).


3

I'm not sure I understand your question. The -bash: prefix you see is simply bash's way of identifying itself as the source of the error message. In this case you entered cdp which is neither an external nor internal shell command nor was it defined as an alias or function. While in a (bash) terminal, you can simply type exit to leave the terminal and ...



Only top voted, non community-wiki answers of a minimum length are eligible