Showing posts with label Scripts. Show all posts
Showing posts with label Scripts. Show all posts

How to change default Linux VI text editor to Pico

15 comments

If only for the session just run this: export EDITOR=/usr/bin/pico


If you want to change it so every time it will use Pico do this:


Open the server command line


Run:



  1. export EDITOR=/usr/bin/pico

  2. pico ~/.bashrc


Add this line at the bottom of the file:



  1. export EDITOR=/usr/bin/pico


Save the file and your done.


This changes the server to always use Pico no matter when it’s being used.

The way to find and Replace script for Linux

0 comments
screensaver

Shell Script to Recursively Search and Replace on Linux

Save the file in the directory you want to search and call it replace.

—->>>do not add this line

#!/bin/bash
# This script will search and replace all regular files for a string
# supplied by the user and replace it with another string.
#
#
function usage {
echo “”
echo “Search/replace script revised by dwhs.net and ezliuxadmin.com”
echo “”
echo “Not enough parameters provided.”
echo “Usage: ./$0 searchstring replacestring”
echo “Remember to escape any special characters in the searchstring or the replacestring”
echo “”
}

#check for required parameters
if  [ ${#1} -gt 0  ]  &&  [ ${#2} -gt 0  ];
then
for f in `find  -type f`;
do
if grep -q $1 $f;
then
cp $f $f.bak
echo “The string $1 will be replaced with $2 in $f”
sed s/$1/$2/g < $f.bak > $f
rm $f.bak
fi
done

else
#print usage informamtion
usage
fi

—->>>do not add this line

When you add the script make the permissions to 755

Then run the command string to set the variables.

./replace oldtext newtext

Cpanel fix it scripts

0 comments
/scripts/securetmp – secures tmp folders
/scripts/fixcommonproblems – cleans up common issues
/scripts/fixeverything – cleans up the server
/scripts/runlogsnow – Force a webalizer/analog update
/scripts/upcp – Update Cpanel
/scripts/quicksecure – Shuts down ovious security holes
/scripts/remdefssl – Delete Nasty SSL entry in apache default httpd.conf
/scripts/updateuserdomains – If a domain is missing in the cpanel list run this mayneed to clean the /var/cpanel/usr file as well.