Discovering the concept of linux

Discovering the concept of linux

LINUX WORKSHOP :- Day 5

Hello everyone ;

I am Teertha Darekar

Welcome back to my day 5 blog of linux Workshop conducted by Pranav Jambare sir.

CONTENTS :-

  • Logs

  • YUM and RPM

  • Cron

-->LOGS

  • Logs in Linux are records of events that occur on a computer system.

  • Logs in Linux are typically stored in a specific directory on the file system and can be viewed using a text editor or a command line tool.

  • They can contain information about system events, application errors, security breaches, and more.

  • Reviewing logs can be helpful in troubleshooting issues or investigating security incidents.

Linux has a special directory for storing logs called

/var/log

RSYS LOG

  • rsys means rocket-fast system for log processing (rsysylog) .

  • It is system utility provided in linux which provides support for message logging .

  • This is a very useful utility that can accept input from a wide variety of sources and transform them and store them in multiple and diverse destination.

Types of logs in linux

  • kern : keeps in Kernel logs and warning info.

  • boot: start-up messages and boot info.

  • dmesg: a repository for device driver messages.

  • wtmp: record of each login/logout.

  • maillog: is for mail server logs.

  • faillog: records info on failed logins .

  • yum: holds data on any package installations that used the yum command.

  • cron: keeps a record of Crond-related messages .

  • secure: Keep authentication logs for both successful or failed logins, and authentication processes.

  • messages: shows general messages and info regarding the system.

  • xorg: graphical related.

Facility:

Facility is the identifier used to describe the process or the application that generated the log message.

Some examples are the kernel, mail, ftp, etc.

Following is the list of facilities :-

  • Auth: Facility for the activities related to requesting name and password.

  • Authpriv: This facility is the same as that of auth other than giving access to a file that selected users can only read.

  • Cron: Facility used to capture messages from the cron system scheduler.

  • Daemon: Facility for the system daemon catch-all.

  • Ftp: Facility for the messages related to ftp daemon.

  • Kern: Facility to get the kernel messages.

  • lpr: Messages from the line printing system.

  • Mail: Messages relating to the mail system.

  • Mark: Pseudo-even is used to generate timestamps in log files.

  • News: Messages relating to network news protocol (NNTP).

  • User: Regular user processes.

Priority:

Priority tells about the importance of a message.

Within syslog levels are defined as guidelines from critical events to debugging information.

Following is the list of priorities :-

One with the greatest importance is at the top and the least at the bottom.

  • Emerg: Emergency conditions, such as an imminent system crash, are usually broadcast to all users.

  • Alert: A Condition that should be looked into immediately, for example, a corrupted system database.

  • Crit: A Critical condition, for example, a hardware error.

  • Err: Ordinary error

  • Warning: Warning

  • Notice: This condition is not an error, but it should be handled in some special way

  • Info: Informational message

  • Debug: Messages that are used when debugging programs

Logrotate

It is a system utility that manages the automatic rotation and compression of log files .

They are used to backup the logs.

Journalctl

The journalctl command is used for viewing logs collected by systemd.

--> YUM

YUM performs dependency resolution when installing, updating, and removing software packages.

YUM allows any changes to be rolled back.

allows automatic upgrades to the latest available version

• yum install [pkg_name] -y

• yum remove [pkg_name] -y

• yum update [pkg_name]

• yum list [pkg_name]

• yum search [pkg_name]

• yum info [pkg_name]

• yum update -y

--> RPM

RPM Package Manager (also known as RPM), is an open source program for installing, uninstalling, and managing software packages in Linux.

RPM was developed on the basis of the Linux Standard Base (LSB).

• rpm -ivh [pkg_name]

• rpm -gpr [pkg_name]

• rpm -ivh --nodeps [pkg_name]

• rpm -q [pkg_name]

• rpm -qa -last

• rpm -qa

• rpm -uvh [pkg_name]

• rpm -evv [pkg_name]

APT

Advanced Package Tool, more commonly known as APT, is a collection of tools used to install, update, remove, and otherwise manage software packages .

  • apt-get update -y

  • apt-get check [pkg_name]

  • apt-get upgrade [pkg_name]

  • apt-get install [pkg_name]=[version_number]

  • apt-get install [pkg1] [pkg2]

  • apt-get install -download -only[pkg_name]

Repositories

Linux saves repository configuration files in the :-

/etc/yum.repos.d/ directory.

To create a local YUM directory, you need to create a repository configuration file in this directory.

Linux treats all files having the .repo extension as repository configuration files.

--> CRON

The syntax of the crontab command contains six parts separated by a space in which the first five parts illustrate the time to execute the operation and the last part illustrates the command.

<Minute> <Hour> <Day_of_the_Month> <Month_of_the_Year> <Day_of_the_Week> <command>
  • Minute – A minute value can be between 0-59 .

  • Hour – A hour value can be between 0-23 .

  • Day_of_the_month – This value can between 1-31. For the months having fewer days will ignore remaining part.

  • Month_of_the_year – This can be between 1-12. You can also define this value with the first three alphabets of the month like jan, feb, mar, apr etc.

  • Day_of_the_Week – This can be the value between 0-7. Where 0 and 7 for Sunday, 1 for Monday, 2 for Tuesday, and so on. You can also use the first three alphabets of days like sun, mon, tue, wed, etc.

The below statements will describe how to define multiple values or ranges.

  • Astrics (*) – Matches anything.

  • Multiple values – Use the command (,) to define multiple values like 2,4,8 or sun,fri or jan,oct,dec etc.

  • Define range – You can define range using the hyphen like: 1-10 or 20-30 or sun-fri or feb-apr.

  • Define multiple ranges – You can define multiple ranges with commands seperated like : jan-mar, jul-sep.

Crontab command can be used to edit the crontab file.

crontab -e

To view crontab entries of current users .

crontab -l

Thank you ......