0% found this document useful (0 votes)
33 views9 pages

Linux Unit 1

BSC IT sem 5 unit 1 Q and A

Uploaded by

mefalim212
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)
33 views9 pages

Linux Unit 1

BSC IT sem 5 unit 1 Q and A

Uploaded by

mefalim212
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/ 9

LINUX UNIT 1

1. Explain piping and Redirecting with proper example. Write a command to print first
three lines of the file.
Ans
1) The piping and redirection options are among the most powerful features of the Linux
command line.
2) Piping is used to send the result of a command to another command, and redirection sends
the output of a command to a file.
3) The goal of piping is to execute a command and send the output of that command to the next
command so that it can do something with it.
4) Another very useful command that is often used in a pipe construction is grep. This command
is used as a filter to show just the information that you want to see and nothing else.
5) A much easier solution is to pipe the contents of the file to the filter grep, which would select all
of the lines that contain the string mentioned as an argument of grep.
6) This command would read cat /etc/passwd | grep linda.
7) redirection sends the result of a command to a file. While this file can be a text file, it can also
be a special file, such as a device file.
8) One of the interesting features of redirection is that, not only it is possible to redirect to regular
files, but you can also redirect output to device files.
9) For example, who > myfile will put the result of the who command (which displays a list of
users currently logged in) in a file called myfile

2. What are the different duties of Linux System Administrator?


Ans:


Linux System Administrator is a person who has ‘root’ access that is ‘Super user’.
It means he has privilege to access everything which includes all user accounts, all system
configurations, home directories with all files therein, all files in system.
Linux System Administrator has following duties:
a. Installing and configuring server:
In the Linux world, the word server has a broader meaning than what you might be used to.
For instance, the standard Red Hat graphical user interface (GUI) requires a graphical layer
called XFree86. This is a server.
It runs even on a standalone machine with one user account. It must be configured.
It is of system administrator to configure server so that the most essential server remain
inaccessible. He must be aware of types of attack and security bugs.

b. Installing and configuring application software:


It is possible for individual users to install some applications in their home directories - drive
space set aside for their own files and customizations
these applications may not be available to other users without the intervention of the user who
installed the program or the system administrator.
In order to ensure a correct execution environment, administrator must provide software which is
well configured and validate..

c. Creating and maintaining user account:


User can access his own account but administrator has access to every user account.
He can add, modify, delete or copy user account.
He is responsible for maintaining security by providing role on a user account that define the level
of access.

d. Backing up and restoring files:


To minimize the loss of data, administrator must maintain backup of files and he should restore it
whenever required.
Backing up is only part of the story. You need to formulate a disaster recovery plan to bring your
system back up in the event of a failure.
Before creating backup administrator must decide.
What are necessary to backup?
How frequently backup should perform.

e. Monitoring and tuning performance


Monitoring and tuning of performance is essential for Linux to work more efficiently.
Administrator must identify system bottleneck and should solve them.
Administrator can use system tools to increase performance, he can determine when hardware
need to be upgrade.
He should identify early sign of failure.
To squeeze the best performance from your equipment, monitor your system carefully and use
Linux's built-in configurability wisely.

f. Configuring a secure system:


It is a duty of administrator to involve tasks and decisions to run secure Linux system and
maintaining data integrity.
It provide strong protection to individuals and corporate bodies and protecting parts of system
even if it is under attack.
Administrator should ensure
System has firewall.
Not allow connection from unknown network.
Not install software if not needed.

g. Using tools to monitor security:


Linux is the preferred operating system who demands secure networks, buy it can be easily
crack by hackers.
It is important for administrator to be aware of tools hackers use and software used to monitor
and counter such activity.

3. What are different commands for Process Management?


Ans


Every command that you start from the shell can be managed as a job.
There are, however, many more tasks that are running at any given moment on your Red Hat


Enterprise Linux Server.
These tasks are referred to as processes.
Commands for process management

Command use

Ps Used to show all current processes

kill Used to send signals to processes, such as asking or forcing a process to stop

Pstree Used to get an overview of all processes, including the relationship between
parent and child processes

KillAll Used to kill all processes, based on the name of the process

Top Used to get an overview of current system activity

➖Here’s a brief explanation of the listed Linux commands:


i. ps (Process Status): Displays information about active processes.
Common usages includes listing processes for a user or all system processes
(e.g., ps aux).
ii. kill: Sends a signal to terminate a process by its Process ID (PID).
Example: kill 1234 sends a default termination signal (SIGTERM) to process ID 1234.
iii. pstree: Displays processes in a tree-like format, showing parent-child relationships between
processes.
Useful for visualizing process hierarchies.
iv. killall: Terminates all processes matching a specific name.
Example: killall firefox stops all instances of Firefox.
v. top: Displays real-time information about system processes, including CPU and memory
usage, process priority, and more.
Use it to monitor and manage system performance interactively.

4. Why Red Hat Linux and Fedora has been so successful? Explain.
Ans
1)One reason why Red Hat has been so successful since the beginning is the level of
support.the company provides. Red Hat offers three types of support, and this gives companies.
2) the confidence they need to run vital business applications on Linux. The three types of
Linux support provided by Red Hat are as follows:
i. Hardware Support: Red Hat has agreements with every major server hardware vendor to make
sure that whatever server a customer buys, the hardware vendor will assist them in fixing
hardware issues, when Red Hat is installed on it.

ii. Software Support: Red Hat has agreements with every major enterprise software vendor to
make sure that their software runs properly on top of the Red Hat Linux operating system and
that the enterprise software is also guaranteed to run on Red Hat Linux by the vendor of the
operating system.
iii. Hands-on Support: This means that if a customer is experiencing problems accomplishing
tasks with Red Hat software, the Red Hat Global Support organization is there to help them by
fixing bugs and providing technical assistance.

3) Fedora is a freely available Linux distribution that is completely comprised of opensource


software, and Red Hat is providing the funds and people to tackle this project. Both Red Hat and
Fedora are free of charge
4) Fedora is used as a development platform for the latest and greatest version of Linux, which is
provided free of charge for users who are interested. As such, Fedora can be used as a test
platform for features that will eventually be included in Red Hat Enterprise Linux.
5) Fedora is the best place to look. Also, Fedora makes an excellent choice to install on your
personal computer, because it offers all the functions you would expect from a modern operating
system—even some functions that are of interest only to home users.

5. Write a note on RPM and YUM in Linux. (NOV 2018)


Ans
1) RPM (Red Hat Package Manager) is a low-level package management tool used to install,
upgrade, query, verify, and remove software packages in Linux.
2) It uses .rpm files, which contain precompiled binaries and metadata like dependencies.
3) RPM doesn't resolve dependencies automatically; users must manually install all required
packages.
4) YUM (Yellowdog Updater Modified) is a higher-level tool that works with RPM, enabling easier
management of packages and dependencies.
5) YUM automatically resolves and installs dependencies, making software management more
efficient.
6) YUM relies on repositories (online or local) to fetch and install packages seamlessly.
7) Both tools are commonly used in Red Hat-based distributions like RHEL, CentOS, and Fedora
for efficient package management.
Note: You can add installation process

6. Explain any five commands to view the contents of text files.


Ans
1) Viewing the Contents of Text Files: When administering your RHEL server, you will very often
find that you are modifying configuration files, which are all ASCII text files. Therefore, the ability
to browse the content of these files is very important. Different methods exist to perform this task.

Commands Description

Cat This command displays the contents of a file by dumping it to the screen. This
can be useful if the contents of the file do not fi t on the screen.

Tac This command does the same thing as cat but inverts the result This command
will dump the contents of a file to the screen, but with the last line first and the
first line last.

Tail This command shows only the last lines of a text file.
Head This command is the opposite of tail. It displays the first lines of a text file

Less The last command used to monitor the contents of text files is less. This
command will open a plain-text file viewer.

More This command is similar to less but not as advanced.

7. Explain Bash shell in detail.


Ans
1) Bash (short for the Bourne Again Shell) is the one that is used in most situations. This is
because it is compatible with the Bourne shell, which is commonly found on UNIX servers. You
should, however, be aware that Bash is not the only shell that can be used. A partial list of other
shells follows:
i. tcsh: A shell with a scripting language that works like the C programming language. It is very
popular with C programmers.
ii. zsh: A shell that is compatible with Bash but offers even more features.
iii. sash: This stands for stand-alone shell. This is a minimal-feature shell that runs in almost all
environments. Therefore, it is very well suited for system troubleshooting.
2) Basically, from the Bash environment, an administrator is working with commands. An
Example of such a command is ls, which can be used to display a list of files in a given directory.
To make working with these commands as easy as possible,
3) Here is a short list of the most useful of these key sequences:
Ctrl+C: Use this key sequence to quit a command that is not responding (or simply is taking too
long to complete).
Ctrl+D: This key sequence is used to send the end-of-file (EOF) signal to a command.
Ctrl+R: This is the reverse search feature. When used, it will open the reverse-i-search prompt.
This feature helps you locate commands you have used previously. The feature is especially
useful when working with longer commands.
Ctrl+Z: Some people use Ctrl+Z to stop a command. In fact, it does stop your command, but it
does not terminate it.
Ctrl+A: The Ctrl+A keystroke brings the cursor to the beginning of the current command line.
Ctrl+B: The Ctrl+B keystroke moves the cursor to the end of the current command line.

8. Explain cron in detail for job scheduling.


Ans
1) For some tasks, it makes sense to have them started automatically. Think, for example, of a
backup job that you want to automatically execute every night. To start jobs automatically, you
can use cron. cron
2) cron consists of two parts. First there is the cron daemon, a process that starts automatically
when your server boots.
3) The second part is the cron configuration. This is a set of different configuration files that tell
cron what to do.
4) There are two ways you can start a cron job as a specific user: you can log in as that specific
user or use su - to start a subshell as that particular user. After doing that, you’ll use the
command crontab.
5) In the definition of cron jobs, it is very important that you specify to have it start at the right
moment. To do that, five different positions are used to specify date and time. You can use the
following time and date indicators:

Field Allowed Value

Minute 0-59

Hour 0-23

Days of Month 1-31

Month 1-12

Days of week 0-7 (0 and 7 are Sunday)

9. Give differences between symbolic,and Hard Links.


Ans
This table highlights the key differences between the two link types in Linux.

Feature Symbolic Link Hard Link

Definition A shortcut or pointer to the A direct reference to the same


target file's path. inode as the target file.

Type Works as a separate file. Essentially another name for


the same file.

File Location Can point to files on different Must be on the same file
file systems or partitions. system as the target file.

Dependencies Breaks if the target file is Remains intact even if the


deleted or moved. original file is deleted.

Size Small, as it only stores the Same size as the original file
target file's path. since they share the same
data blocks.

Usage Useful for creating shortcuts Useful for creating backup or


or cross-file system links. alternative file names.
Eg ln -s target_file symlink_name ln target_file hardlink_name

10. What are the different Linux distributions? Explain any five in brief.
Ans
● The distributions usually come with a setup program and additional documentation (normally all
on the CD[s]) to help you install your own Linux system.
● Some well-known distributions, particularly on the Intel x86 family of processors, are Red Hat
Enterprise Linux and its community-developed cousin Fedora, Novell SUSE Linux and the free
open SUSE variant, Ubuntu Linux, Slackware, Gentoo, and Debian GNU/Linux.
●The different Linux distributions are often divided into three parts:
■ Full core Linux distributions
■ Specialized distributions
■ LiveCD test distributions
●Core Linux distributions: A core Linux distribution contains a kernel, one or more graphical
desktop environments, and just about every Linux application that is available, precompiled for
the kernel.
● Some of eg. are, Fedora, Red Hat, openSuSe, Debian, etc.
●Specialized Linux distributions: providing specialized software (such as only office products for
business users), customized Linux distributions also attempt to help beginning Linux users by
autodetecting and autoconfiguring common hardware devices.
● Some of the eg. are Linspire, Xandros, Ubuntu, Puppy Linux, etc.
●The Linux LiveCDA: relatively new phenomenon in the Linux world is the bootable Linux CD
distribution.
● This lets you see what a Linux system is like without actually installing it.

11. Write steps to Create and Manage Repositories.


Ans
Steps to Create your own repositories:
createrepo command can be use to create repositories.
This package is used to create the metadata that yum uses while installing the software
packages.
1. Create a directory that can be used to store repositories.
#mkdir /myгеро
2. Connect your RHEL CD and open Package directory.
3. Right Click and open a terminal.
4. Type su to gain root privilege.
5. Install createrepo<version> package.
6. Copy all.rpm files to /myrepo directory.
#cp* /myrepo
7. Change working directory
#cd /myrepo
8. Create repository using createrepo command
#createrepo/myrep
Steps to Manage Repositories:
Marking a directory as a repository will not complete the task.
To use your newly created repository create a repository file in the directory
/etc/yum.repos.d
1. Use the command yum repolist. In its output (repolist: 0), the command tells you that currently
no repositories are configured
2. Use the command yum search nmap. The result of this command is the message No Matches
found.
3. Now use gedit to create a file with the name /etc/yum.repos.d mугеро.геро. The file should
have the following contents:
#gedit //etc/yum.repos.d/myrepo.repo
[myrepo]
name=myrеро
baseurl=file:///myrepo
gpgcheck=0
4. Now use the commands yum repolist and yum search nmap again.
5. Now use yum command to install packages.
#yum install dhcp

12. Explain the following terms for installing and managing software:a. tarball, redhat
package manager, software dependency, RHN, querying with rpm.
Ans
Explanation of Terms for Installing and Managing Software:
Tarball: A tarball is a compressed archive file, usually with extensions like .tar.gz or .tar.bz2.
It bundles multiple files or directories into one archive, often used to distribute source code or
software. To install software from a tarball, you typically extract it and manually compile the code
using commands like tar -xvf and make.

Red Hat Package Manager (RPM):RPM is a package management system used in Red
Hat-based Linux distributions to install, upgrade, query, and remove software.
It uses .rpm files that contain precompiled binaries and metadata about dependencies.
It doesn't handle dependencies automatically, so additional tools like YUM or DNF are often used
alongside it.

Software Dependency: Dependencies are additional software or libraries required for a program
to function correctly. Managing dependencies ensures that all required components are installed
and compatible.

Red Hat Network (RHN): RHN was an online service provided by Red Hat for managing and
updating Red Hat Enterprise Linux systems. It allowed users to register systems, manage
updates, and access official Red Hat repositories.

Querying with RPM: RPM allows users to query installed packages and package files for details
like version, dependencies, and installation paths.
Example commands:
rpm -q package_name: to check if a package is installed.
rpm -ql package_name: to list all files installed by a package.
rpm -qi package_name: to get detailed information about a package.

You might also like