Thursday 8 November 2012

TERMINAL and common commands



HOW TO WORK ON TERMINAL



When we talk about Linux, then first thing comes in our mind is that- how to work and where to work?
Usually, we operate a Linux-based system through a Command Line Interface (CLI) or a Graphical User Interface (GUI). We usually interact with a modern UNIX shell using a Command Line Interface known as TERMINAL EMULATOR Window or some separate Virtual Console. Common terminals as we know already are- xterm and GNOME Terminal.

WHAT IS A TERMINAL?
Terminal is the graphical platform where the commands can be executed. There are various other terminals used in different Linux-based System. Commands tell the operating system to perform set of operations. All these commands are going to be written in a command line interface i.e. Terminal.
When we log into a terminal then we see some text written in the terminal window as: user_name@linux_machine_name:~current_path$
          Keertendra@keertendra-virtual-machine:~$



In Linux system, there is one special user for administrator, which has all permissions and access to all files. This user is known as “SUPER USER” or “ROOT”. The Dollar sign “$” indicates that we are not the root user and the path starts with a symbol “~, which corresponds to “/home/user_directory/”. User is also having his own directory known as Home Directory. For example:
Keertendra@keertendra-virtual-machine:~/Desktop/Linux_Programs$

Now to login as Super User or root, we have to use a command “sudo su” then it will ask for the password, type the correct password and we will successfully logged in as root/ Super User. It can e verified by Pound sign “#” instead of Dollar sign “$”. Now the path is shown from the root “/” directory. For example:
root@keertendra-virtual-machine:/home/keertendra#





HOW TO USE COMMANDS?

Commands are the set of key words and arguments which are used to perform some specified operation. In Linux-based System, there are a numerous commands to perform various tasks. These commands are written according to a specified syntax.

SYNTAX:COMMAND_NAME   [-OPTIONS]   ARGUMENTS

COMMAND_NAME: indicates the name of the respective command say, help, man, ls, cd, etc.
[-OPTIONS]: Options are used to perform the operation on the selected item in selected manner. The square brackets “[ ]” shows that the use of options in the command is optional. It starts with a hyphen sign (-).
ARGUMENTS: arguments can be any value passed to the command to execute an operation. The operation is to be performed on the arguments. It can be file name, path, text, etc.



**** The Linux is Case- Sensitive. The Command_name, Options and Arguments are separated by a SPACE (“ “) in between.

For example: a command List command (ls) is used here to show details of all the files and folder of the Linux_Programs directory as-

$ ls –l Desktop/Linux_Programs/






WHAT ARE OPTIONS?

The command options are used in the command. Some of the common command options used in LINUX are given below:
-a: it lists all the files and directories, even hidden ones which are preceded by (“.”)
 -l: lists the size, creation date and permissions about all the files and directories in the current directory
 -d: lists the directory
 -c: don’t create file if it already present
 -f: force
 -k: block Size
 -R: recursive
 -t: type
 -V: version.

SOME CONTROL KEYS:
Control Keys performs special function. The control keys used in LINUX are:
Ctrl+S (^S)   : Pause Display
Ctrl+Q (^Q)   : Restart Display
Ctrl+C (^C)    : Cancel Operation
Ctrl+U (^U)    : Cancel Line
Ctrl+D (^D)    : Signal end of file
Ctrl+V (^V)     : Treat control character as normal character

SOME BASIC COMMANDS:


1.    GENERAL PURPOSE UTILITY COMMAND:
MAN, RESET, CLEAR, CAL, DATE, ECHO, PRINTF, BC, XCAL, EXIT etc.
2.    USER LOGIN AND PASSWORD COMMANDS:
SUDO, SU, PASSWD, WHO, WHO AM I, WHOAMI, USERADD, USERDEL, MOUNT, UMOUNT, DF, SHUTDOWN, etc.
3.    FILE COMMANDS:
ls, pwd, cd, TOUCH, mkdir, rmdir, cp, mv, rm, etc.
4.    FILE DISPLAYING COMMANDS:
CAT, TAC, MORE / LESS, etc.
5.    FILE PERMISSION COMMANDS:
CHMOD, CHOWN, etc.
6.    FILTER COMMANDS:
GREP, FIND, LOCATE, PIPE, TEE, HEAD, TAIL, WC, CMP, COMM, SORT, PASTE, CUT, etc.
7.    PROCESS MANAGEMENT COMMANDS:
KILL, KILLALL, PS, TOP, etc.
8.    COMPRESSING & ARCHIVING COMMANDS:
GZIP/ GUNZIP, ZIP/ UNZIP, TAR, etc.


****if there comes any difficulty in using any command then see the MANUAL of that respective command by using a command i.e. “man”. We can also use “help” command and “info” commands as well.

For example: to open the manual entry of commandchmod”.
                $ man chmod



For example: to get help on the command i.e. “cd
                $ help cd


For example: to get information about the command i.e. “mkdir
                $ info mkdir

Ok, this is little bit sufficient for terminal commands and their usage.


About the Author

keertendra

Author & Editor

Hobbyst Researcher and working in electronics domain, M.Tech in VLSI Design and Embedded Systems.

3 comments:

 
2embeddedrobotics © 2015 - Designed by Templateism.com