Linux Distributions: How to Choose One

Linux Distributions: How to Choose One

While there are certainly many versions ("distributions") of Linux to choose from, picking one that is right for you can be straightforward as long as you know your needs and are willing to do some research.
- The balance act: Ubuntu Linux, Red Hat and Fedora Linux, Mandriva Linux, and SuSE Linux offer reliability, flexibility, and user-friendliness. They are the most popular Linux distributions.
- Simple and easy: Lycoris Linux, Xandros Linux and Linspire are good first-time choices.
- For those who are willing to give up convenience to experience the natural, unspoiled simplicity, stability, and security of original Linux distributions: Slackware would be a logical choice.
- Want to try Linux but don’t want to deal with the hassle of installing a new OS? CD-based distributions may be your answer. Knoppix is a popular choice in that category. Ubuntu and many other distributions offer this option as well.
A quick look at the distributions mentioned above:
• Ubuntu Linux is now perhaps the best-known and most popular distribution of Linux. It is well designed, easy-to-use and has advanced the use of Linux as a desktop operating system more any other distribution.
• Red Hat Linux has been around for a while and has acquired a reputation for consistency and reliability. It may not be the easiest to use or the most cutting-edge distribution, but it provides the type of high-quality support that is valued by companies, which made it the de-facto standard in corporate America.
• Fedora Core is a Linux distribution sponsored by Red Hat. The objectives of Fedora Linux differ from those of Red Hat in that Fedora engages the Open Source community and is more experimental in nature.
• Mandriva Linux has been very popular among new and home users. Installation is particularly user-friendly, and it runs by default the KDE Windows-like graphical desktop environment.
• SuSE Linux is a serious alternative for Windows users, with solid, user-friendly installation and configuration tools. Its popularity is held back a little only by somewhat “un-Linux like” business practices, such as not providing ISO installation images for free download. They do, however, offer free FTP installation.
• Lycoris is designed to be a user-friendly Linux distribution with particular emphasis on transitioning from Windows operating systems. Good choice for beginners.
• Xandros Linux is a great choice for beginners who don’t mind to fork over a few dollars to get a worry free product. It is refined and reliable but with proprietary components that prevent re-distribution. No free download.
• Linspire’s one-click web based software installation is quick and easy. An annual fee is charged for accessing Lindows software pool.
• Knoppix provides an excellent run-from-CD solution, with its powerful hardware detection features and pain-free set-up. If desired, the system can be optionally installed on the hard disk to improve performance. It also comes with plenty of software.
• Slackware Linux is a good opportunity to learn about the Linux operating system. It gives you back a long-lost sense of control and empowerment. No longer will you be at the mercy of graphical set-up wizards and mysterious background demons.
If you still don’t know which distribution you want to start with, pick a middle-of-the road distribution such as Red Hat or Mandrake. SuSE appears to be somewhat more popular in Europe. Try one and have fun with it. If you don’t like your first pick, try another one. Once you have a distribution up and running there is generally not a big difference between the common distributions; they share the same kernels and use mostly the same software packages. You can easily add any software packages not included in your original installation.
Important Note: Whenever you experiment with operating system installations you have to be prepared that all content of you hard disk may get lost. Always make sure you have backed up all your important data and software! The easiest way to install a new OS, such as Linux, is to install it on a new (unpartitioned) hard disk, or on a hard disk that still has unpartitioned space (at least several GB).

Linux, the Ultimate Unix

Linux, the Ultimate Unix

Linux – Linus’ Unix
In the fast paced world of computer technology, anything that happened more than 10 years ago appears to be ancient history. Even the origins of Linux, which was once a new kid on the Unix block, start to fade into the distant past.
The first signs of Linux can be traced back as far as the IBM AT compatible PC era around 1991 A.C. A young student at the University of Helsinki, Finland, had an idea: buildng a Unix-like operating system for IBM compatible PCs. The student, Linus Torwalds, was experimenting with Minix, a free Unix OS for PCs, developed by Andrew S. Tanenbaum from Amsterdam, The Netherlands. Linus wanted to develop a Unix OS for his PC that overcame the limitations of Minix. It just so happened that the PC architecture, for which he developed his new and improved Unix OS, would evolve into the world’s most successful line of computers. This formed the basis for Linux’s rapidly growing popularity. Linus’ talent and hard work and the support from the open source community did the rest.
During the second half of 1991, the unthinkable started to become reality when Linus made version 0.02 of what would become known as "Linux" ("Linus' Unix") available to the open source community. By 1994 he was ready to release the first stable Linux Kernel (version 1.0) to the world. Once it was out, it quickly spread, gained power and evolved into a variety of species ("distributions"). Today, there are an estimated 29 Million Linux users; many of them actively involved in developing software for it and continuing development of the kernel.
One of the reasons of Linux’s popularity stems from the license under which it was released, the GNU General Public License. It ensures that the Linux source code is freely available to everyone, and everyone can contribute to its development. This effectively added thousands of programmers to the Linux development team. Despite the concern that many cooks may spoil the soup, it remains a fact that the large number of Linux developers yielded an operating system of unprecedented efficiency and robustness, with countless freely available software packages for both business and pleasure.
Linux Advantages
1. Low cost: You don’t need to spend time and money to obtain licenses since Linux and much of its software come with the GNU General Public License. You can start to work immediately without worrying that your software may stop working anytime because the free trial version expires. Additionally, there are large repositories from which you can freely download high quality software for almost any task you can think of.
2. Stability: Linux doesn’t need to be rebooted periodically to maintain performance levels. It doesn’t freeze up or slow down over time due to memory leaks and such. Continuous up-times of hundreds of days (up to a year or more) are not uncommon.
3. Performance: Linux provides persistent high performance on workstations and on networks. It can handle unusually large numbers of users simultaneously, and can make old computers sufficiently responsive to be useful again.
4. Network friendliness: Linux was developed by a group of programmers over the Internet and has therefore strong support for network functionality; client and server systems can be easily set up on any computer running Linux. It can perform tasks such as network backups faster and more reliably than alternative systems.
5. Flexibility: Linux can be used for high performance server applications, desktop applications, and embedded systems. You can save disk space by only installing the components needed for a particular use. You can restrict the use of specific computers by installing for example only selected office applications instead of the whole suite.
6. Compatibility: It runs all common Unix software packages and can process all common file formats.
7. Choice: The large number of Linux distributions gives you a choice. Each distribution is developed and supported by a different organization. You can pick the one you like best; the core functionalities are the same; most software runs on most distributions.
8. Fast and easy installation: Most Linux distributions come with user-friendly installation and setup programs. Popular Linux distributions come with tools that make installation of additional software very user friendly as well.
9. Full use of hard disk: Linux continues work well even when the hard disk is almost full.
10. Multitasking: Linux is designed to do many things at the same time; e.g., a large printing job in the background won’t slow down your other work.
11. Security: Linux is one of the most secure operating systems. “Walls” and flexible file access permission systems prevent access by unwanted visitors or viruses. Linux users have to option to select and safely download software, free of charge, from online repositories containing thousands of high quality packages. No purchase transactions requiring credit card numbers or other sensitive personal information are necessary.
12. Open Source: If you develop software that requires knowledge or modification of the operating system code, Linux’s source code is at your fingertips. Most Linux applications are Open Source as well.
Today the combination of inexpensive computers and free high-quality Linux operating systems and software provide incredibly low-cost solutions for both basic home office use and high-performance business and science applications. The available choices of Linux distributions and Linux software may be overwhelming at first, but if you know where to look, it shouldn’t take long for you to find good online guidance.

Operating Systems: Unix vs. Windows

Operating Systems: Unix vs. Windows
What is an Operating System
An operating system (OS) is a program that allows you to interact with the computer -- all of the software and hardware on your computer. How?
Basically, there are two ways.
• With a command-line operating system (e.g., DOS), you type a text command and the computer responds according to that command.
• With a graphical user interface (GUI) operating system (e.g., Windows), you interact with the computer through a graphical interface with pictures and buttons by using the mouse and keyboard.
With Unix you have in general the option of using either command-lines (more control and flexibility) or GUIs (easier).
Unix and Windows: Two Major Classes of Operating Systems
And they have a competitive history and future. Unix has been in use for more than three decades. Originally it rose from the ashes of a failed attempt in the early 1960s to develop a reliable timesharing operating system. A few survivors from Bell Labs did not give up and developed a system that provided a work environment described as "of unusual simplicity, power, and elegance".
Since the 1980's Unix's main competitor Windows has gained popularity due to the increasing power of micro-computers with Intel-compatible processors. Windows, at the time, was the only major OS designed for this type of processors. In recent years, however, a new version of Unix called Linux, also specifically developed for micro-computers, has emerged. It can be obtained for free and is therefore a lucrative choice for individuals and businesses.
On the server front, Unix has been closing in on Microsoft’s market share. In 1999, Linux scooted past Novell's Netware to become the No. 2 server operating system behind Windows NT. In 2001 the market share for the Linux operating system was 25 percent; other Unix flavors 12 percent. On the client front, Microsoft is currently dominating the operating system market with over 90% market share.
Because of Microsoft’s aggressive marketing practices, millions of users who have no idea what an operating system is have been using Windows operating systems given to them when they purchased their PCs. Many others are not aware that there are operating systems other than Windows. But you are here reading an article about operating systems, which probably means that you are trying to make conscious OS decisions for home use or for your organizations. In that case, you should at least give Linux/Unix your consideration, especially if the following is relevant in your environment.
Advantages of Unix
- Unix is more flexible and can be installed on many different types of machines, including main-frame computers, supercomputers and micro-computers.
- Unix is more stable and does not go down as often as Windows does, therefore requires less administration and maintenance.
- Unix has greater built-in security and permissions features than Windows.
- Unix possesses much greater processing power than Windows.
- Unix is the leader in serving the Web. About 90% of the Internet relies on Unix operating systems running Apache, the world's most widely used Web server.
- Software upgrades from Microsoft often require the user to purchase new or more hardware or prerequisite software. That is not the case with Unix.
- The mostly free or inexpensive open-source operating systems, such as Linux and BSD, with their flexibility and control, are very attractive to (aspiring) computer wizards. Many of the smartest programmers are developing state-of-the-art software free of charge for the fast growing "open-source movement”.
- Unix also inspires novel approaches to software design, such as solving problems by interconnecting simpler tools instead of creating large monolithic application programs.
Remember, no one single type of operating system can offer universal answers to all your computing needs. It is about having choices and making educated decisions.

UNIX - LINUX Interview Questions and Answers : Advanced

UNIX - LINUX Interview Questions and Answers : Advanced
________________________________________
1. How are devices represented in UNIX?

All devices are represented by files called special files that are located in/dev directory. Thus, device files and other files are named and accessed in the same way. A 'regular file' is just an ordinary data file in the disk. A 'block special file' represents a device with characteristics similar to a disk (data transfer in terms of blocks). A 'character special file' represents a device with characteristics similar to a keyboard (data transfer is by stream of bits in sequential order).

2. What is 'inode'?

All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to additional data blocks (this further aggregates for larger files). A block is typically 8k.
Inode consists of the following fields:

File owner identifier
File type
File access permissions
File access times
Number of links
File size
Location of the file data
3. Brief about the directory representation in UNIX

A Unix directory is a file containing a correspondence between filenames and inodes. A directory is a special file that the kernel maintains. Only kernel modifies directories, but processes can read directories. The contents of a directory are a list of filename and inode number pairs. When new directories are created, kernel makes two entries named '.' (refers to the directory itself) and '..' (refers to parent directory).
System call for creating directory is mkdir (pathname, mode).

4. What are the Unix system calls for I/O?

open(pathname,flag,mode) - open file
creat(pathname,mode) - create file
close(filedes) - close an open file
read(filedes,buffer,bytes) - read data from an open file
write(filedes,buffer,bytes) - write data to an open file
lseek(filedes,offset,from) - position an open file
dup(filedes) - duplicate an existing file descriptor
dup2(oldfd,newfd) - duplicate to a desired file descriptor
fcntl(filedes,cmd,arg) - change properties of an open file
ioctl(filedes,request,arg) - change the behaviour of an open file
The difference between fcntl anf ioctl is that the former is intended for any open file, while the latter is for device-specific operations.

5. How do you change File Access Permissions?

Every file has following attributes:
owner's user ID ( 16 bit integer )
owner's group ID ( 16 bit integer )
File access mode word

'r w x -r w x- r w x'


(user permission-group permission-others permission)
r-read, w-write, x-execute
To change the access mode, we use chmod(filename,mode).
Example 1:
To change mode of myfile to 'rw-rw-r–' (ie. read, write permission for user - read,write permission for group - only read permission for others) we give the args as:
chmod(myfile,0664) .
Each operation is represented by discrete values

'r' is 4
'w' is 2
'x' is 1


Therefore, for 'rw' the value is 6(4+2).
Example 2:
To change mode of myfile to 'rwxr–r–' we give the args as:

chmod(myfile,0744).


6. What are links and symbolic links in UNIX file system?

A link is a second name (not a file) for a file. Links can be used to assign more than one name to a file, but cannot be used to assign a directory more than one name or link filenames on different computers.
Symbolic link 'is' a file that only contains the name of another file.Operation on the symbolic link is directed to the file pointed by the it.Both the limitations of links are eliminated in symbolic links.
Commands for linking files are:

Link ln filename1 filename2
Symbolic link ln -s filename1 filename2


7. What is a FIFO?

FIFO are otherwise called as 'named pipes'. FIFO (first-in-first-out) is a special file which is said to be data transient. Once data is read from named pipe, it cannot be read again. Also, data can be read only in the order written. It is used in interprocess communication where a process writes to one end of the pipe (producer) and the other reads from the other end (consumer).

8. How do you create special files like named pipes and device files?

The system call mknod creates special files in the following sequence.
1. kernel assigns new inode,
2. sets the file type to indicate that the file is a pipe, directory or special file,
3. If it is a device file, it makes the other entries like major, minor device numbers.
For example:
If the device is a disk, major device number refers to the disk controller and minor device number is the disk.

9. Discuss the mount and unmount system calls

The privileged mount system call is used to attach a file system to a directory of another file system; the unmount system call detaches a file system. When you mount another file system on to your directory, you are essentially splicing one directory tree onto a branch in another directory tree. The first argument to mount call is the mount point, that is , a directory in the current file naming system. The second argument is the file system to mount to that point. When you insert a cdrom to your unix system's drive, the file system in the cdrom automatically mounts to /dev/cdrom in your system.

10. How does the inode map to data block of a file?

Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block. The 13th address points to a three-level(triple in-direction)index block. This provides a very large maximum file size with efficient access to large files, but also small files are accessed directly in one disk read.

11. What is a shell?

A shell is an interactive user interface to an operating system services that allows an user to enter commands as character strings or through a graphical user interface. The shell converts them to system calls to the OS or forks off a process to execute the command. System call results and other information from the OS are presented to the user through an interactive interface. Commonly used shells are sh,csh,ks etc.

12. Brief about the initial process sequence while the system boots up.

While booting, special process called the 'swapper' or 'scheduler' is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children:

the process dispatcher,
vhand and
dbflush
with IDs 1,2 and 3 respectively.
This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el).

13. What are various IDs associated with a process?

Unix identifies each process with a unique integer called ProcessID. The process that executes the request for creation of a process is called the 'parent process' whose PID is 'Parent Process ID'. Every process is associated with a particular user called the 'owner' who has privileges over the process. The identification for the user is 'UserID'. Owner is the user who executes the process. Process also has 'Effective User ID' which determines the access privileges for accessing resources like files.

getpid() -process id
getppid() -parent process id
getuid() -user id
geteuid() -effective user id
14. Explain fork() system call.

The `fork()' used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()'. The parent gets the child's pid returned to him, but the child gets 0 returned to him.

15. Predict the output of the following program code

main()
{
fork();
printf("Hello World!");
}


Answer:

Hello World!Hello World!


Explanation:
The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process.

16. Predict the output of the following program code

main()
{
fork(); fork(); fork();
printf("Hello World!");
}


Answer:
"Hello World" will be printed 8 times.
Explanation:
2^n times where n is the number of calls to fork()

17. List the system calls used for process management:

System calls Description

fork() To create a new process
exec() To execute a new program in a process
wait() To wait until a created process completes its execution
exit() To exit from a process execution
getpid() To get a process identifier of the current process
getppid() To get parent process identifier
nice() To bias the existing priority of a process
brk() To increase/decrease the data segment size of a process.
18. How can you get/set an environment variable from a program?

Getting the value of an environment variable is done by using `getenv()'. Setting the value of an environment variable is done by using `putenv()'.

19. How can a parent and child process communicate?

A parent and child can communicate through any of the normal inter-process communication schemes (pipes, sockets, message queues, shared memory), but also have some special ways to communicate that take advantage of their relationship as a parent and child. One of the most obvious is that the parent can get the exit status of the child.

20. What is a zombie?

When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status. To be able to get this information, the parent calls `wait()'; In the interval between the child terminating and the parent calling `wait()', the child is said to be a `zombie' (If you do `ps', the child will have a `Z' in its status field to indicate this.)

21. What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:
Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but have not been removed from the process table.

Linux Interview Questions And Answers
________________________________________
You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?
tail -15 dog cat horse

The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.

Who owns the data dictionary?
The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.
zcat

The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?
which

The which command searches your path until it finds a command that matches the command you are looking for and displays its full path.

You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose.
whatis

The whatis command displays a summary line from the man page for the specified command.

You wish to create a link to the /data directory in bob's home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful.
Use the -F option

In order to create a link to a directory you must use the -F option.

When you issue the command ls -l, the first character of the resulting display represents the file's ___________.
type

The first character of the permission block designates the type of file that is being displayed.

What utility can you use to show a dynamic listing of running processes_________?
top

The top utility shows a listing of all running processes that is dynamically updated.

Where is standard output usually directed?
to the screen or display

By default, your shell directs standard output to your screen or display.

You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?
tar xf MyBackup.tar memo.ben

This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.

You need to view the contents of the tarfile called MyBackup.tar. What command would you use?
tar tf MyBackup.tar

The t switch tells tar to display the contents and the f modifier specifies which file to examine.

You want to create a compressed backup of the users' home directories. What utility should you use?
tar

You can use the z modifier with tar to compress your archive at the same time as creating it.

What daemon is responsible for tracking events on your system?
syslogd

The syslogd daemon is responsible for tracking system information and saving it to specified log files.

You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?
split

The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.

You would like to temporarily change your command line editor to be vi. What command should you type to change it?
set -o vi

The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor.

What account is created when you install Linux?
root

Whenever you install Linux, only one user account is created. This is the superuser account also known as root.

What command should you use to check the number of files and disk space used and each user's defined quotas?

repquota

n order to run fsck on the root partition, the root partition must be mounted as
readonly

You cannot run fsck on a partition that is mounted as read-write.

In order to improve your system's security you decide to implement shadow passwords. What command should you use?
pwconv

The pwconv command creates the file /etc/shadow and changes all passwords to 'x' in the /etc/passwd file.

Bob Armstrong, who has a username of boba, calls to tell you he forgot his password. What command should you use to reset his command?
passwd boba

The passwd command is used to change your password. If you do not specify a username, your password will be changed.

The top utility can be used to change the priority of a running process? Another utility that can also be used to change priority is ___________?
nice

Both the top and nice utilities provide the capability to change the priority of a running process.

What command should you type to see all the files with an extension of 'mem' listed in reverse alphabetical order in the /home/ben/memos directory.
ls -r /home/ben/memos/*.mem

The -c option used with ls results in the files being listed in chronological order. You can use wildcards with the ls command to specify a pattern of filenames.

What file defines the levels of messages written to system log files?
kernel.h

To determine the various levels of messages that are defined on your system, examine the kernel.h file.

What command is used to remove the password assigned to a group?
gpasswd -r

The gpasswd command is used to change the password assigned to a group. Use the -r option to remove the password from the group.

What command would you type to use the cpio to create a backup called backup.cpio of all the users' home directories?
find /home | cpio -o > backup.cpio

The find command is used to create a list of the files and directories contained in home. This list is then piped to the cpio utility as a list of files to include and the output is saved to a file called backup.cpio.

What can you type at a command line to determine which shell you are using?
echo $SHELL

The name and path to the shell you are using is saved to the SHELL environment variable. You can then use the echo command to print out the value of any variable by preceding the variable's name with $. Therefore, typing echo $SHELL will display the name of your shell.

What type of local file server can you use to provide the distribution installation materials to the new machine during a network installation?
A) Inetd
B) FSSTND
C) DNS
D) NNTP
E) NFS
E - You can use an NFS server to provide the distribution installation materials to the machine on which you are performing the installation. Answers a, b, c, and d are all valid items but none of them are file servers. Inetd is the superdaemon which controls all intermittently used network services. The FSSTND is the Linux File System Standard. DNS provides domain name resolution, and NNTP is the transfer protocol for usenet news.

If you type the command cat dog & > cat what would you see on your display? Choose one:
a. Any error messages only.
b. The contents of the file dog.
c. The contents of the file dog and any error messages.
d. Nothing as all output is saved to the file cat.
d

When you use & > for redirection, it redirects both the standard output and standard error. The output would be saved to the file cat.

You are covering for another system administrator and one of the users asks you to restore a file for him. You locate the correct tarfile by checking the backup log but do not know how the directory structure was stored. What command can you use to determine this?
Choose one:
a. tar fx tarfile dirname
b. tar tvf tarfile filename
c. tar ctf tarfile
d. tar tvf tarfile

d

The t switch will list the files contained in the tarfile. Using the v modifier will display the stored directory structure.

You have the /var directory on its own partition. You have run out of space. What should you do? Choose one:
a. Reconfigure your system to not write to the log files.
b. Use fips to enlarge the partition.
c. Delete all the log files.
d. Delete the partition and recreate it with a larger size.

d

The only way to enlarge a partition is to delete it and recreate it. You will then have to restore the necessary files from backup.

You have a new application on a CD-ROM that you wish to install. What should your first step be?
Choose one:
a. Read the installation instructions on the CD-ROM.
b. Use the mount command to mount your CD-ROM as read-write.
c. Use the umount command to access your CD-ROM.
d. Use the mount command to mount your CD-ROM as read-only.

d

Before you can read any of the files contained on the CD-ROM, you must first mount the CD-ROM.

When you create a new partition, you need to designate its size by defining the starting and ending _____________.
cylinders

When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.

What key combination can you press to suspend a running job and place it in the background?
ctrl-z

Using ctrl-z will suspend a job and put it in the background.

The easiest, most basic form of backing up a file is to _____ it to another location.
copy

The easiest most basic form of backing up a file is to make a copy of that file to another location such as a floppy disk.

What type of server is used to remotely assign IP addresses to machines during the installation process?
A) SMB
B) NFS
C) DHCP
D) FT
E) HTTP

C - You can use a DHCP server to assign IP addresses to individual machines during the installation process. Answers a, b, d, and e list legitimate Linux servers, but these servers do not provide IP addresses. The SMB, or Samba, tool is used for file and print sharing across multi-OS networks. An NFS server is for file sharing across Linux net-works. FTP is a file storage server that allows people to browse and retrieve information by logging in to it, and HTTP is for the Web.

Which password package should you install to ensure that the central password file couldn't be stolen easily?
A) PAM
B) tcp_wrappers
C) shadow
D) securepass
E) ssh
C - The shadow password package moves the central password file to a more secure location. Answers a, b, and e all point to valid packages, but none of these places the password file in a more secure location. Answer d points to an invalid package.

When using useradd to create a new user account, which of the following tasks is not done automatically.
Choose one:
a. Assign a UID.
b. Assign a default shell.
c. Create the user's home directory.
d. Define the user's home directory.

c

The useradd command will use the system default for the user's home directory. The home directory is not created, however, unless you use the -m option.

You want to enter a series of commands from the command-line. What would be the quickest way to do this?
Choose One
a. Press enter after entering each command and its arguments
b. Put them in a script and execute the script
c. Separate each command with a semi-colon ( and press enter after the last command
d. Separate each command with a / and press enter after the last command

c

The semi-colon may be used to tell the shell that you are entering multiple commands that should be executed serially. If these were commands that you would frequently want to run, then a script might be more efficient. However, to run these commands only once, enter the commands directly at the command line.

You attempt to use shadow passwords but are unsuccessful. What characteristic of the /etc/passwd file may cause this?
Choose one:
a. The login command is missing.
b. The username is too long.
c. The password field is blank.
d. The password field is prefaced by an asterisk.

c

The password field must not be blank before converting to shadow passwords.

When you install a new application, documentation on that application is also usually installed. Where would you look for the documentation after installing an application called MyApp?
Choose one:
a. /usr/MyApp
b. /lib/doc/MyApp
c. /usr/doc/MyApp
d. In the same directory where the application is installed.
c

The default location for application documentation is in a directory named for the application in the /usr/doc directory.

What file would you edit in your home directory to change which window manager you want to use?
A) Xinit
B) .xinitrc
C) XF86Setup
D) xstart
E) xf86init

Answer: B - The ~/.xinitrc file allows you to set which window man-ager you want to use when logging in to X from that account.
Answers a, d, and e are all invalid files. Answer c is the main X server configuration file.

What command allows you to set a processor-intensive job to use less CPU time?
A) ps
B) nice
C) chps
D) less
E) more

Answer: B - The nice command is used to change a job's priority level, so that it runs slower or faster. Answers a, d, and e are valid commands but are not used to change process information. Answer c is an invalid command.

While logged on as a regular user, your boss calls up and wants you to create a new user account immediately. How can you do this without first having to close your work, log off and logon as root?
Choose one:
a. Issue the command rootlog.
b. Issue the command su and type exit when finished.
c. Issue the command su and type logoff when finished.
d. Issue the command logon root and type exit when finished.

Answer: b
You can use the su command to imitate any user including root. You will be prompted for the password for the root account. Once you have provided it you are logged in as root and can do any administrative duties.

There are seven fields in the /etc/passwd file. Which of the following lists all the fields in the correct order?
Choose one:
a. username, UID, GID, home directory, command, comment
b. username, UID, GID, comment, home directory, command
c. UID, username, GID, home directory, comment, command
d. username, UID, group name, GID, home directory, comment
Answer: b
The seven fields required for each line in the /etc/passwd file are username, UID, GID, comment, home directory, command. Each of these fields must be separated by a colon even if they are empty.

Which of the following commands will show a list of the files in your home directory including hidden files and the contents of all subdirectories?
Choose one:
a. ls -c home
b. ls -aR /home/username
c. ls -aF /home/username
d. ls -l /home/username
Answer: b
The ls command is used to display a listing of files. The -a option will cause hidden files to be displayed as well. The -R option causes ls to recurse down the directory tree. All of this starts at your home directory.

In order to prevent a user from logging in, you can add a(n) ________at the beginning of the password field.
Answer: asterick

If you add an asterick at the beginning of the password field in the /etc/passwd file, that user will not be able to log in.

You have a directory called /home/ben/memos and want to move it to /home/bob/memos so you issue the command mv /home/ben/memos /home/bob. What is the results of this action?
Choose one:
a. The files contained in /home/ben/memos are moved to the directory /home/bob/memos/memos.
b. The files contained in /home/ben/memos are moved to the directory /home/bob/memos.
c. The files contained in /home/ben/memos are moved to the directory /home/bob/.
d. The command fails since a directory called memos already exists in the target directory.
Answer: a
When using the mv command to move a directory, if a directory of the same name exists then a subdirectory is created for the files to be moved.

Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file?
Choose one:
a. Create a link from the user's home directory to the shell the user will use.
b. Create the user's home directory
c. Use the passwd command to assign a password to the account.
d. Add the user to the specified group.
Answer: a
There is no need to link the user's home directory to the shell command. Rather, the specified shell must be present on your system.

You issue the following command useradd -m bobm But the user cannot logon. What is the problem?
Choose one:
a. You need to assign a password to bobm's account using the passwd command.
b. You need to create bobm's home directory and set the appropriate permissions.
c. You need to edit the /etc/passwd file and assign a shell for bobm's account.
d. The username must be at least five characters long.
Answer: a
The useradd command does not assign a password to newly created accounts. You will still need to use the passwd command to assign a password.

You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this? Choose one:
a. pr -l60 vacations | lpr
b. pr -f vacations | lpr
c. pr -m vacations | lpr
d. pr -l vacations | lpr

Answer: a
The default page length when using pr is 66 lines. The -l option is used to specify a different length.

Which file defines all users on your system?
Choose one:
a. /etc/passwd
b. /etc/users
c. /etc/password
d. /etc/user.conf

Answer: a
The /etc/passwd file contains all the information on users who may log into your system. If a user account is not contained in this file, then the user cannot log in.

Which two commands can you use to delete directories?
A) rm
B) rm -rf
C) rmdir
D) rd
E) rd -rf

Answer(s): B, C - You can use rmdir or rm -rf to delete a directory. Answer a is incorrect, because the rm command without any specific flags will not delete a directory, it will only delete files. Answers d and e point to a non-existent command.

Which partitioning tool is available in all distributions?
A) Disk Druid
B) fdisk
C) Partition Magic
D) FAT32
E) System Commander

Answer(s): B - The fdisk partitioning tool is available in all Linux distributions. Answers a, c, and e all handle partitioning, but do not come with all distributions. Disk Druid is made by Red Hat and used in its distribution along with some derivatives. Partition Magic and System Commander are tools made by third-party companies. Answer d is not a tool, but a file system type. Specifically, FAT32 is the file system type used in Windows 98.

Which partitions might you create on the mail server's hard drive(s) other than the root, swap, and boot partitions?
[Choose all correct answers]
A) /var/spool
B) /tmp
C) /proc
D) /bin
E) /home

Answer(s): A, B, E - Separating /var/spool onto its own partition helps to ensure that if something goes wrong with the mail server or spool, the output cannot overrun the file system. Putting /tmp on its own partition prevents either software or user items in the /tmp directory from overrunning the file system. Placing /home off on its own is mostly useful for system re-installs or upgrades, allowing you to not have to wipe the /home hierarchy along with other areas. Answers c and d are not possible, as the /proc portion of the file system is virtual-held in RAM-not placed on the hard drives, and the /bin hierarchy is necessary for basic system functionality and, therefore, not one that you can place on a different partition.

When planning your backup strategy you need to consider how often you will perform a backup, how much time the backup takes and what media you will use. What other factor must you consider when planning your backup strategy? _________
what to backup
Choosing which files to backup is the first step in planning your backup strategy.

What utility can you use to automate rotation of logs?
Answer: logrotate
The logrotate command can be used to automate the rotation of various logs.

In order to display the last five commands you have entered using the history command, you would type ___________ .

Answer: history 5
The history command displays the commands you have previously entered. By passing it an argument of 5, only the last five commands will be displayed.

What command can you use to review boot messages?
Answer: dmesg
The dmesg command displays the system messages contained in the kernel ring buffer. By using this command immediately after booting your computer, you will see the boot messages.

What is the minimum number of partitions you need to install Linux?
Answer: 2
Linux can be installed on two partitions, one as / which will contain all files and a swap partition.

What is the name and path of the main system log?
Answer: /var/log/messages
By default, the main system log is /var/log/messages.

Of the following technologies, which is considered a client-side script?
A) JavaScript
B) Java
C) ASP
D) C++
Answer: A - JavaScript is the only client-side script listed. Java and C++ are complete programming languages. Active Server Pages are parsed on the server with the results being sent to the client in HTML
__________________

Linux/Unix interviews Questions

Linux/Unix interviews Questions
________________________________________
These are questions 4 both of linux and Unix by which you can use to prepare your Linux or Unix job as a technicial or as engineer or as an administartor, there are some about programming. some of these questions were from ubinto forum...hope this will help people here..... some of these questions are answered ....be free for any comment or any help.

Linux network administrator questions

-Give an example of set of shell commands that will give you the number of files in a directory
-How do you tell what process has a TCP port open in Linux
-On a Red Hat Linux Variant how do you control whether a service starts when the system boots
-How do you tell the amount of free disk space left on a volume
-Give an example of a set of shell commands to tell how many times ”bob” has logged on to the system this month
-Give an example of a recursively copying a directory from one location to another.
-How do you modify the IP and Net mask of a system running a Red Hat Variant of Linux

-Give an example of a set of shell commands that will give you the number of ”httpd” processes running on a Linux box.
-On CentOS or Fedora based system using the package management application, how do you tell what package provided the file ”libnss_ldap.so”
-What is the difference between VTP client, server, and transparent
-What is the maximum length of CAT6
-How does one set up a layer two link to share VLANs
-How does one implement redundant links at Layer 2
-What is the difference between a hub, switch, and a router? What are the security advantages of switch vs. hub?
-Show an example of using telnet to learn the headers of an http server.
-In what OSI layer does PPP exist
-What’s the difference between TCP and UDP
-Given a DNS server that has just started (with an empty cache) and host contacting this DNS server (using it’s OS setting) to learn an address for google.com, list the steps the DNS server will take to learn it with IP addresses (each step will have multiple possible IP addresses – you need choose only one per step).
-Why are layer 2 loops bad, and what protocol was designed to prevent them
-Given a radius server at 10.0.0.2 and a shared key of ‘abc123′ show the IOS commands necessary to authenticate switch users against the radius server, while still allowing the use of local username / password pairs



Linux command line Q&A


-You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?
tail -15 dog cat horse
The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.
-Who owns the data dictionary?
The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

-You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.
zcat
The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
-You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?
which
The which command searches your path until it finds a command that matches the command you are looking for and displays its full path.
-You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose.
whatis
The whatis command displays a summary line from the man page for the specified command.
-You wish to create a link to the /data directory in bob’s home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful.
Use the -F option
In order to create a link to a directory you must use the -F option.
-When you issue the command ls -l, the first character of the resulting display represents the file’s ___________.
type
The first character of the permission block designates the type of file that is being displayed.
-What utility can you use to show a dynamic listing of running processes? __________
top
The top utility shows a listing of all running processes that is dynamically updated.
-Where is standard output usually directed?
to the screen or display
By default, your shell directs standard output to your screen or display.
-You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?
tar xf MyBackup.tar memo.ben
This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.
-You need to view the contents of the tarfile called MyBackup.tar. What command would you use?
tar tf MyBackup.tar
The t switch tells tar to display the contents and the f modifier specifies which file to examine.
-You want to create a compressed backup of the users’ home directories. What utility should you use?
tar
You can use the z modifier with tar to compress your archive at the same time as creating it.
-What daemon is responsible for tracking events on your system?
syslogd
The syslogd daemon is responsible for tracking system information and saving it to specified log files.
-You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?
split
The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.
-You would like to temporarily change your command line editor to be vi. What command should you type to change it?
set -o vi
The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor.
-What account is created when you install Linux?
root
Whenever you install Linux, only one user account is created. This is the superuser account also known as root.
-What command should you use to check the number of files and disk space used and each user’s defined quotas?
repquota
The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.


Unix admin questions


-How do you list the files in an UNIX directory while also showing hidden files?
-How do you execute a UNIX command in the background?
-What UNIX command will control the default file permissions when files are created?
-Explain the read, write, and execute permissions on a UNIX directory.
-What is the difference between a soft link and a hard link?
-Give the command to display space usage on the UNIX file system.
-Explain iostat, vmstat and netstat.
-How would you change all occurrences of a value using VI?
-Give two UNIX kernel parameters that effect an Oracle install
-Briefly, how do you install Oracle software on UNIX.


Linux application programming questions


-Explain the difference between a static library and a dynamic library? - Static library is linked into the executable, while a dynamic library (or shared object) is loaded while the executable has started.
-How do you create a static library? - If you have a collection of object (.o) files, you can do it by running ar command. Generally a static library has a .a extension, and you can link it into an executable by providing -l libraryname to gcc.
-Where should the developed libraries be installed on the system? - GNU recommends /usr/local/bin for binaries and /usr/local/lib for libraries.
-What’s LD_LIBRARY_PATH? - It’s an environment variable that lists all the directories which should be searches for libraries before the standard directories are searched.
-How do you create a shared library? - Create the object file with -fPIC for position-independent code, then run gcc with -shared option.
-How do you install a shared library? - Run ldconfig in the standard directory that it’s installed in.
-What does ldd do? - It shows a list of installed shared libraries.
-How do you dynamically load a library in your app? - Use dlopen()
-What does nm command do? - It reports the list of symbols in a given library.


Apache interview questions



-On a fresh install, why does Apache have three config files - srm.conf, access.conf and httpd.conf? - The first two are remnants from the NCSA times, and generally you should be ok if you delete the first two, and stick with httpd.conf.
-What’s the command to stop Apache? - kill the specific process that httpd is running under, or killall httpd. If you have apachectl installed, use apachectl stop.
-What does apachectl graceful do? - It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
-How do you check for the httpd.conf consistency and any errors in it? - apachectl configtest

-When I do ps -aux, why do I have one copy of httpd running as root and the rest as nouser? - You need to be a root to attach yourself to any Unix port below 1024, and we need 80.
-But I thought that running apache as a root is a security risk? - That one root process opens port 80, but never listens to it, so no user will actually enter the site with root rights. If you kill the root process, you will see the other kids disappear as well.
-Why do I get the message "… no listening sockets available, shutting down"? - In Apache 2 you need to have a listen directive. Just put Listen 80 in httpd.conf.
-How do you set up a virtual host in Apache?

ServerAdmin admin@techinterviews.com
DocumentRoot /home/apache/share/htdocs/hostedsites
ServerName www.techinterviews.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log

-What is ServerType directive? - It defines whether Apache should spawn itself as a child process (standalone) or keep everything in a single process (inetd). Keeping it inetd conserves resources. This is deprecated, however.
-What is mod_vhost_alias? - It allows hosting multiple sites on the same server via simpler configurations.
-What does htpasswd do? - It creates a new user in a specified group, and asks to specify a password for that user.
If you specify both deny from all and allow from all, what will be the default action of Apache? - In case of ambiguity deny always takes precedence over allow.


Topics for a Unix sysadmin interview



-Job Scheduling; mainly crontab, at, batch command
Backup stetegy; incremental, full system back up; diff between tar & ufsdump
-diff between hard link & softlink
-How to list only the directories inside a directory (Ans. ls -l|grep "^d")
-RAID levels; pros & cons of diffrent levels; what is RAID 1+0

-How to recover a system whose root password has lost?
-What is a daemon?
-How to put a job in background & bring it to foreground?
-What is default permissions for others in a file?
-Questions on shell initialization scripts?
-Questions on restricted shell
-What is diff betwn grep & find?
-What is egrep?
-Questions on shell programming
-What is a pipe?
-Questions on Solaris patch management like pkgadd etc
-Questions on file system creation; actually what happens when we create a file system?
-Questions on RBAC? what is a role accound & what is a profile?
-From command line how will you add a user account? the full command will all arguments.
-Fs it advisable to put a swap partion in RAID1 (mirroring?) pros & cons?



General UNIX interview questions



-What are the main differences between Apache 1.x and 2.x?
-What does the ”route” command do?
-What are the read/write/execute bits on a directory mean?
-What does iostat do?

-what does vmstat do?
-What does netstat do?
-What is the most graceful way to bring a system into single user mode?
-How do you determine disk usage?
-What is AWK?
-What is SED?
-What is the difference between binaries in /bin, and /usr/bin?
-What is a dynamically linked file?
-What is a statically linked file?



Linux admin interview questions



-How do you take a single line of input from the user in a shell script?
-Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.
-Write a regular expression (or sed script) to replace all occurrences of the letter ‘f’, followed by any number of characters, followed by the letter ‘a’, followed by one or more numeric characters, followed by the letter ‘n’, and replace what’s found with the string ”UNIX”.

-Write a script to list all the differences between two directories.
-Write a program in any language you choose, to reverse a file.
-What are the fields of the password file?
-What does a plus at the beginning of a line in the password file signify?
-Using the man pages, find the correct ioctl to send console output to an arbitrary pty.
-What is an MX record?
-What is the prom command on a Sun that shows the SCSI devices?
-What is the factory default SCSI target for /dev/sd0?
-Where is that value controlled?
-What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?
-What’s wrong with sendmail? What would you fix?
-What command do you run to check file system consistency?
-What’s wrong with running shutdown on a network?
-What can be wrong with setuid scripts?
-What value does spawn return?
-Write a script to send mail from three other machines on the network to root at the machine you’re on. Use a ‘here doc’, but include in the mail message the name of the machine the mail is sent from and the disk utilization statistics on each machine?
-Why can’t root just cd to someone’s home directory and run a program called a.out sitting there by typing ”a.out”, and why is this good?
-What is the difference between UDP and TCP?
-What is DNS?
-What does nslookup do?
-How do you create a swapfile?
-How would you check the route table on a workstation/server?
-How do you find which ypmaster you are bound to?
-How do you fix a problem where a printer will cutoff anything over 1MB?
-What is the largest file system size in solaris? SunOS?
-What are the different RAID levels?



Linux admin interview questions



-How do you list the files in an UNIX directory while also showing hidden files? ls -ltra

-How do you execute a UNIX command in the background? Use the ”&”.
-What UNIX command will control the default file permissions when files are created? umask
-Explain the read, write, and execute permissions on a UNIX directory. Read allows you to see and list the directory contents. Write allows you to create, edit and delete files and subdirectories in the directory. Execute gives you the permissions to run programs or shells from the directory.
-What is the difference between a soft link and a hard link? A symbolic (soft) linked file and the targeted file can be located on the same or different file system while for a hard link they must be located on the same file system.
-Give the command to display space usage on the UNIX file system. df -lk
-Explain iostat, vmstat and netstat. iostat reports on terminal, disk and tape I/O activity. vmstat reports on virtual memory statistics for processes, disk, tape and CPU activity. netstat reports on the contents of network data structures.
-How would you change all occurrences of a value using VI? %s/(old value)/(new value)/g
-Give two UNIX kernel parameters that effect an Oracle install. SHMMAX & SHMMNI
-Briefly, how do you install Oracle software on UNIX? Basically, set up disks, kernel parameters, and run orainst.



Unix/Linux administration interview questions



-What is LILO?

LILO stands for Linux boot loader. It will load the MBR, master boot record, into the memory, and tell the system which partition and hard drive to boot from.


-What is the main advantage of creating links to a file instead of copies of the file?

A: The main advantage is not really that it saves disk space (though it does that too) but, rather, that a change of permissions on the file is applied to all the link access points. The link will show permissions of lrwxrwxrwx but that is for the link itself and not the access to the file to which the link points. Thus if you want to change the permissions for a command, such as su, you only have to do it on the original. With copies you have to find all of the copies and change permission on each of the copies.

-Write a command to find all of the files which have been accessed within the last 30 days.

find / -type f -atime -30 > December.files

This command will find all the files under root, which is ‘/’, with file type is file. ‘-atime -30′ will give all the files accessed less than 30 days ago. And the output will put into a file call December.files.

-What is the most graceful way to get to run level single user mode?

A: The most graceful way is to use the command init s.
If you want to shut everything down before going to single user mode then do init 0 first and from the ok prompt do a boot -s.

-What does the following command line produce? Explain each aspect of this line.

$ (date ; ps -ef | awk ‘{print $1}’ | sort | uniq | wc -l ) >> Activity.log

A: First let’s dissect the line: The date gives the date and time as the first command of the line, this is followed by the a list of all running processes in long form with UIDs listed first, this is the ps -ef. These are fed into the awk which filters out all but the UIDs; these UIDs are piped into sort for no discernible reason and then onto uniq (now we see the reason for the sort - uniq only works on sorted data - if the list is A, B, A, then A, B, A will be the output of uniq, but if it’s A, A, B then A, B is the output) which produces only one copy of each UID.

These UIDs are fed into wc -l which counts the lines - in this case the number of distinct UIDs running processes on the system. Finally the results of these two commands, the date and the wc -l, are appended to the file "Activity.log". Now to answer the question as to what this command line produces. This writes the date and time into the file Activity.log together with the number of distinct users who have processes running on the system at that time. If the file already exists, then these items are appended to the file, otherwise the file is created.


Hope this will help people here..for any comment or any help be free

BASIC UNIX COMMANDS !

Blue roses will blossom in the snow

Blue roses will blossom in the snow,
before I ever let you go,
Blue roses will grow up to the sky,
before I ever make you cry

Blue rose given to a woman,
Considered sacred from a heart of silent souls,
Words spoken, silence was a bond created;
Her boldness spurred from a single blue rose;

Sacred blue rose hidden,
Burns emotions once stirred,
Rose blurred by a insecure woman,
Lured by his love,
now held for him ,from his words of his poems;

Silent bond of love fell upon her,
Words retrieved from his poem,
Fond of what was told;
Close to her heart she held what was inside, untold,
A token of all she felt,
For a man that gave a blue rose and a poem;

Tokens of love now broken,
Love once spoken with true meaning for a rose,
Lost was the closeness so tenderly rendered,
driven by a blue rose once given,

No memory of what he molded from his heart and soul,
Love that slurred emotions of desires within,
Love that came from what holds to a blue rose,
His words unfold;

Her fire inside spoken,
to return of her desires for his blue rose;
His love to her side remains frozen,
Only for love, of his words,

Devotion to be by his side,
to surrender to the rose once given, desirer of emotions;
from a sacred blue rose,
Her love for his blue rose;
Inspired by his love for words, he so chosen;
till the end;