Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers

up vote 7 down vote accepted

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 like bash 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.

share|improve this answer
add comment

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 .

This package contains the basic file, shell and text manipulation utilities which are expected to exist on every operating system.

Specifically, this package includes: arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false flock fmt fold groups head hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir runcon sha*sum seq shred sleep sort split stat stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink users vdir wc who whoami yes

For inbuilt Clear command functionality in Bash shell you can use Ctrl+L

share|improve this answer
add comment

They are usually written in C, but they might also be ba/sh, python, perl, ... scripts (such adduser being a perl wrapper to useradd). 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.

share|improve this answer
add comment

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) using envcommmand. The rest of the important commands are in /bin or /sbin, which is on your path, giving quick access to these commands almost seamlessly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.