0% found this document useful (0 votes)
1K views2 pages

Solution Manual Your Unix 2nd Edition Sumitabha Das

This document contains solutions to exercises from Chapter 1-3 of the book "Your UNIX: The Ultimate Guide". It provides answers to questions about operating systems, system calls, file permissions, directories and hidden files. Key points covered include how the OS allocates resources to programs, when a process vacates the CPU, the differences between multiprogramming and multitasking, and how directories store information about files.

Uploaded by

Rohan Sakpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views2 pages

Solution Manual Your Unix 2nd Edition Sumitabha Das

This document contains solutions to exercises from Chapter 1-3 of the book "Your UNIX: The Ultimate Guide". It provides answers to questions about operating systems, system calls, file permissions, directories and hidden files. Key points covered include how the OS allocates resources to programs, when a process vacates the CPU, the differences between multiprogramming and multitasking, and how directories store information about files.

Uploaded by

Rohan Sakpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1

Your UNIX: The Ultimate Guide—Solutions to Exercises

Solutions To Exercises

Chapter 1
1.1 The operating system (OS) allocates the CPU, memory and registers to be used by programs in
execution. It also offers a set of programs as additional services for performing routine functions like file
copying, directory removal and so forth.
1.2 It makes a call to the operating system to do the job on its behalf.
1.3 No, when a program needs to perform an operation that doesn’t need the services of the CPU (like
doing a disk I/O operation), the process representing the program vacates the CPU while the operation is
in progress.
1.4 Multiprogramming means that multiple programs can be concurrently present in memory. Multiuser
operation implies that these multiple programs can be run by multiple users. Multitasking means that a
single user can also run multiple programs.
1.5 UNIX design allows commands to be interconnected so one command takes input from another.
This is possible only if the commands are noninteractive. Header information of one command has no
meaning for another, the reason why most UNIX commands don’t produce headers.
1.6 System calls are routines built into the kernel that handle all calls made to the OS. They are available
as functions that can be invoked by C programs designed to run on a UNIX system.
1.7 False, they must use the system calls specified by POSIX.
1.8 [Ctrl-d], logout and exit. The last one will always work.
1.9 README and readme exist as separate files; UNIX filenames are case-sensitive.
1.10 (i) tty shows the filename of your terminal which also shows up against your username in the who
output. (ii) Clears the screen. (iii) id shows the username and the group the user belongs to. (iv) echo $$
shows the PID of your shell which also appears in the ps output.
1.11 The shell. Most systems offer the Bourne, C, Korn and Bash shells.
1.12 The user-id is associated with all files and processes that you create. When you create a file, your
user-id is its owner. When you run a program, your user-id is the owner of the process associated with the
program. When you send a mail to someone, the mail header shows your user-id as the sender.
1.13 The AT&T and Berkeley schools. Two major standards bodies, POSIX and The Open Group, have
developed the Single UNIX Specification that serves as a single reference for all developers.
1.14 The cd command returns you to the directory where you were placed on login irrespective of where
you are currently.
1.15 Because the shell scans the command for special characters and recreates a simplified command
structure that is understood by the kernel.
1.16 They are all represented by files.
Chapter 2
2.1 The command is not executed. The shell ignores all text following the #, so the # could serve as a
comment character in shell scripts.
2.2 (i) UNIX commands are generally not interactive; Windows programs are. (ii) UNIX commands
don’t need to have any specific extensions in their filenames; Windows must have .EXE or .COM .
(iii) UNIX is sensitive to case; Windows is not.
2.3 The current directory doesn’t exist in PATH.
2.4 (i) By changing the value of PATH to include that directory. (ii) By using a pathname of the command.
2.5 In /sbin and /usr/sbin.
2.6 cd is an internal command of the shell.
2.7 The one in /bin is an external command all right, but it’s the shell builtin that is normally executed.

Full file at http://testbank360.eu/solution-manual-your-unix-2nd-edition-sumitabha-das


2

Your UNIX: The Ultimate Guide—Solutions to Exercises

2.8 An option is also an argument. No arguments, the >, < and the words following them are interpreted
by the shell before the command is executed.
2.9 Because the command considers it as one of its options and often generates an error.
2.10 tar -tvf /dev/fd0
2.11 The arguments, 20 and foo.tar, should be reversed because the -f option needs a filename, and the
-b option needs a numeric argument. The command will also work without the hyphen, though POSIX
discourages such use.
2.12 In the first example, cat tries to open the file. In the second example, the Bash shell tries to do the
same.
2.13 The shell compresses multiple spaces to a single space unless they are quoted.
2.14 The > is normally the secondary prompt and appears when an [Enter] is pressed without closing a
quote.
2.15 tail will work either with -f or -r (but not both), and ls can handle multiple filenames.
2.16 man name, man -s 5 name, and man -s 2 name
2.17 Use man -k.
2.18 (i) Use the -e option. (ii) Use echo -n “Filename: “.
2.19 An escape sequence is a string preceded by a \ that assigns a special meaning to the string. \c places
the cursor in the current line, \n prints a newline and \t prints a tab.
2.20 printf “%o\n” 255 and printf “%x\n” 255
2.21 script runs another shell process.
2.22 mailx can be used in a shell script in a noninteractive manner. Also, the components of the message
need not be known in advance but can be obtained from shell variables or from the output of another
program.
2.23 Yes, a user can log in multiple times.
2.24 Use uname -n.
2.25 Can’t do that.
2.26 date +”%d/%m/%Y”
2.27 Before accepting input, use stty -echo. To revert to the previous setting, use stty echo.
2.28 The kernel maintains a buffer that stores all keyboard input.
2.29 Use stty intr \^c. The setting is not permanent unless it is placed in a startup script.
Chapter 3
3.1 A directory contains the inode number and filename for every file in its fold. When a file is created or
copied, an entry is added to the directory. When the file is deleted, its corresponding directory entry is
removed. When a file is renamed, the existing directory entry is updated with the new name. The size of
a directory is small because it is related to the number of files and not to their contents.
3.2 A device file is simply an interface to the actual device. When a command accesses a device file, the
kernel identifies the actual device from the file’s attributes, and then uses these attributes to operate the
device.
3.3 (i) Won’t work without the -p option. (ii) Will work. (iii) Will work only if c is empty. (iv) Can’t
remove a when a/b exists, so the command will remove only a/b. (v) Won’t work since /bin is not
writable by nonprivileged users.
3.4 (i) The directory c_progs is not empty. (ii) c_progs is an ordinary file. (iii) You don’t have write
permission in the current directory.
3.5 Can’t create (i) and (ii) but can create (iii). Every directory has . and .. as invisible directories and
you can’t create or remove them.
3.6 The directory bar contains hidden files which can only be displayed by ls -a bar.

Full file at http://testbank360.eu/solution-manual-your-unix-2nd-edition-sumitabha-das

You might also like