bluepinto bluepinto - 7 months ago 30
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?



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: