Linux Unit 1
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
➖
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.
➖
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
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
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.
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.
Minute 0-59
Hour 0-23
Month 1-12
File Location Can point to files on different Must be on the same file
file systems or partitions. system as the target file.
Size Small, as it only stores the Same size as the original file
target file's path. since they share the same
data blocks.
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.
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.