I'm from windows background. I wish to know where do all commands like exit
,clear
comes from in my terminal?
And are they scripts? In what language they have been written?
I'm from windows background. I wish to know where do all commands like exit
,clear
comes from in my terminal?
And are they scripts? In what language they have been written?
this depends:-) Some are internal commands of your shell, some scripts, some are compiled programs.
You can find out more with the
type
command: For example:type type
gives (in my cygwin bash!)type is a shell builtin
.If you type
type bash
, your answer will be something likebash is /usr/bin/bash
.Now you can inspect what type of file /usr/bin/bash is:
file /usr/bin/bash
says something like... executable ...
, so this will be a compiled file, presumably written in C, FORTRAN or whatever. If the answer is something like... script...
you can inspect this file with a normal text editor like gedit, vim or whatever you like.Most of all , i can rather say ALMOST all commands came from UNIX , a Predecessor and fundamental mechanism Behind LINUX.
Most of the Utilities , like
mv- move
,cp- copy
is a utility in Linux since they are utilize to do basic management functions.This holds true for every other such utilities , i would rather say Utilities providing Functionalities to integrate and make it as whole Principle Operation based OS kind of Entity.Now coming to topic , these Commands or Utilities were mostly developed by GNU called Core GNU utilities .
You will find most of the basic commands from Core Utilities description page, said that , Linux is just a Name of Kernel, Whereas Ubuntu is an Entire Advanced Integrated OS of such utilities.
Commands are mostly written in C language , Shell is an Interpreter between kernel and Commands. Bash being the Best of them.
About scripts , not entirely they are not , for scripting purpose Python & Perl are used ,accessible in bash.
Note: In Ubuntu you will find Coreutils installed .
For inbuilt Clear command functionality in Bash shell you can use Ctrl+L
Some of them are part of the functionality of the interpreter you are working at(I presume you are using
bash
), but can be overridden with one that is not built-in(should such an executable exist) usingenv
commmand
. The rest of the important commands are in/bin
or/sbin
, which is on your path, giving quick access to these commands almost seamlessly.They are usually written in C, but they might also be ba/sh, python, perl, ... scripts (such
adduser
being a perl wrapper touseradd
). You can tell which scripting language they are written in by looking at the first line of the script itself or at the line which starts with#!
(eg:#!/usr/bin/perl
). This is of course not valid for compiled C commands.They are located in /bin /sbin /usr/bin /usr/sbin mainly and you can access them from anywhere (giving you the impression of being lower level commands) because they are in your PATH environmental variable.