Categories
Linux Useful

Automatic REBOOT if needed after apt-get upgrade – Linux

Sometimes after the execution of the apt-get upgrade command is finished, a restart is required, but this is not displayed after the command is completed, but you have to do it manually. To do this, you need to check the existence of the /var/run/reboot-required file and then restart the system if the file exists. To […]

Categories
Linux

Detach script/command in Linux – Easy Way !

Hot to start and detach bash script (or command) in linux from the command line: setsid nohup monitor.sh & detach script/command with custom log: setsid nohup monitor.sh &>/tmp/monitor.log & And to check the result, use a linux command that shows the process hierarchy: root@byrev:/usr/local/bin# ps -efj –forest

Categories
Linux

Kill Process in Linux by PID, Name or Group

Kill a Process in Linux from command line using kill command: kill process by name: kill $(ps aux | grep ‘process_name’ | awk ‘{print $2}’) kill process by ID kill -9 PID Kill all descendant/recursively processes The easy way to do this in a shell script is using pkill command: pkill -TERM -P 123456 where […]

Categories
Linux PHP Servers Useful

Get PHP MAJOR,MINOR and RELEASE Version Number – Linux Server

To find out the current version of php active on the server, there are basically two simple solutions and both use the php command with additional parameters. 1. php + grep + cut @ php -v | grep ^PHP | cut -d’ ‘ -f2 7.4.13 2. php +  internal constant from php itself @ php […]

Categories
Linux Useful

How to Remove Files Recursively using Wildcard? – Linux Command Line

A short time ago I had to delete a lot of files created by a script, which I didn’t need anymore, but those files were scattered all over the disk, in many folders and subfolders. After scouring the whole internet, reading all sorts of scripts and commands, I finally found a close solution, which I […]