I want to make a global alias for killprocessatport
so I put at the end in /etc/bash.bashrc
fuserfunction() {
fuser -KILL -k -n tcp
it does not work because when you do:
bash /etc/profile
you open a new shell, execute the profile script, and get back to your current shell.
Actually, that's why to load the content of /etc/bash.bashrc
you do source /etc/bash.bashrc
in the /etc/profile
.
Thus to load it in your current shell, you should run:
source /etc/profile
instead.
Nota Bene:
~/.bashrc
which gets automatically sourced by bash on load ;/etc/profile.d
where it will be automatically sourced on new shell instances ;killprocessatport
to fuserfunction
. Though, you may prefer to do an alias for a call to the function with a parameter like: alias killhttpserver=fuserfunction 80
fuserfunction
, something like fuserkillproc
or even something better you may come up with…HTH