Pages

Thursday, February 21, 2013

How to create your own command in linux


If you want to add your own command in linux operating system then

write any script.for example i want to add command which displays present

working directory with list of files or folders under it.then type following in gedit or any editor

#!/bin/bash

echo "present directory is `pwd` "

echo "files are `ls` "

save it with any name say pwdfiles

now make it executable

chmod +x pwdfiles

now copy it to /usr/bin directory.

cp pwdfiles /usr/bin/