A bash command to search for all hidden files recursively in the current directory but ignore apache .htaccess files.
bash |copy code |?
1 find . -type f \( -iname ".*" ! -iname ".htaccess" \)
A bash command to search for all hidden files recursively in the current directory but ignore apache .htaccess files.
bash |copy code |?
1 find . -type f \( -iname ".*" ! -iname ".htaccess" \)
How to split a file in chunks and how to put them back together.
bash |copy code |?
01 ### SPLIT LONG:02 split --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_03 split --verbose --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_04 05 06 ### SPLIT SHORT:07 split -b 5m -a 2 -d image.iso image.iso.part_08 09 10 split --verbose -b 5m -a 2 -d image.iso image.iso.part_11
Snippet to use in your scripts to execute them only if you have root privileges.
犀利士
### RESTORE
cat image.iso.part_* > image.iso
bash |copy code |?
1 if [ $UID -ne 0 ]; then
Usefull script to check if a proxy is alive.
echo "Superuser privileges are required to run this script."
echo "e.g. "sudo $0""
exit 1 fi
bash |copy code |?
01 #!/bin/bash06 # HTTP Proxy Server's IP Address (or URL)07 08 proxy_server=$109 10 # HTTP Proxy Server's Port Number11 12 port=$213 14 15 # We're trying to reach this url via the given HTTP Proxy Server16 # (http://www.google.com by default)17 18 url="http://www.google.com"19 20 # Timeout time (in seconds)21 timeout=2022 23 # We're fetching the return code and assigning it to the $result variable24 result=`HEAD -d -p http://$proxy_server:$port -t $timeout $url`25 26
This script let you get a song from last.fm.
# If the return code is 200, we've reached to $url successfully
Maybe it’s no longer working
if [ "$result" = "200 OK" ]; then
echo "1 (proxy works)"
# Otherwise, we've got a problem (either the HTTP Proxy Server does not work
# or the request timed out)
else
echo "0 (proxy does not work or request timed out)"
fi
bash |copy code |?
1 curl -s http://www.last.fm/user/$LASTFMUSER | grep -A 1 subjectCell | sed -e 's#<[^>]*>##g' | head -n2 | tail -n1 | sed 's/^[[:space:]]*//g'11 bash |copy code |?
01 #!/bin/bash12 # Google url shortener bash script13 # We're fetching the return code and assigning it to the $result variable14 # http://ggl-shortener.appspot.com/instructions/15 16 app='http://ggl-shortener.appspot.com/?url='17 url="$1"18 protocol=`echo "$1" | sed -e "/^http:///g"`19 20 if [ -z "$1" ]; then21 Remove RSA key for ssh authorized hosts file
How to remove an ssh host by name or ip from your authorized hosts file.
echo -e "e.g. `basename $0` http://url";2 else
Some cat with awk and then sort to find out what ips are most common in your apache access.log file. Remember that all ips are include here. Bots, crawlers, clients…
if [ ! "$protocol" ]; then
How to empty a mysql database. Forget about delete * command
curl -s "$app$url" | sed -e 's/{"short_url":"//' -e 's/"}/n/g'
You want to know instantly who has logged in your ssh server. You can be emailed automatically including in .bashrc file of the user you want to monitor following co必利勁
mmands:
else