When you work with large CSV files it is sometimes useful to have a quick way to split the csv file into smaller pieces so that another application / process / people can work on these smaller files in parallel. Here is a nifty bash script to split a csv file into multiple pieces and retain the same header in all pieces.
We can execute system commands using SHELL. shell_exec is a PHP function that returns the output as a string or null if it is a wrong output. Note that, this function is disabled when the PHP is running in a safe mode.
This is a small shell script that will help to detect ip conflicts in a network. The notify-send command, used in the script, will enable a popup if any ip conflict is detected. You can run this script in cron. You will get a notification as pop up, if there is any ip conflict in the network.
One of the challenges with working with dynamic websites is that you have to keep fighting malicious users who regularly sap your server capacity with rogue crawling of your site. To do this you would have to monitor and analyze the traffic patterns on the server regularly. You would definitely want to do this when you have load spikes on the server and you wish to find out the IP addresses, user agents and the specific URLs which resulted in these spikes.
[SHELL-SCRIPT] A Linux Shell Script to create a folder with a specific name under all sub-directories of a parent folder
This is a script to create a particular directory under all subdirectories in a parent directory. Consider the case when a parent directory consists of more than 100 folders and you want create a new folder under all these directories, with the same name. Doing this manually would be a mess. This script would help you do this in no time. These are the steps for executing the script: First, add the exact path where the parent directory is present, and the name of the folder that is to be created.
HP has published the price lists for its range of Pavilion Laptops for the month of January 2013.
Shell script to rename a specific-directory present under all sub-directories in a specified parent folder
The function of the script is to rename a specific-directory present under all sub-directories of a specified parent folder. Consider, you have a particular folder under all sub-directories of a folder and you want to rename all of those occurrences. Doing it manually would take much time. Here is a script to make it easy for you. The script takes the following inputs: 'path' is the absolute path of the parent folder, and 'foldername.txt' is a text file which contains the names of the subdirectories under each of which the specific directory has to be renamed.
This is a common question asked by many cPanel/WHM users. Linux shell access is demanded by most web developers due to its advantage over the normal cPanel interface. Steps to enable shell access for a normal cPanel/WHM setup are:
Recently we had to provide support on a Red Hat Server where there were hundreds of users and the user directories organized into hierarchies. Normally we change to a users directory using cd ~username. We had some extra time on our hands and wanted to play with the /etc/passwd file and tried to use awk to do the same thing. The following one liner will do this the hard way :-)