Hot answers tagged


It's not a good idea to edit /etc/profile for things like this, because you'll lose all your changes whenever CentOS publishes an update for this file. This is exactly what /etc/profile.d is for: # echo 'pathmunge /usr/lib/ruby-enterprise/bin' > /etc/profile.d/ # chmod +x /etc/profile.d/ Log back in and enjoy your (safely) updated PATH: # ...


palmer's GUI info is correct, but there is a more maintainable way to modify the path seen by the shell. Like mediaslave said you can edit /etc/paths, but even better you can drop a text file in /etc/paths.d/ that has a path in it and all shells will construct the path correctly. For example, on my system: $ cat /etc/paths /usr/bin /bin /usr/sbin /sbin ...


Use the -R or --relative option to preserve the full path.


%~p0 Will return the path only. %~dp0 Will return the drive+path. More info on the subject can be found on Microsofts site


/etc/launchd.conf The launchd.conf is the only complete solution that will work for both command line and GUI applications on OS X 10.8 and 10.9, one that will work with GUI and console applications, for all users. sudo touch /etc/launchd.conf sudo nano /etc/launchd.conf Add setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin In the example above ...


you can edit /etc/ and /usr/local/lib or create a new file /etc/ and put only the line /usr/local/lib Then run ldconfig -v as root, and you're done.


The command cd - will allow you to quickly return to the last directory. You may also be interested in the pushd and popd commands which allow even more control over your directory navigation.


Is explorer simply not starting? have you tried typing explorer.exe in the command prompt window? I guess this isn't the case you wouldn't normally get a command prompt when logging in. It sounds like somehow the shell has been removed, effectively giving you a server core install, in which case try issuing the following from the command prompt. This should ...


This is likely the most efficient way to do what you want, without the use of any regular expressions: location = /en { return 302 /en/; } location /en/ { proxy_pass http://luscious/; }


It's a bad idea to put the current directory into your path. Move your scripts that you want to frequently run into ~/bin and then add ~/bin to your path. To do this, add: export PATH=$PATH:~/bin to ~/.bash_profile.


Try using the command su -. The - means the new shell will get a environment of the user you have changed to. If you don't use it most of your environment will remain the same. The man page for su says: The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly.


FYI, when this happened to me, I kept getting an Error 50 when using the command above. I had to add an /all to make it work. Once I did that, it worked just fine. Dism /online /enable-feature /all /featurename:Server-Gui-Mgmt /featurename:Server-Gui-Shell /featurename:ServerCore-FullServer


I had this problem when generating PHPDoc, during the "Transform analyzed project into artifacts"-phase. I solved this problem by executing the following command sudo apt-get install graphviz


The unshare command can do pretty much what you are asking for: unshare -m "$SHELL" After that you can change any mounts you like locally to that shell only. I recommend that any mount commands you run inside the unshared shell use the -n flag, because otherwise it will change /etc/mtab which will be visible to the entire system. You probably want df and ...


You'll have to recycle the IIS process to get it to update, I'm afraid. Global environment is inherited when the process starts and for most apps the only way to get it to update is to restart the process. It's a pain, but at least it is something you can plan for.


which is telling the truth. Your shell is lying to you. git is hashed (/usr/bin/git) means that your shell has cached this location of "git" and is using the cached path rather than searching $PATH again. Use hash -r to clear the cache and make the shell search $PATH for the new git at /usr/local/bin/git


One more thing - once you install xCode 4.3 from the OS X App Store, launch xCode, then go to Preferences -> Downloads and install "Command Line Tools". Restart Terminal and you will be able to use Make.


Use the pathmunge() function available in most distro's /etc/profile: pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } edit: For zsh users, typeset -U <variable_name> will deduplicate path entries.


SSH with a single, simple command argument will not start a shell, which means .bashrc does not get executed. SSH with a compound command argument such as your second example should start a shell, but it will be a non-interactive one, so that won't run .bashrc by default. See Bash Startup Files in the Bash manual for more information. However, calling ...


After following fmonk's advice I checked out /etc/bashrc, where I noticed it said that "Environment stuff goes in /etc/profile." I proceeded to look in /etc/profile, I saw this: pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi ...


By far, the easiest way to go about this is through the use of the setx command, which is included in Windows 7/Server 2008 and up, or as part of the Windows Server 2003 Resource Kit for XP and Server 2003 systems. You can use the setx command to either specify an entirely new set of directories in the %PATH% variable, or append a value, using a little ...


You can use the setx command: setx PATH C:\WINNT;C:\WINNT\System32 /m Setx is available in Windows 2003 and later, but can be downloaded in the Support Tools for Windows XP.


Have you upgraded the Mac OS since installing XCode? System updates, major ones anyway like 10.5 to 10.6, may remove those programs from /usr/bin. Download the latest Xcode and reinstall. It should put them back.


You can use 3 backslashes as mentioned by Jed Daniels or you can wrap it in single quotes (') and use a single backslash. Example of both are below. $ touch dir/'`rik' $ ls -l dir total 1865376 -rw-r--r-- 1 rik staff 0 Jul 1 09:51 `rik $ scp localhost:dir/\\\`rik ./ `rik 100% 0 0.0KB/s 00:00 $ scp localhost:dir/'\`rik' ...


You're going to have to set it on a shell by shell basis; bash and csh-like shells do not share the same configuration files and syntax for adjusting the PATH. Trying to do this in launchctl will not work because environment variables are set on login; they do not exist system wide in Unix outside of a shell session. So you're going to want to add ...


For accounts without admin privileges: Open "User Accounts" and choose "Change my environment variables" ( This dialog will show you your current user variables as well as the system variables. You may need to add a local PATH variable if you haven't already. To update your Path to include the Python 3.3 directory, ...


Bash maintains a cache of locations of executables in $PATH. You had hg in /usr/bin at some point, and ran it from that shell. Now you've removed /usr/bin/hg. You need to tell your running shell to forget this location: hash hg A new shell wouldn't have this problem, since the cache isn't shared between shell instances.


Initscripts are responsible for setting an appropriate path themselves. Set the $PATH variable at the top of the script: PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin


At the top of your crontab file put SHELL and PATH declaration like: SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin See this SE post for more details. The default SHELL and PATH for cron are SHELL=/bin/sh, PATH=/usr/bin:/bin (From man 5 crontab man page).

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