-1

I made a command for a user user1 so when i write in terminal cool-retro-term it runs the application

If I switch user to user2 and I try to run cool-retro-term or sudo cool-retro-term it says the command not found

I want to know how to make the command usable for all users. Until now I installed and compiled the application like they said. then i made a bash script in /home/user1/bin where i added

#!/bin/bash
/home/user1/cool-retro-term/cool-retro-term

to run my application

I modified .bashrc PATH=$PATH:/home/crs/bin and then I ran chmod u+x /home/crs/bin/cool-retro-term

I EDITED my question 

i want to make my command something like ls or cd or other command usable for all users. something like that . ANY IDEAS?

xyz
  • 159
  • It would be cool, if you would upvote the posts and comments of the question, that helped you do that in the first place.. – Bernd Nov 01 '14 at 11:37

2 Answers2

2

Copy the file over to a directory that is in everyone's $PATH. You can check the path with echo $PATH. This should be a default path:

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

My suggestion would be the bin directory in local. So that would be

/usr/local/bin/

Avoid general bin directories like /bin, /usr/bin, /sbin and /usr/sbin. Keep those directories clean so you know where your system files and your personal files are.


I would also advice something else: if possible (ie. those users are similar in permissions) you can also add both users to the same group. That way permisssions for one also apply to the other.

terdon
  • 100,812
Rinzwind
  • 299,756
  • i moved like you said in /usr/local/bin but it still says that i can't execute with user2 – xyz Nov 01 '14 at 11:51
  • Check the permissions of the file and make sure user2 is included in those permissions; adding user2 to the same group as user1 is the best method ;) – Rinzwind Nov 01 '14 at 11:55
  • and is a command to make permissions for all user in one time? or i need to edit the permision for each user? – xyz Nov 01 '14 at 11:58
  • Maybe you need to sudo chmod +x /usr/local/bin/cool-retro-term – Gunnar Hjalmarsson Nov 01 '14 at 12:01
1

Move everything from /home/crs/bin to /usr/local/bin.

Be aware, you need to be root to do that.

muru
  • 197,895
  • 55
  • 485
  • 740
Bernd
  • 564