Create your own command on linux

Last update on May 7, 2009 08:47 AM by hyts78
Published by hyts78

Create your own command on linux






Creating a Bash script


It’s important to create a Bash script which will run your command.
Let’s see:


#!/bin/bash

#on displays the actual folder name
echo "the folder is `pwd`"

#then the rest of the files
echo "The folder which contains files are `ls`"



Save this file (CTRL + O with Nano) give it the name of your command (Example: FileInfos)

Turning the command active (Executable)


Try to type the name of your bash script, you will notice that it won’t execute.

Now you have to modify the CHMOD of the script which you will run by typing:

chmod +x yourScript



Now, copy your script in the path, /usr/bin like below:

cp yourscript /usr/bin/



Now you are done! Run your command by typing the script name which you moved in /usr/bin.
Best answers for « Create your own command on linux » in :
Creating your own command Show Creating your own command This tips is designated to show you how to create your own command. Here the example will be taken on a command for running Mozilla Firefox. First of all, open the registry by : Start> Run >...
Creating an ISO image under Linux ShowCreating an ISO image under Linux Create ISO image(which we will name) a disc in a CD-ROM drive(/dev/cdrom) is quite simple : dd if=/dev/hdd of=mycd.iso
Start/stop a service using command line ShowStart/stop a service using command line The netsh tool (netsh.exe) can automate the startup or shutdown of a service through the following command line: To start a service: Net start name_of_service To stop a service:...
How to resize a disk partition ShowHow to resize a disk partition For Windows Vista users Solution 1: Using Disk Management Solution 2: Using Command Prompt Software Download There are some simple ways to manage your disk partitions to either expand or reduce them....
Download LC ISO Creator ShowLC ISO Creator is very simple: it allows to create a .ISO file from your CD. Then, it allows you to burn these ISO files, to use CD emulation software (in order not to use any more the original CD) or to make a backup copy. The software is...
Linux commands ShowTable of main Linux commands Command Description DOS equivalent ls lists the content of a directory dir cd change directory cd cd .. parent directory cd.. mkdir creates a new...
Linux - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence the name "shell". The shell therefore acts as an intermediary between the operating system and the user thanks to command lines...
Using FTP commands ShowThe FTP protocol FTP (File Transfer Protocol) is a protocol — meaning a standard language that lets two machines communicate — used so that computers of different types (or with different operating systems) can transfer files over a...