Skip to main content

Posts

Showing posts with the label linux

How to read log files in linux server

 Let say you want to read file with specific string than write command Go to /var/log and log directory let say jasmin where we are going to read message.log file Commad: -cat message.log | grep status:CommandStatus.ESME_ROK //hit enter it will show results with status:CommandStatus.ESME_ROK string. And if you want to calculate number of lines, word, characters -cat message.log | grep status:CommandStatus.ESME_ROK | wc -cat message.log | grep status:CommandStatus.ESME_ROK | wc -l // l for lines -cat message.log | grep status:CommandStatus.ESME_ROK | wc -w / wo for words -cat message.log | grep status:CommandStatus.ESME_ROK | wc -c // c for charac Filter the line and only specified content than add extra command to your command line -cat message.log | grep status:CommandStatus.ESME_ROK | cut -d " " -f 11 | wc -l Now what does it mean get me the content of message.log file where this "status:CommandStatus.ESME_ROK" string abd cut the line replace wi...

How to find out if a package is installed in Linux?

1) How to find out if a package is installed or not in Linux There are multiple ways to check find locate package is installed in linux machine or not 1.a) Using which command The  ‘which’  command returns an executable path that can be executed when the command is entered in the terminal. # which vi /usr/bin/vi 1.b) Using whereis command The  ‘whereis’  command is used to search the binary, source, and man page files for a given command. # whereis vi vi: /usr/bin/vi /usr/share/man/man1/vi.1p.gz /usr/share/man/man1/vi.1.gz 1.c) Using locate command The  ‘locate’  command performs faster than the find command because it uses an updatedb database, whereas the find command searches in real time. # locate --basename '\nano' /usr/bin/nano /usr/share/nano /usr/share/doc/nano 2) How to find out whether a package is installed or not in Linux, using package manager 2.a) On CentOS / Red Hat (RHEL) 6/7 Use  yum command  or  rpm command  to deter...

Set cron job in redhat linux os

 Use full links All user (Login user) cron job are placed in crontab. Each user can schedule its job independently. User can access its cron job with this command -crontab -e -u root and cron table will open. 1) https://devarticles.in/how-to-run-url-from-cronjob-at-specific-time-in-linux/ 2) https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/ 3) Run command after specific time interval https://linuxhint.com/execute-crontab-every-5-minutes/#:~:text=A%20crontab%20has%205%20fields,time%20a%20command%20should%20execute.&text=To%20execute%20a%20crontab%20every,command%20after%20every%205%20minutes. https://www.tecmint.com/create-and-manage-cron-jobs-on-linux/

Create backup and restore databases in mariaDB

=========backup and restore mariaDB databases.=========== Step1: Go to the location where you want to store database backup now i'm creating backup of rbs database. -mysqlidump -u root -p rbs > rbsbak.sql check last lines of DB file to verify the file contains query lines.  -tail -n 10 brainwifibak.sql Step2: delete database Step3:  Restore the backup database  go to location where backup database file is placed.  -mysql -u root -p -h localhost rbs < rbsbak.sql Step 4: Create user with same privileges as super-user GRANT ALL PRIVILEGES ON *.* TO 'tolkien'@'%'; ==================create user in mariaDB===================== Step1: Create new user  -CREATE USER 'root'@'localhost' IDENTIFIED BY 'Pakistan2'; Step2: Grant all privileges to root user to he can access all databases.  -GRANT ALL PRIVILEGES ON *.* TO 'user1'@localhost IDENTIFIED BY 'password1'; Step3: Grant permissionfor only one database Grant all privileges to  ...

Install MariaDB 10.6 on Oracle Linux 8|Rocky Linux 8

  Install MariaDB 10.6 on Oracle Linux 8|Rocky Linux 8 How can I quickly install MariaDB 10.6 on Oracle Linux 8 / Rocky Linux 8?. MariaDB is a free and open-source relational database management system forked from MySQL and community-developed. The database software is released under the GNU General Public License. Our short tutorial will teach you how to install and configure MariaDB 10.6 on Oracle Linux 8 | Rocky Linux 8 Linux system. Install MariaDB 10.6 on Oracle Linux 8|Rocky Linux 8 You should have a running Oracle / Rocky Linux server before you start the installation. This can be a physical server, virtual machine running on VMware, KVM, OpenStack or cloud provider such as AWS. A user that has sudo privileges is also required for the installation. Step 1: Update System Run the command below to pull the latest packages of the applications installed in your system. $ sudo dnf update Transaction Summary =========================================================================...

Linux directory system

1:  I/usr The /usr mean in Linux is nothing but a directory which usually called as "User Programs". It comprises with several sub-directories and that contains binary files, lib files, doc files and the source code. /usr/bin which contains all the binary files for the user related programs. In some distors we cannot find the root directory of bin which is usually comes under "/bin", hence you can look into the /usr/bin. Eg: at, curl, dd, df ,etc /usr/sbin which also contains the binary file for the Administrators. Means for any system related commands can be find under this directory. Eg: fdisk, cron, ip6tables, lsmod , etc. /usr/lib which contains all the libraries for the /usr/bin and /usr/sbin /usr/local which contains the users related programs, which means when you install anything from the source it may goes directly to the /usr/local/xxxx 2:  /var https://www.javatpoint.com/linux-fhs-variable-directory#:~:text=Variable%20Directory%20(%2Fvar),spool%20files%20...

1 Linux Background and history

Linux History

Linux Commands

  Linux Commands 1.  OS-Release -cat /etc/os-release -cat /etc/redhat-release show os //kernal information -uname  show kernal middleware It is intermediator between hardware and software. -uname  -r what is process architect. -uname -p To show all information -uname -a 2.  Date-CAL -date -cal 3.  Booting in Linux (Run-Levels) Shutdown/Close pc -init 0  Single user mode -init 1 Multiple user mode -init 2 Multiple user mode with network plus full support Not use -init 4 Graphical mode init 5 Reboot the system -init 6 4.  Target command in Linux (systemctl) With the help of target we can manage system specific as well as user specific task. Target command is system Control (systemctl). Basically it is utility, which build to replace 'init' command. What systemctl can do ?  We can find its all commands with the help of single command. write systemctl enter twice TAB button. //it will list all its commands. Show current system mode - systemctl...