Custom Search

Monday, May 12, 2008

UNIX - Introduction, cont.d...(Part-II)

1.1 Listing files and directories

-
ls (list)
-
When you first login, your current working directory is your home directory. Your home directory has the same name as your user-name, for example, ee91ab, and it is where your personal files and subdirectories are saved. To find out what is in your home directory, type

% ls

The ls command lists the contents of your current working directory.


-
There may be no files visible in your home directory, in which case, the UNIX prompt will be returned. Alternatively, there may already be some files inserted by the System Administrator when your account was created.
-
ls does not, in fact, cause all the files in your home directory to be listed, but only those ones whose name does not begin with a dot (.) Files beginning with a dot (.) are known as hidden files and usually contain important program configuration information. They are hidden because you should not change them unless you are very familiar with UNIX!!!
-

To list all files in your home directory including those whose names begin with a dot, type

% ls -a
As you can see, ls -a lists files that are normally hidden.



ls is an example of a command which can take options: -a is an example of an option. The options change the behaviour of the command. There are online manual pages that tell you which options a particular command can take, and how each option modifies the behaviour of the command. (See later in this tutorial)

-
-

1.2 Making Directories

mkdir (make directory)
-
We will now make a subdirectory in your home directory to hold the files you will be creating and using in the course of this tutorial. To make a subdirectory called unixstuff in your current working directory type

% mkdir unixstuff

To see the directory you have just created, type

% ls

-
-
1.3 Changing to a different directory
cd (change directory)

The command cd directory means change the current working directory to 'directory'. The current working directory may be thought of as the directory you are in, i.e. your current position in the file-system tree. To change to the directory you have just made, type

% cd unixstuff

Type ls to see the contents (which should be empty)

-

As an exercise, you may want to try out making another directory inside the unixstuff directory called backups

-

1.4 The directories . and ..

Still in the unixstuff directory, type

% ls -a

As you can see, in the unixstuff directory (and in all other directories), there are two special directories called (.) and (..)

-

The current directory (.)

In UNIX, (.) means the current directory, so typing

% cd . NOTE: there is a space between cd and the dot

means stay where you are (the unixstuff directory). This may not seem very useful at first, but using (.) as the name of the current directory will save a lot of typing, as we shall see later in the tutorial.

-

The parent directory (..)

(..) means the parent of the current directory, so typing

% cd ..

will take you one directory up the hierarchy (back to your home directory). Try it now.

Note: typing cd with no argument always returns you to your home directory. This is very useful if you are lost in the file system.

-

1.5 Pathnames

pwd (print working directory)

Pathnames enable you to work out where you are in relation to the whole file-system. For example, to find out the absolute pathname of your home-directory, type cd to get back to your home-directory and then type

% pwd

The full pathname will look something like this - /home/its/ug1/ee51vn

which means that ee51vn (your home directory) is in the sub-directory ug1 (the group directory), which in turn is located in the its sub-directory, which is in the home sub-directory, which is in the top-level root directory called " / " .


-
As an exercise, you may want to try out the commands cd, ls and pwd to explore the file system. (Remember, if you get lost, type cd by itself to return to your home-directory)
-


1.6 More about home directories and pathnames

Understanding pathnames

First type cd to get back to your home-directory, then type

% ls unixstuff

to list the conents of your unixstuff directory. Now type

% ls backups

You will get a message like this - backups: No such file or directory

The reason is, backups is not in your current working directory. To use a command on a file (or directory) not in the current working directory (the directory you are currently in), you must either cd to the correct directory, or specify its full pathname. To list the contents of your backups directory, you must type

% ls unixstuff/backups

-

~ (your home directory)

Home directories can also be referred to by the tilde ~ character. It can be used to specify paths starting at your home directory. So typing

% ls ~/unixstuff

will list the contents of your unixstuff directory, no matter where you currently are in the file system. What do you think

% ls ~

would list? What do you think

% ls ~/..

would list?



Summary

Commands & their Meaning
ls => list files and directories
ls -a => list all files and directories
mkdir => make a directory
cd directory => change to named directory
cd => change to home-directory
cd ~ => change to home-directory
cd .. => change to parent directory
pwd => display the path of the current directory

-
Acknowledgement:

This tutorial is sourced from http://www.ee.surrey.ac.uk/Personal/M.Stonebank/ which can be found at this link.

Licensing:

This work is licensed under a Creative Commons License.

Disclaimer:

This disclaimer frees from legal & otherwise terms Mr. Amol Thosar ("The Author"), the author of this blog/site & clarifies that The Author is not liable for any issue(s) arising in connection with anything published on this Blog/site or use/mis-use of the content thereof in this or another site.

UNIX :- Introduction

What is UNIX?
UNIX is an operating system which was first developed in the 1960s, and has been under constant development ever since. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops.

UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment. However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no windows interface available, for example, in a telnet session.
-

Types of UNIX
There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
Here in the School, we use Solaris on our servers and workstations, and Fedora Linux on the servers and desktop PCs.
-
-
The UNIX operating system
The UNIX operating system is made up of three parts; the kernel, the shell and the programs.
-
The kernel
The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls.
As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to the user, indicating that it is waiting for further commands.
-
The shell
The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems).
The adept user can customise his/her own shell, and users can use different shells on the same machine. Staff and students in the school have the tcsh shell by default.
The tcsh shell has certain features to help the user inputting commands.
Filename Completion - By typing part of the name of a command, filename or directory and pressing the [Tab] key, the tcsh shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.
History - The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.
-

Files and processes
Everything in UNIX is either a file or a process.
A process is an executing program identified by a unique PID (process identifier).
A file is a collection of data. They are created by users using text editors, running compilers etc.
Examples of files:
1. a document (report, essay etc.)
2. the text of a program written in some high-level programming language
3. instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file);
4. a directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files.
-
-
The Directory Structure
All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash / )
-
-
-
-
-


Image 1: UNIX File Structure
-


In the diagram above, we see that the home directory of the undergraduate student "ee51vn" contains two sub-directories (docs and pics) and a file called report.doc. The full path to the file report.doc is "/home/its/ug1/ee51vn/report.doc"
-
-
Starting an UNIX terminal
To open an UNIX terminal window, click on the "Terminal" icon from the drop-down menus.
-
-


Image 2: Gnome Menus


-


-


-
An UNIX Terminal window will then appear with a % prompt, waiting for you to start entering commands.
-
-
-


Image 3: UNIX Terminal Window


-
-
-
Acknowledgement:
This tutorial is sourced from
http://www.ee.surrey.ac.uk/Personal/M.Stonebank/ which can be found at this link.

Licensing:

This work is licensed under a Creative Commons License.

Disclaimer:
This disclaimer frees from legal & otherwise terms Mr. Amol Thosar ("The Author"), the author of this blog/site & clarifies that The Author is not liable for any issue(s) arising in connection with anything published on this Blog/site or use/mis-use of the content thereof in this or another site.

Few Jokes found while crawling the Web

Vampire Attack
Patient: Doctor, I think that I’ve bitten by a vampire.
Doctor: Drink this glass of water.
Patient: Will it make me better?
Doctor: “No, but I’ll be able to see if your neck leaks.”

Planting Flowers
A prisoner in jail receives a letter from his wife: “Dear Husband, I have decided to plant some flowers in the back garden. When is the best time to plant them?”
The prisoner, knowing that the prison guards read all mail, replied in a letter: “Dear Wife, whatever you do, do not touch the back garden. That is where I hid all the money.”
A week or so later, he received another letter from his wife: “Dear Husband, You wouldn’t believe what happened, some men came with shovels to the house, and dug up the entire back garden.”
The prisoner wrote another letter back: “Dear wife, now is the best time to plant the flower.”

Manager's Advice">Manager'>Manager'>http://www.jokesgallery.com/joke.php?joke=5131&id=1"> Manager's Advice
Circle'>Circle'>http://www.jokesgallery.com/joke.php?joke=4978&id=1"> Circle Of Life

Taxi'>Taxi'>http://www.jokesgallery.com/joke.php?joke=4859&id=1"> Taxi Incident

Tuesday, April 29, 2008

Bajaj's Small car may cost > Rs 1 lakh!

The following article appeared at Rediff.com on 8th January 2008. Reproducing this article for the benefit of visitors to this Blog. The original article is available by clicking here. Some or most of the content of this post is sourced from one or more sites.

The country's second largest bike maker Bajaj Auto Ltd on Tuesday cocked a snook at those who sniggered at its efforts to get into the passenger car market. The company silently unveiled its 'Lite' concept car in New Delhi, two days before the much hyped launch of Tata Motors' Rs 1 lakh car. The car, which reminds you of the Matiz front on, but has a very upright auto-like back has been conceptualized by the Baja j team at Akurdi, near Pune. Bajaj Auto expects to launch its small car in the next four years in partnership with Renault and Nissan. They are developing both diesel and petrol engines. Bajaj Auto will also be setting up a new manufacturing unit in Chakan that will manufacture the small car and light commercial vehicle. Bajaj has done away with the centre panel and placed the two front seats touching each other. The gear shaft has been mounted on the dashboard. The company said it will also take inputs from Renault-Nissan for development. In a statement, the company said, 'The Lite concept would first offer low running costs and affordable monthly outflows coupled with a reasonable cost of acquisition. This would lead to unbeatable total cost of operation'. The company did not reveal any specification, price or launch date. The initial installed capacity will be 250,000 units and the company will look at exporting the car, BAL managing director Rajiv Bajaj said.

Bajaj also said it will launch three two-wheelers in the executive and premium segment during 2008. The company would launch two motorcycles -- XCD 125 cc DTS-i Sprint and Discover 150 cc DTS-i and one scooter 125 cc Blade within this year. "The 125 cc motorcycle segment is getting crowded so we would upgrade the Discover to 150 cc," BAL CEO (two-wheelers) S Sreedhar told reporters in New Delhi.

Source: Rediff.com, IndiaCar.com, Sites opened from Google.com

Some Famous Quips (collected from Web)

1. If time doesn't wait for you, don't worry! Just remove the damn battery from the clock and Enjoy life!
2. Expecting the world to treat u fairly coz u r a good person is like expecting the lion not to attack u coz u r a vegetarian. Think about it.
3. Beauty isn't measured by outer appearance and what clothes we wear but what we are inside. So, try going out without clothes tomorrow and see the admiration!
4. Don't walk as if you rule the world,walk as if you don't care who rules the world! That's called Attitude…! Keep on rocking!
5. Every lady hopes that her daughter will marry a better man than she didand is convinced that her son will never find a wife as good as his father did!!!
6. He was a good man. He never smoked, drank & had no affair. When he died, the insurance company refused the claim.They said, he who never lived, cannot die!
7. A man threw his wife in a pond of Crocodiles? He's now being harassed by the Animal Rights Activists for being cruel to the Crocodiles!
8. So many options for suicide: Poison, sleeping pills, hanging, jumping from a building, lying on train tracks, but we chose Marriage, slow & sure!
9. 80 percent girls have brains, rest have boyfriends!
10. All desirable things in life are either illegal, banned, expensive or married to someone else!
11. Laziness is our biggest enemy- Jawaharlal NehruWe should learn to love our enemies- Mahatma GandhiAb aap bataaye kiski sune bapu di ya chacha di???
12. When things go wrong, when sadness fills your heart,When tears flows from your eyes always say these words…Eh Ganpat, chal daru la…