Linux

Terminal

Terminal :

         Terminal is an interface in which you can type and execute text based commands. It can be much faster to complete some tasks using a terminal than with graphical applications and menus. Another benefit is allowing access to many more commands and scripts. Similar to Terminal,we have Command prompt (cmd) in Microsoft Windows.

Alternative names for the terminal:

  • Console
  • Shell
  • Command Line
  • Command Prompt

   I am going to use Terminal on Ubuntu 14.04 Linux Distribution. Go to launcher and type terminal/Terminal ,also you can use terminal shortcut Ctrl+Alt+t  to get to terminal.

And here we go..

The best fun in linux is to play  terminal with commands and scripts to make things done.

Assume we are playing game, It will learn and enjoy a lot.

  • Whats today’s date ?

Command: date

Output :  Mon Jan  5 17:07:43 IST 2015.. this is my time.

format is : Day Month Date Time Time-Format Year

IST: Indian Standard Time

Time is according to 24 hour clock.

  • Want to see calender ?

Command: cal

                 Output: it will view the going month calender including dates and days.

To see the other month calender:

Command format: cal [Month] [Year]

Command: cal Mar 2015

Command: cal March 2015

Command: cal 3 2015

These 3 variety of command you can enter to get calender of any month.

  • Who are the users on the system you are sitting ?command: whooutput:  The row after command written is details of system : at what time the system is started ..can be indicated by system name :0 and see next line to it system name pts/0 indicates that the one terminal window is open.Try this: Open one more terminal without closing other terminals. Type ‘who’ and compare the two output on terminals. Again open one more terminal , don’t close other terminals ,type who command..see the difference.

    Output format: user_name terminal_name_working_on date time (leave it for time-being)
  • How to view the process ?Command: psOutput :PID TTY          TIME CMD

    1216 pts/0    00:00:00 bash

    1230 pts/0    00:00:00 ps …in my terminal

    PID: Process ID

         TTY:  “TeleTYpewriter” which were devices that allowed users to connect to   early computers.

     For the next Command …

    Now, Lets go to GUI of the Ubuntu.  Like windows in users folder, In Linux we have ‘Home’. In that folder we have all data and named as: Desktop,My Videos,My Music,My Pictures.. similar to windows. Files are organized in separate folders called directories.

    Now lets return to Terminal ,

  • How to list  folders and files in My Home?Command: lsOutput: List the names of the files available in the Home directory.Output As..

    shrenoid@shrenoid-Inspiron-5520:~$ ls

    bealert of this~   ideapage~                  recordnote2.txt~

    bealert of this~~  jdk1.7.0_67                recordnote.txt~

    car.java~          jdk-7u67-linux-x64.tar.gz  rgb.txt~

    Desktop            Music                      Templates

    Documents          Pictures                   Untitled Document~

    Downloads          Public                     Videos

    examples.desktop   readthis.pdf

    greatlines.txt~    recordnote1.txt~

  • How to copy the output text to file ?Using Symbol ‘>’Command: ls > note1 …without any spaceoutput: there is no output displayed on terminal. Cursor returns next to $ sign. Then how to see the contains of the file.

    Here’s the Next Command,

  • To see content of file,      Command: cat [file name]Type: cat note1Output: U will get all contains of the file note1 on the terminal screen
  • How to count the Number of lines in a file ?Command: wc [file name]Output format: [no of lines] [no of words] [no of characters]Type: wc note1

    Output: something output like

    shrenoid@shrenoid-Inspiron-5520:~$ wc list

    15  16 168 list

    where 15 is no of lines

    16 is no of words

    168 is no of characters of list file.

  • How to change directory?Command: cd [directory name/folder name]If folder name is Documents in home folder.Command: cd Documents

               And you will be in that folder with indication: ~/Documents$

    If folder is in present folder or not can be checked using:

    ‘ls’ command or using ‘nautilus .’ command.

  • In which location i am working now ?Command: pwdOutput: It gives current working location.

    shrenoid@shrenoid-Inspiron-5520:~$ pwd

    /home/shrenoid

    To go back to previous folder :

    Command: cd .. ..pay attention on space between cd and .. .

    Is there much mess on the screen :

  • We need to clear out the screen? How to do it?Command: clearOutput: terminal will have clean and fresh screen.

     

     

  • You must have loved the game, Surely you will not like to exit the terminal ,If you want to exit do using -Command: exitOutput: terminal window will be closed.

Leave a Reply

Your email address will not be published. Required fields are marked *