I install homestead and laravel but when i write the command in command line there is error the command not found for both laravel and homestead so i search a lot and i found that i must add the path so i added in efferent way but still the same error command not found.
and this is my bash profile is there any wrong when i added the path?
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export composer=php /usr/bin/composer.phar
export PATH=~/.composer/vendor/bin/:$PATH:/home/alsachit/.composer
You should run Laravel commands from Laravel project directory, like php artisan or composer. If you will run there commands from other directories, you can meet a lot of errors (a lot of guys ask for help on SO because of it), so my advice is to keep it simple.
UPDATE:
COMPOSER_PATH=~/.composer/vendor/bin
PATH=$COMPOSER_PATH:$PATH
export PATH
Another way which may work for you:
export PATH="$PATH:$HOME/.composer/vendor/bin"
I believe to directly answer the issue homestead: command not found
you must perform steps below:
Add bash function into your ~/.bashrc or ~/.bash_profile file:
# Homestead shortcut
function homestead() {
( cd ~/Homestead && vagrant $* )
}
Restart terminal, see image below for possible output.
Related
I have this very simple postinst file for a .Deb package:
#!/bin/sh
echo 'alias command_pandora="sudo /usr/local/bin/pandora"' >> ~/.bashrc
echo 'Pandora Storage Server Installation complete.'
When I run it I even get the 'Pandora Storage Server Installation complete.' message, but nothing is appended to ~/.bashrc; nevertheless when I run this command alone in the terminal:
echo 'alias command_pandora="sudo /usr/local/bin/pandora"' >> ~/.bashrc
It does work. I already tried modifying the file permisions for ~/.bashrc but still get the same result. I also tried running a separate script with the same content and running it and it also works, so it seems to be related to dpkg.
Why is the content not being appended?
The postinst script runs as root. Package installation is a system installation utility; it should absolutely not modify users' private files, including those of root.
Tangentially, defining an alias seems like the wrong solution to your problem. Generally, prefer functions or shell scripts over aliases.
If the tool requires privileged access through sudo, perhaps refactor it to run itself with sudo (maybe with a check to only do this when it is connected to a terminal, to prevent it from hanging when run unattended).
Or, simply, include /usr/bin/command_pandora in the package with the following contents:
#!/bin/sh
exec sudo /usr/local/bin/pandora "$#"
(Marginally, I suppose it could add something to /etc/skel/.bashrc but this will only create a new alias for users which are created after this change, or users whose .bashrc presciently run source /etc/skel/.bashrc. I don't think that's a good idea, either.)
I am running Julia on my university's cluster, which runs Red Hat Linux. The Julia download's path is
/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin
When I run
/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin/julia
Julia runs fine. However, I just want to type
julia
And have it run. I edited my .bashrc to include
alias julia="/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin/julia"
Running "julia", I now get the prompt
CORRECT>.julia (y|n|e|a)?
Running both .julia and julia results in
julia: Command not found.
What am I doing wrong? I also get the same issue when I try to set my path in the .bashrc file.
EDIT1: For reference, here's my .bashrc file :
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
module load gcc
module load torque
alias julia="/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin/julia"
EDIT2: Here is my bash_profile as well, where I have tried adding it to my path. For some reason, I get the same error:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH="/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin:$PATH"
export PATH
Ideally, I'd like to just add it to my path rather than make an alias, but for some reason nothing seems to be working.
This is a follow-up to my previous question:
Julia alias in .bashrc not working correctly
My main issue is that I cannot add Julia to my path on a Linux Cluster. If I go into the bin subfolder of the Julia folder, I can run Julia itself fine. However, I cannot edit the .bash_profile to get it into my path. As opposed to my previous question, I believe my issue has less with building an alias (or something Julia related) and more concerning my .bash_profile itself not updated.
The Julia file itself is located in
/gsfs0/data/heathjo/Downloads/julia-1.5.3/bin
I configured my .bash_profile as follows:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH=$PATH:$HOME/.local/heathjo/Downloads/julia-1.5.3/bin
export PATH
If I run
source .bash_profile
I get the following issue:
if: Expression Syntax.
then: Command not found.
As such, it seems as if I run echo $PATH, Julia doesn't appear in my path, because it seems as if I can't source the .bash_profile. Am I doing something incorrectly?
I have both Bash on Ubuntu on Windows and Cygwin bash installed on my machine, and both are setup to have the same ~ folder (via /mnt/c/source and /cygdrive/c/source respectively).
When I start Ubuntu's bash prompt via bash --login -i (or just bash --login) from any directory, I get a prompt running from within that directory; however, when I start Cygwin's bash via the same command, the current directory is overridden, and the prompt is always at ~. See the screenshots for a simple example.
My user directory's .bashrc and .bash_profile are of course the same, as both are using the same user directory. I've looked into Cygwin's /etc/bash.bashrc and there doesn't seem to be anything there to change my current directory, and there aren't any other relevant files in /etc.
What could be causing Cygwin's bash to change directory?
you just add a command "cd /dir_you_want" at the bottom of ~/.bashrc in cygwin
I've figured it out, so in case anyone runs into the same issue:
There's one file I neglected to look into, because I didn't know it exists, /etc/profile. In Cygwin, by default it has the following section in it:
# Make sure we start in home unless invoked by CHERE
if [ ! -z "${CHERE_INVOKING}" ]; then
unset CHERE_INVOKING
else
cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!"
fi
Disabling that solves the issue of course.
Attemping
wget -qO- https://toolbelt.heroku.com/install.sh | sh
as instructed by this article yields this message.
Add the Heroku CLI to your PATH using: $ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile
So I type
echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile
and I see that the string has been added to the .profile file, located at /home/myusername/
Then I run the command again
wget -qO- https://toolbelt.heroku.com/install.sh | sh
and I still get the same error.
I'm not sure if what current directory I'm running these commands from is important, but I've tried being in the default terminal directory, rather than my specific app, and still the same results.
I found out that the /usr/ directory is directly underneath the / directory, NOT my /home/myusername/ directory so I modified the path to go up two levels, first like so:
PATH="../../usr/local/heroku/bin:$PATH"
But even that didn't seem to work - I don't get the "heroku" command available.
You have to log into linux profile again to activate the ~/.profile script, thus adding the path. Either log out of the linux session, and then lack back in, or restart your computer.
You can also do source ~/.profile, but this will only enable heroku commands in the current terminal, and not work if you close it.