Hot answers tagged

28

You must press command + option while dragging.


25

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. From Chris Johnsen's comment at Why doesn't .bashrc run automatically? By default, Terminal starts the shell via /usr/bin/login, which makes the shell a login shell. On ...


23

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 ...


23

If you are trying to cd into an alias, it will not work; this is by design as an alias works at the Finder level, not the underlying UNIX level. I have excerpted some of the key aspects of aliases, symbolic links (symlinks), and hard links from the article "What Are Aliases, Symbolic Links, and Hard Links in Mac OS X?" below. Aliases This type of ...


13

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 ...


12

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 ...


11

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.


10

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


9

Hold down cmd and option when dragging.


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 ...


7

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.


7

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:...


7

You can't use alias for arbitrary substitutions. You can use a function instead. function gre() { grep -r "$@" . }


6

Open a new Terminal window and go to your home directory (just type cd and press Enter). After that, type ls .bash* and also ls .profile (please note each of those file names starts with a dot). If you have those files (and you should have at least the .profile one) then you need to edit them and add your aliases to them. I use VI (or VIM) to edit those ...


6

The Finder alias will appear as a zero-byte file in Dropbox. Any files linked to it will not be uploaded. If you would like to have Dropbox sync the contents of the alias, you can instead use what's called a symbolic link. Basically, it's an alias that the operating system (and Dropbox) treat as indistinguishable from the actual folder. This question on ...


6

UPDATE I put my implementation here with install instructions: https://github.com/dosentmatter/rainbow-bash-prompt It uses the C implementation of lolcat but I modified it a little to make it psuedo-random. OLD ANSWER Here is how I did it. Add this to your .bashrc: PS1_colorless=${PS1:-'\h:\W \u\$ '} ESC=$(echo -e '\033') SOH=$(echo -e '\001') STX=$(...


5

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, ...


5

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


5

To enable cd'ing into a folder alias I've found the following at Mac OS X Hints. Compile the source code below with the following command: gcc -o getTrueName -framework Carbon getTrueName.c This will create the ‘getTrueName’ executable in the same directory as the source. You can add it to your PATH, or just copy it directly to /usr/bin or /usr/local/bin ...


5

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 ...


5

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.


5

Why not skip the Applescript and just create a symbolic link in bash? It behaves exactly like an alias on the desktop except now you can work with it in bash. See this answer for a breakdown of aliases, hard links and sym links. So, your command would be: ln -s /path/to/application/MyApp.app /Users/username/Desktop/MyApp Where MyApp.app and username ...


5

Aliases store two pieces of information about the destination file - both the location and a file identifier. Symbolic links only store the other location. For that reason, if you move a file, Aliases are superior since they can often still point at the correct file when a change happens. Dropbox or moving the files to another filesystem is where things get ...


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

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 ...


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

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

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

Got it! Turns out ln is the answer after all, but I had an error in my path. Here is a functional command line for anyone who might need to edit a symlink "in place" in the future: ln -f -s /path/to/new/location/of/original /path/to/location/of/broken/symlink/ Notice that you're not actually pointing all the way to the broken symlink itself, but to the ...


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); ...


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