user space command

Hi Folks;

Can I create a new user space command in FreeBSD and how? I mean when a type "mycommand" I want to run something. is that possible?
 
Or a binary program (written in C for e.g.) and located in $HOME/bin or - as a standard port - in /usr/local/bin/.
 
Just add the directory that the binary file (or chmod +x'd script) is in to your $PATH, or to make it globally available, throw it in /usr/local/bin/. If it's just for one user, I'd make a ~/bin/ and add that to $PATH.
 
Spoon feeding examples:

Code:
mkdir ~/bin
create a script ~/bin/showopenports
Code:
#!/bin/sh
sockstat -4 -6
Set perms
Code:
chmod +x ~/bin/showopenports
Set path (add to your profile file):
Code:
set PATH = ( $PATH\:$HOME/bin )
OR
Code:
setenv PATH $PATH\:$HOME/bin
Run it
Code:
showopenports

For more info read tcsh man page.
 
my bad :(

this is what happen when you work with 12 types unix like oses everyday. Sometime at the end of day I type bsd or linux command on AIX or HP-UX and then wonders why it is not working .. lol
 
Back
Top