bluepinto bluepinto - 1 year ago 64
Linux Question

How to make my Linux C program accessible from bash

Say I made and compiled a small program in

to count the bytes of a file, called
. To run it I would use

Now I want to make it universal on bash, like for example to run a php file, I would use
php file.php
, same way I would like to run my program,
filebyte filename

How do I do this?


Answer Source

I often create a bin/ directory in my home directory, for small custom applications.

You then need to add that directory to your PATH, which is a list of colon-separated paths that your shell searches for executables when you type a name on thr command line.

This is usually accomplished by putting this in your ~/.bashrc file:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download