You are on page 1of 3

HOMEWORK CSE207T : Linux Programmming Date of Submission : 18th September 2012 M.M.

: 30

NOTE: 1. Homework submission mode is online only. 2. No submission will be accepted after the specified submission date. 3. The uploaded file must only be a Word document (.doc) only. No PDFs etc will be considered. 4. The homework should be the original work done by the student and not a copy of any other student. Copy cases will be given zero mark. 5. Each question is compulsory. There is no choice. Q1. a) The current permissions on a file are rw-r--r--. I want the permissions to be read and execute for the user, read and write for group and none for others. How can it be achieved? b) Compare GNOME and KDE. Write key attributes of an open source software. What is the purpose of /bin, /etc, /lib and /dev directories? a) What is the difference in use of ? and + when used with shell and with grep command? b) Suppose there is a directory structure as: /home/user/f1/f2/f3/f4.txt You are currently in /home/user. Write the command to delete f2. c) Suppose there is a directory structure as: /home/user/f1/f2/f3 There is a file named hello.txt in f1. Considering you current directory is /home/user, write a command to move the file hello.txt from its current location to directory f3. a) Which command will be used to delete a directory containing a file?
Deleting Directories If you created a directory named spelunking six months ago, and now you're not so keen on crawling through slimy caves, the rmdircommand may be able to help: $ rmdir spelunking This command removes the specified directory, but only if it's empty. If the directory contains files or subdirectories, you'll have to delete them using rm first.

[2] [3] [1] [2] [2]

Q2.

Q3.

[1]

b) What will be the output of the following commands? (i) $ ls - l | sort > file1.txt (ii) $ who | sort >>file1.txt Q4.

[2] [2]

Illustrate the steps to write, compile and execute a C program in Linux [5]

environment using a program to find largest of 3 numbers. Q5. What is the role of a boot loader? Which one is better, installing windows [5] over Linux or installing Linux over windows? Find out the possible errors for both the scenarios Role of a Bootloader When power is first applied to a processor board, many elements of hardware must be initialized before even the simplest program can run. Each architecture and processor has a set of predefined actions and configurations upon release of reset, which includes fetching initialization code from an onboard storage device (usually Flash memory). This early initialization code is part of the bootloader and is responsible for breathing life into the processor and related hardware components. Most processors have a default address from which the first bytes of code are fetched upon application of power and release of reset. Hardware designers use this information to arrange the layout of Flash memory on the board and to select which address range(s) the Flash memory responds to. This way, when power is first applied, code is fetched from a well-known and predictable address, and software control can be established. The bootloader provides this early initialization code and is responsible for initializing the board so that other programs can run. This early initialization code is almost always written in the processors native assembly language. This fact alone presents many challenges, some of which we examine here. Of course, after the bootloader has performed this basic processor and platform initialization, its primary role is fetching and booting a full-blown operating system. It is responsible for locating, loading, and passing control to the primary operating system. In addition, the bootloader might have advanced features, such as the capability to validate an OS image, upgrade itself or an OS image, or choose from among several OS images based on a developer-defined policy. Unlike the traditional PC-BIOS model, when the OS takes control, the bootloader is overwritten and ceases to exist.

Q6.

What are Environment Variables? How a C program can gain access to

[5]

environment variables? Give examples.

You might also like