Search code examples
command

How can i make my custom command available to all user in linux


I have written a custom command under user 'krishna' on my laptop, and now i want it to be available for other all user without redefining to each user. For now, i have defined the command in /home/krishna/.bashrc As this file exist under user krishna and work only for krishna. is there any way i can defile it globally for all users?


Solution

  • You can define the command in the /etc/bashrc or /etc/bash.bashrc file (which one depends on your distribution). One of these should exist on your machine.

    Commands you define in your local /home/[USER]/.bashrc are only available for [USER]. Commands or aliases defined in /etc/bashrc are available for all users.