Ashish Panchal's Blog

June 25, 2010

Linux Questions And Answers

Filed under: Linux — ashishpanchal @ 11:06 am

What is Linux and why is it so popular?
Linux is an operating system that uses UNIX like Operating system. However, unlike UNIX, Linux is an open source and free software. Linux was originally created by Linus Torvalds and commonly used in servers.

Popularity of Linux is because of the following reasons

  • It is free and open source. We can download Linux for free and customize it as per our needs.
  • It is very robust and adaptable.
  • Immense amount of libraries and utilities

What is LILO?
LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system…….

What is the difference between home directory and working directory?
Home directory is the default working directory when a user logs in. On the other hand, working directory is the user’s current directory…….

What is the difference between internal and external commands?
Internal commands are commands that are already loaded in the system. They can be executed any time and are independent…….

Explain the difference between a static library and a dynamic library?
Static libraries are loaded when the program is compiled and dynamically-linked libraries are loaded in while……

What is LD_LIBRARY_PATH?
LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non standard library…….

What is the file server in Linux server?
File server is used for file sharing. It enables the processes required fro sharing…….

What is NFS? What is its purpose?
NFS is Network File system. It is a file system used for sharing of files over a network…….

How do I send email with linux?
Email can be sent in Linux using the mail command. ……

Explain RPM (Red Hat Package Manager) features?
RPM is a package managing system (collection of tools to manage software packages)…….

What is Kernel? Explain the task it performs?
Kernel is used in UNIX like systems and is considered to be the heart of the operating system…….

What is Linux Shell? What is Shell Script?
Linux shell is a user interface used for executing the commands. Shell is a program the user……

What are Pipes? Explain use of pipes?
A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin) to another…….

Explain trap command; shift Command, getopts command of linux?
Trap command: controls the action to be taken by the shell when a signal is received. ……

What Stateless Linux server? What feature it offers?
A stateless Linux server is a centralized server in which no state exists on the single workstations. ……

What does nslookup do? Explain its two modes.
Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records,……

What is Bash Shell?
Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. ……

Explain some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop?
Network monitoring tools are used to monitor the network, systems present on the network, traffic etc…….

How does the linux file system work?
Linux file structure is a tree like structure. It starts from the root directory, represented by ‘/’, and then expands into sub-directories…….

What are the process states in Linux?

  • Running: Process is either running or ready to run
  • Interruptible: a Blocked state of a process and waiting for an event or signal from another process
  • Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal
  • Stopped: Process is stopped or halted and can be restarted by some other process
  • Zombie: process terminated, but information is still there in the process table.

What is a zombie?
Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table…….

Explain each system calls used for process management in linux?
System calls used for Process management:

  • Fork () :- Used to create a new process
  • Exec() :- Execute a new program
  • Wait():- wait until the process finishes execution
  • Exit():- Exit from the process
  • Getpid():- get the unique process id of the process
  • Getppid():- get the parent process unique id
  • Nice():- to bias the existing property of process

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.

Next Page »

Create a free website or blog at WordPress.com.