Академический Документы
Профессиональный Документы
Культура Документы
1.
How do you take a single line of input from the user in a shell
script?
2.
Write a script to convert all DOS style backslashes to UNIX style
slashes in a list of files.
3.
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 whats found with the string
UNIX.
4.
Write a script to list all the differences between two directories.
5.
Write a program in any language you choose, to reverse a file.
6.
What are the fields of the password file?
7.
What does a plus at the beginning of a line in the password file
signify?
8.
Using the man pages, find the correct ioctl to send console
output to an arbitrary pty.
9.
What is an MX record?
10.
What is the prom command on a Sun that shows the SCSI
devices?
11.
What is the factory default SCSI target for /dev/sd0?
12.
Where is that value controlled?
13.
What happens to a child process that dies and has no parent
process to wait for it and whats bad about this?
14.
Whats wrong with sendmail? What would you fix?
15.
What command do you run to check file system consistency?
16.
Whats wrong with running shutdown on a network?
17.
What can be wrong with setuid scripts?
18.
What value does spawn return?
19.
Write a script to send mail from three other machines on the
network to root at the machine youre 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?
20.
Why cant root just cd to someones home directory and run a
program called a.out sitting there by typing a.out, and why is this
good?
21.
What is the difference between UDP and TCP?
22.
What is DNS?
23.
What does nslookup do?
24.
How do you create a swapfile?
25.
How would you check the route table on a workstation/server?
26.
How do you find which ypmaster you are bound to?
27.
over
28.
29.
but
Conclusion
Today the difference between scripting and programming is largely and
academic thing. You shouldnt have to concern yourself with what
broad category a particular language may fall in.
2.
3.
4.
5.
6.
7.
8.
10.
11.
12.
Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes
to specific hosts or networks via an interface after it has been configured with the
ifconfig(8) program.
When the add or del options are used, route modifies the routing tables. Without these
options, route displays the current contents of the routing tables.
Under iptables, each filtered packet is only processed using rules from one
chain rather than multiple chains. In other words, a FORWARD packet coming
into a system using ipchains would have to go through the INPUT, FORWARD,
and OUTPUT chains in order to move along to its destination. However,
iptables only sends packets to the INPUT chain if they are destined for the local
system and only sends them to the OUTPUT chain if the local system generated
the packets. For this reason, you must be sure to place the rule designed to catch a
particular packet in the correct chain that will actually see the packet.
The advantage is that you now have finer-grained control over the disposition of
each packet. If you are attempting to block access to a particular website, it is now
possible to block access attempts from clients running on hosts which use your
host as a gateway. An OUTPUT rule which denies access will no longer prevent
access for hosts which use your host as a gateway.
The DENY target has been changed to DROP. In ipchains, packets that matched
a rule in a chain could be directed to the DENY target, which silently dropped the
packet. This target must be changed to DROP in iptables to have the same
effect.
Order matters when placing options in a chain rule. Previously, with ipchains, it
did not matter very much how you ordered the rule options when typing the rule.
The iptables command is a bit pickier about where some options may go. For
example, you must now specify the source or destination port after the protocol
(ICMP, TCP, or UDP) to be used in a chain's rule.
When specifying network interfaces to be used with a rule, you must only use
incoming interfaces (-i option) with INPUT or FORWARD chains and outgoing
interfaces (-o option) with FORWARD or OUTPUT chains. This is necessary due
to the fact that OUTPUT chains are no longer used by incoming interfaces, and
INPUT chains are not seen by packets moving through outgoing interfaces.
13.
14.
15.
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 lets 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 its 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.
1.
How do you take a single line of input from the user in a shell script?
2.
3.
4.
5.
6.
7.
8.
Using the man pages, find the correct ioctl to send console output to
an arbitrary pty.
9.
What is an MX record?
10.
What is the prom command on a Sun that shows the SCSI devices?
11.
12.
13.
14.
15.
16.
17.
Ans:
Process ID
19.
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?
20.
21.
22.
What is DNS?
23.
24.
# mkdir /files
# mkfile 100m /files/swapfile
# swap -a /files/swapfile
# vi /etc/vfstab
(An entry is added for the swap file):
/files/swapfile
swap
# swap l
no
25.
26.
27.
How do you fix a problem where a printer will cutoff anything over
1MB?
28.
29.
30.
31.
32.
33.
Differences between two last MySQL versions. Which one would you
choose and when/why?
34.
Main differences between Apache 1.x and 2.x. Why is 2.x not so
popular? Which one would you choose and when/why?
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
How do you list all files in a directory, including the hidden files?
47.
How do you find out all processes that are currently running?
48.
How do you find out the processes that are currently running or a
particular user?
49.
50.
51.
52.
53.
What would you use to view contents of a large error log file?
54.
56.
57.
58.
doing so)?
59
What is a filesystem?
60.
61.
How do you check the sizes of all users home directories (one
command)?
62.
63.
64.
What utility would you use to replace a string '2001' for '2002' in a
text file?
65.
What utility would you use to cut off the first column in a text file?
66.
67.
68.
69.
70.
71.
72.
73.
What command do you type to find help about the command who?
74.
75.
Which directory is closer to the top of the file system tree, parent
directory or current directory?
76.
77.
78.
79.
80.
What are two functions the move mv command can carry out?
81.
82.
The soccer league consists of boy and girl teams. The boy file
names begin with B, the girl teams begin with G. All of these files are
in one directory called "soccer", which is your current directory:
Bteam.abc Bteam.OOl Bteam.OO2 Bteam.OO4
Gteam.win Gteam.OOl Gteam.OO2 Gteam.OO3
Write the commands to do the following:
a) rename the file Bteam.abc to Bteam.OO3.
b) erase the file Gteam. win after you have viewed the contents of
the file
c) make a directory for the boy team files called "boys", and one for
the girl team files called" girls"
d) move all the boy teams into the "boys" directory
e) move all the girl teams into the "girls" directory
f) make a new file called Gteam.OO4 that is identical to Gteam.OOl
g) make a new file called Gteam.OO5 that is identical to Bteam.OO2
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100
.
101
.
102
.
103
104
105
106
1. What are the main differences between Apache 1.x and 2.x?
2. What does the route command do?
3. What are the read/write/execute bits on a directory mean?
4. What does iostat do?
5. what does vmstat do?
6. What does netstat do?
7. What is the most graceful way to bring a system into single user mode?
8. How do you determine disk usage?
9. What is AWK?
10. What is SED?
11. What is the difference between binaries in /bin, and /usr/bin?
or
# /etc/sysctl.conf
enable ip packet forwarding
net.ipv4.ip_forward = 1
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?
Answer
LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the
Operating system. LILO can be configured to boot other operating systems as well. LILO is customizable,
which means that if the default configuration is not correct, it can be changed. Config file for LILO is
lilo.conf.
What is LILO?
LILO stands for Linux Loader which is a bootstrap program. LILO is a code snippet which loads PC BIOS
into the main memory at the time of starting the computer system. LILO handles the following tasks:
-Locating Linux kernel
-Identifying other supporting programs and loading them in the memory
-Staring Kernel
The selection of various kernel images and boot routines is supported by LILO. For this reason, LILO is
known as boot manager.
What is LD_LIBRARY_PATH?
Answer
LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non standard
library. It is also used for which directories to search. Path to search for directories needs to given. The
variable can be set by using setenvLD_LIBRARY_PATH--$PATH
Linux - What is LD_LIBRARY_PATH? - May 11, 2009 at 14:00 pm by Vidya Sagar
What is LD_LIBRARY_PATH?
LD_LIBRARY_PATH is an environment variable. This is used to search for the shared objects / dynamic
libraries by the operating system for extendable functionality at runtime.
Kernel Activities:
e.g. sort file | lpr ( sort the file and send it to printer)
Uses of Pipe
shift command is used to replace the parameters that were sent from command line. For example
$ shift will replace $1 by $2
getopts command is used for the purpose of parsing positional parameters.
Using non-interactive mode the user can just print the name and requested information of a host.
tcpdump: To dump traffic over a network tcpdump command is used. The headers of the packets over a
network interface are printed if the given Boolean expression is true. ntop: Network top program. It displays
the summary of network usage of systems over network in a format which is reminiscent of unix top utility. If
used in web mode, it displays the result on the web browser.
Linux - What are the process states in Linux? - August 21, 2008 at 22:00 pm by Rajmeet Ghai
What is a zombie?
Answer
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. Since this process is not alive, it cannot react to
signals. Zombie state can finish when the parent dies. All resources of the zombie state process are cleared
by the kernel
What is a zombie?
Dead process is called a zombie. The processes will die eventually at the time when they become zombies.
A dead process cannot be killed. The parent process will send a signal to the operating system that is not
needed the zombie by using wait () system call.
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