Вы находитесь на странице: 1из 5

http://www.hscripts.com/scripts/shell-scripts/index.

php
Rename File Simple Shell Renamer script that can rename files in the current directory. Execute the script in the command prompt to rename a file. a) Used for renaming files. b) Fast File Renamer. c) No need of any installations. d) Just copy the code and execute it in your command line. b) #---------- Script by hscripts.com ---------------# c) #---------- Copywrite of HIOXINDIA ---------------# d) #--------- More scripts @www.hscripts.com -------# e) f) #!/bin/sh g) h) #string to be replaced in the filename - argument 1 i) val1=$1 j) #to be replaced with - argument 2 k) val2=$2 l) m) for filename in ./* n) do o) p) if [ ! -d "$filename" ]; then q) #sed 's/sd/tt/g' tarnn.txt > temp; mv temp tarnn.txt r) var3=`echo $filename | sed -e "s;$val1;$val2;g"` s) mv $filename $var3 t) fi u) v) # echo $filename w) done; x) #--------- Script by hscripts.com -----------# a) Copy the above code and save it with .sh extension b) Execute the sh file in command line. c) You have to pass two arguments for renaming files. $1 is an first argument. $2 is an second argument. $1 specifies old filename and $2 specifies new filename. d) Execute the shell script as sh filename.sh. Rename Multiple Files Free shell renamer script used for renaming multiple files under the particular folder. a) Renaming multiples files on your computer is made easy. b) Add or rename file extensions. c) Just copy the code and use it in your command line. d) Fast and simple renamer shell script

#-----------------#-----------------

Script by hscripts.com Copywrite of HIOXINDIA

------------------# ------------------#

#-------------#!/bin/bash echo read echo read

More scripts @www.hscripts.com

---------------#

"Enter Folder Name Under which filename is to be renamed:"; fname //foldername "Enter the File Name:"; name1 //filename without extension

cd $fname for x in *.png // Change extension as per your need do n=${x/.png/.png}; mv $x $name1$n; done #------------ Script by hscripts.com -------------------------# a) Copy the above code and save it with .sh extension b) Execute the sh file in command line for renaming multiple files. c) Execute the renamer shell script as sh filename.sh. d) Give the foldername and filename. e) Now all files are renamed under the specific folder. Simple script when executed creates dancing effect of the cursor pointer in the command promt. a) Fun script written using shell. b) Gives a dancing effect on the pointer. c) Simply execute the file to have the cursor effect. b) #------------------ Script by hscripts.com ------------------# c) #----------------Copywrite of HIOXINDIA ------------------# d) #-------------- More scripts @www.hscripts.com ---------------# e) f) #!/bin/sh g) h) var1=$1 i) j) count=2000 k) l) for (( i = 0 ; i <= $count; i++ )) m) do n) o) cc=`echo $i%4 | bc` p) #echo $cc q) if [ $cc == 0 ] r) then s) echo -e '\b|\c' t) elif [ $cc == 1 ] u) then v) echo -e '\b/\c' w) elif [ $cc == 2 ] x) then y) echo -e '\b-\c' z) else [ $cc == 3 ] aa) echo -e '\b\\\c' bb) fi

cc) dd) done ee) ff) #------------ Script by hscripts.com -------------------------# a) Copy the above dancing code and save it with .sh extension b) Execute the sh file in command line. c) Execute the shell script as sh filename.sh. d) Find the cursor pointer dancing on the screen. Recursively Remove Files From Folder A shell script that is used to recursively remove any pattern of files like swap files, thumb.db files, etc, under a given folder and the subfolders under the given folder. a) Recursively Remove your unwanted files in a fraction of second. b) It makes easier to find and delete the swap files under the folder and subfolder of the given path. c) Just copy the code and use it in your command prompt. d) Fast and simple remove files shell script. b) #------------------ Script by hscripts.com ------------------# c) #----------------Copyright of HIOXINDIA ------------------# d) #-------------- More scripts @www.hscripts.com ---------------# e) f) #!/bin/bash g) h) echo "Enter Folder Name under which you want to remove files:"; i) read fname j) echo "Enter the pattern to remove (for eg, if swap files give as *~ else if thumbs.db give as Thumbs.db)"; k) read name1 l) m) echo "Total Count of files found on the pattern" $name1; n) find $fname -type f -name "$name1" | xargs wc -l o) p) find $fname -type f -name "$name1" -exec rm {} \; q) r) #------------ Script by hscripts.com -------------------------# a) Copy the above code and save it with .sh extension b) Execute the shell script as sh filename.sh to remove the files recursively. c) Give the foldername under which you want to delete the files. d) It will prompt the user to enter the pattern. e) Specify the pattern for removing. for eg, * if you want to remove all swap files under the folder then do specify as "*~". * if you want to remove all thumbs.db files under the folder then do specify as "Thumbs.db". * Likewise you can also remove all error_log files, etc., recursively. e) Finally it gives you the total number of files found for the pattern. FTP Login Report

Simple yet powerful shell script to check the FTP server login details. The script generates ftp server accessing reports upon execution. a) Used to check ftp login details. b) Just copy the code and use it in your command line. c) Execute the script as a root user and find out the login details. b) c) d) e) f) g) h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) #------------------ Script by hscripts.com ------------------# #----------------Copywrite of HIOXINDIA ------------------# #-------------- More scripts @www.hscripts.com ---------------#

awk -F: '{ if($3>=500) print $1 }' /etc/passwd > userslist.txt ddm=$IFS IFS=" " dt=`date +%d` if [ $dt -gt 9 ];then logdate=`date | cut -d" " -f2,3` else logdate=`date | cut -d" " -f2,3,4` fi nolines=`cat userslist.txt | wc -l` lineno=1 echo > ftprep.txt while [ $lineno -lt $nolines ] || [ $lineno -eq $nolines ] do user=`sed -n "${lineno}p" userslist.txt` lineno=`expr $lineno + 1` nologs=`cat /var/log/messages | grep 'pure-ftp' | grep "$logdate" | grep $user | grep 'logged in' | wc -l` x) if [ $nologs -gt 0 ]; then y) echo -e $user '\t' $nologs times >> ftprep.txt z) fi aa) done bb) hostname=`hostname` cc) email='support@hioxindia.com' dd) (echo FTP Login Report;echo ----------------------;sort +1 -2 -n -r ftprep.txt) | mail -s "FTP report for $hostname" $email ee) ff) #------------ Script by hscripts.com -------------------------# a) Copy the above code and save it with .sh extension b) This script is used in server side only. c) Execute the shell script as root user with the filename sh filename.sh. d) Check the FTP server login details. Net Stats Netstats is a simple script for checking network and Internet connections. The Netstats script is used to display the total request, connection to port 80, ESTABLISHED status, TIME_WAIT status, FIN_WAIT1 status, LAST_ACK status, SYN_RECV status, LISTEN status and CLOSE_WAIT status.

a) Used to find out the netstats. b) Just copy the code and use it in your command line. c) Server side script to check network statistics. b) c) d) e) f) g) h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) <!-<!-<!-Script by hscripts.com --> Copywrite of HIOXINDIA --> More scripts @www.hscripts.com

-->

nreq=$(netstat -apnut | grep ':80' | grep -v '127.0.0.1' | wc -l) nest=$(netstat -apnut | grep 'ESTABLISHED' | grep -v '127.0.0.1' | wc l) ntmt=$(netstat -apnut | grep 'TIME_WAIT' | grep -v '127.0.0.1' | wc -l) nfnwt=$(netstat -apnut | grep 'FIN_WAIT1' | grep -v '127.0.0.1' | wc l) nlst=$(netstat -apnut | grep 'LAST_ACK' | grep -v '127.0.0.1' | wc -l) nsyn=$(netstat -apnut | grep 'SYN_RECV' | grep -v '127.0.0.1' | wc -l) nlist=$(netstat -apnut | grep 'LISTEN' | grep -v '127.0.0.1' | wc -l) ncls=$(netstat -apnut | grep 'CLOSE_WAIT' | grep -v '127.0.0.1' | wc l) echo echo echo echo echo echo echo echo echo echo "Total request on" `date +" %d-%m-%y-%R"` >> test.txt "Connection to port 80 " $nreq >> test.txt "ESTABLISHED status" $nest >> test.txt "TIME_WAIT status" $ntmt >> test.txt "FIN_WAIT1 status" $nfnwt >> test.txt "LAST_ACK status" $nlst >> test.txt "SYN_RECV status" $nsys >> test.txt "LISTEN status" $nlist >> test.txt "CLOSE_WAIT status" $ncls >> test.txt "==================================================" >> test.txt

#------------ Script by hscripts.com -------------------------#

a) Copy the above code and save it with .sh extension b) This script is used to find the netstats / network statistics. c) Execute the netstats shell script as sh filename.sh. d) All the information are stored in test.txt file. Get the details just open test.txt file and read it

Вам также может понравиться