Friday, 18 January 2013

Some Basic Commands UNIX


Displaying the Date and Time: The date Command

The date command tells the system to print the date and time:
$ date

Sat Jul 20 14:42:56 EDT 2002

$

Finding Out Who's Logged In: The who Command

The who command can be used to get information about all users currently logged in to the system:
$ who

pat       tty29    Jul 19 14:40

ruth      tty37    Jul 19 10:54

steve     tty25    Jul 19 15:52

$

The who command also can be used to get information about yourself:
$ who am i

pat       tty29   Jul 19 14:40

$

who and who am i are actually the same command: who. In the latter case, the am and i are arguments to the who command.

Echoing Characters: The echo Command

The echo command prints (or echoes) at the terminal whatever else you happen to type on the line (there are some exceptions to this that you'll learn about later):
$ echo this is a test

this is a test

$ echo why not print out a longer line with echo?

why not print out a longer line with echo?

$ echo A blank line is displayed

$ echo one

change your IP address


This article will help you to change your IP address within a minute. Just follow the following steps.

1. Click on "Start" in the bottom left hand corner of screen
2. Click on "Run"
3. Type in "command" and hit ok

You should now be at an MSDOS prompt screen.

4. Type "ipconfig /release" just like that, and hit "enter"
5. Type "exit" and leave the prompt
6. Right-click on "Network Places" or "My Network Places" on your desktop.
7. Click on "properties"

You should now be on a screen with something titled "Local Area Connection", or something close to that, and, if you have a network hooked up, all of your other networks.

8. Right click on "Local Area Connection" and click "properties"
9. Double-click on the "Internet Protocol (TCP/IP)" from the list under the "General" tab
10. Click on "Use the following IP address" under the "General" tab
11. Create an IP address (It doesn't matter what it is. I just type 1 and 2 until i fill the area up).
12. Press "Tab" and it should automatically fill in the "Subnet Mask" section with default numbers.
13. Hit the "Ok" button here
14. Hit the "Ok" button again

You should now be back to the "Local Area Connection" screen.

15. Right-click back on "Local Area Connection" and go to properties again.
16. Go back to the "TCP/IP" settings
17. This time, select "Obtain an IP address automatically"
tongue.gif 18. Hit "Ok"
19. Hit "Ok" again
20. You now have a new IP address


Wednesday, 9 January 2013

THE FIBONACCI SEQUENCE


The Fibonacci sequence starts with the terms 1 and 1, and each successive term is the sum of the previous two terms. A Fibonacci printing program is simple, and it demonstrates how to declare variables, write a simple loop, and perform basic arithmetic. Here is the Fibonacci program:


class Fibonacci {
/** Print out the Fibonacci sequence for values < 50 */
public static void main(String[] args) {
int lo = 1;
int hi = 1;
System.out.println(lo);
while (hi < 50) {
System.out.println(hi);
hi = lo + hi; // new hi
lo = hi - lo; /* new lo is (sum - old lo)
that is, the old hi */
}
}
}