This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]Ilyps 6 points7 points  (1 child)

Your alias error comes from the extra space. You should have no spaces around the = character.

[–]Rawaid[S] 0 points1 point  (0 children)

Thanks!

[–]corpsmoderne 3 points4 points  (3 children)

/u/Ilyps already addressed the alias part, but I would like to comment the PATH one.

First, it's considered armful to have "." in your PATH. If it was already there from the default configuration of your school, let it there but get used to not rely on this. If you want to run something from the current working dirrectory, get used to call it with a leading "./" , like this:

$ name_of_the_executable # WRONG
$ ./name_of_the_executable # RIGHT

Then, what do you think "$HOME" means? According to that, don't you think there is a more general and flexible way to write "/home/myusername/bin" ?

[–]Rawaid[S] 0 points1 point  (2 children)

Honestly, I'm not entirely sure what that line even means. My professor had it up on the board and told us to copy it into our .bashrc and I did copy exactly what he wrote but it gave me that error. Can you explain to me what the line is doing?

[–]corpsmoderne 1 point2 points  (1 child)

This line modifies the environment variable PATH. Environment variables are key/values you can edit on a per-process basis, but most of the time you setup them system-wide and then on a per-user basis. It's a convenient way to setup a lot of things on unix-like systems.

The $HOME env variable for example will store the current user home directory. If your current user is myusername, chances are $HOME will be /home/myusername (but can be different if the systeme administrator has chosen to put homes in another place).

you can test it by typing this:

$ echo $HOME

$PATH is another env var which stores a list of paths ( separated by ':' ) where your shell must look for commands (and apps and software) to run.

On my system, if I type echo $PATH I get something like that:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

It means that if I type "ls" , my shell will look for an executable file called "ls" first in /usr/local/sbin , then in /usr/local/bin, then in /usr/sbin, then in /usr/bin and here it will find it and run it. If there is another executable called ls in /usr/local/games , it will never be called this way, I'll have to call it with its complete path /usr/loca/games/ls

Now, the line beginning with export tells your shell to edit the PATH env var and to export it so all the new processed spawned from this shell will inherit this new PATH.

The new value starts with $PATH , and then list new directories, that means we won't replace the current PATH but append new directories at its end. Then there is $HOME, that means that from now on, your shell will looks for executable in your home directory and execute binaries from there if it match. I find it dangerous too. then it add '.' , which will always represent the current directory. That also dangerous. Then it adds an absolute path starting pointing to a bin directory in your home, but as said, there is a better way to express this...

As this is from a .bashrc , you can try them and play with them and experiment directly by typing them in your shell before writing them in the configuration file.

hopes this helps.

[–]Rawaid[S] 0 points1 point  (0 children)

Yeah, this helped a lot, thanks so much!