Hey guys.... Wanna create your own Linux command ???
Well, that's so simple:-)
Step 1 : First write a program
ex: #include<stdio.h>
int main()
{
printf(" This is your new command" );
return 0;
}
Once the program is ready save it and compile it to get a.out file
The output of a program will be your command output so, write program according to what you want your command should output..
Step 2 : Place your executable file (a.out) in "/usr/bin" path where all the binary files will be present as follows, before that you can change the name of the a.out to any name you like ...
I have changed to "mycommand" using following command
gcc -o mycommand myprogram.c
command: sudo cp mycommand /usr/bin
Step 3 : Now execute "mycommand" as you use to do with built in Linux commands.
Congrats !!! You now have your own command
Download the complete source code from here
Feel Happy:-) and please leave your doubts or suggestions in comments section..
i know this is dumb question but i am very new to unix am using opensuse os can you tell me where can i find usr/bin
ReplyDeletehi i appreciate your interest !! as far as this post is concerned , you need to just type this
ReplyDeletecommand: sudo cp mycommand /usr/bin
as mentioned in step 2 but if you want to check it manually , you can open your home folder and navigate to your file system(present in the sidebar) and find the usr folder..
alternatively you can do it in the terminal by just typing the following command
Command : cd ..(This will take you to the parent folder)
Now type the following command and you will find the usr folder , to move to your bin folder , just type cd bin
Thats it !!!!!
vignesh has also posted http://wetechies.blogspot.in/2013/05/instructions-to-compile-and-execute-cc.html
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
8DC85