php -i | grep configure | tr -d \'
du -sckh * | sort -n
cat /etc/sitemap | awk '{print $2}' | xargs -n 1 ping -c 1 -t 1 | grep PING | awk '{print $3}' | sort | uniq
while read k2;do <command> $k2;done < file
sed -i "s/$/<text to add>/" file
sed -i "s/^/<text to add>/" file
TERM=xterm-color; export TERM
(specifically used for SSL)
sed 's/\(.\{64\}\)/\1\n/g' file
find ./ -name ".htaccess"|xargs perl -pi -e 's/original/newstring/g' --OR-- find . -type f -print0|xargs -0 perl -pi -e 's/mysql_connect \(\"pqr.k2patel.com/mysql_connect \(\"xyz.k2patel.com/g' --OR-- for file in *; do [[ $file = remove ]] && continue; fgrep -vf remove "$file" > k2.tmp ; mv k2.tmp "$file"; done
vgscan --mknodes //load the nodes in /etc vgchange -ay //activate the nodes lvscan //scan and check the status mkdir /mnt/somename //directory to mount mount /dev/VolGroup00/LogVol00 /mnt/somename //mount on directory
php_admin_flag safe_mode Off //put this in the httpd.conf if nothing works php_flag safe_mode Off php_value safe_mode "0" php_flag register_globals off php_flag display_errors off DirectoryIndex index.php index.shtml ErrorDocument 404 / ErrorDocument 403 / ErrorDocument 500 / ErrorDocument 302 / ErrorDocument 403 http://www.k2patel.com Redirect 301 / http://k2patel.com/show.php?m=1895&st=1&sid=65 php_flag log_errors on php_flag safe_mode Off php_flag register_globals on php_value session.save_path /srv/www/apache/tmp
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteEngine on RewriteCond $1 !^the/pathto/the/directory RewriteRule (.*) http://www.newsite.com/$1 [R=301,L] OR RewriteEngine on RewriteRule !^the/pathto/the/directory - [C] RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]
chflags noschg <file name> -- unlock chflags schg <file name> -- lock
VI : %s/^M//g (To get the ^M hold the control key, press V then M (Both while holding the control key) and the ^M will appear.) -OR- sed 's/'"$(printf '\015')"'$// -OR- tr -d '\r' <old.file >new.file
find . ! -user tiffany | xargs chown tiffany:tiffany
find . -type d -name '5 "' -exec rm -Rv "{}" \;
ifconfig fxp0 inet <IP> netmask <sub-net> alias -- add ifconfig fxp0 inet <IP> netmask <sub-net> -alias -- remove
while read -r k2 ; do sed -e 's!\$k2!'"$k2"'!g' < site.cnf ; done < sitelist.cnf > site.all.cnf
# -d used as delimiter in example it is space " ". paste -d " " file1 file2 >"outputfile1"
for i in `find . -type f` ; do mv $i /home/yahoo/Photos/ ;done
wget -r --no-clobber --continue --user=USERNAME --password=PASSWORD ftp://hostname --OR-- ncftget -R ftp://ftp.mydomain.com source dest
for i in `jot 251 4`; do echo xx.yy.pp.$i; done --OR-- for ((i=4; i<=254; i++)); do echo "xx.yy.pp.$i"; done --OR-- for i in {4..254}; do echo "xx.yy.pp.$i"; done
find . -type f -exec grep -q '*POSSIBLE SPAM*' {} \; -exec echo mv {} /home \; --OR-- grep -rl 'POSSIBLE SPAM' |while read f; do mv "${f##*/}" "${DEST}"; done --OR-- find . -type f -exec grep -Fq '*POSSIBLE SPAM*' -exec mv {} /home/ + #maybe, or \;
date yymmddhhss
netstat -tlpn
sed -e 's#.*#nslookup & |awk '"'"'/^Name/{n=$2}/^Address/{a=$2}($2=="canonical"){c=sprintf("%s%s",c,$1)}END{print "& "n" "c" "a}'"'"'#' hostlist.txt|sh
cu -l /dev/cuaa0 ttyd0 "/usr/libexec/getty std.9600" vt100 on secure ttyd0 "/usr/libexec/getty std.9600" dialup off secure
find /srv/www/html -name '*.php' -o -name '*.htm*' -print0| xargs -0 grep -i '<script>function' | cut -d ':' -f1
mount -o loop disk1.iso /mnt/disk
it read sample config from sample.conf replace $k2 in that file with varlist and append all to file $k2.testing.cfg file
while read k2 ; do sed -e 's!\$k2!'"$k2"'!g' < /home/testing/sample.conf >> $k2.testing.cfg ; done < /home/testing/varlist
You may want to test a response of a HTTPS host using telnet port 443, however because of SSL, the httpd will not provide the information via telnet because of the lack of handshake for SSL certificate. You can use openssl as below:
openssl s_client -connect $host:443 -state -debug GET / HTTP/1.0 Host: $host
This will print each space separated word on new line.
tr ' ' '\n' < file
In order to get all IP allocated to specific country you need to get list of IP Blocks.
you can get that list from following URL.
wget ftp://ftp.apnic.net/public/apnic/dbase/data/country-ipv4.lst
wget ftp://ftp.apnic.net/public/apnic/dbase/data/country-ipv6.lst
Now for IPv4, I never worked on IPv6 format so far so i am explaining IPv4 Only.
To generate list for all block from china you can simply use command as below.
cat country-ipv4.lst | awk -F : '{print $2, $3}' | grep cn | awk '{print $1}'
now you can save that file and use it.
Many times mysql password or MD5 on phpmyadmin does not work on resetting password.
admin = 21232f297a57a5a743894a0e4a801fc3 secret = 5ebe2294ecd0e0f08eab7690d2a6ee69 OU812 = 7441de5382cf4fecbaa9a8c538e76783
You can use following command in order to create MD5 HASH.
echo -n "9qL[%T#3SM" | md5sum
Show standard out to window and write to file
while $(/bin/true); do echo YAYYAYA; sleep 3; done > >(tee logfile)
while $(/bin/sleep 300); do pgrep -u jthomas -f java; if [ $? -eq '1' ]; then echo "Render Done" | mail -s "Render Done" beep-jthomas@something.com; fi done &
while read -r line; do grep $line /etc/passwd > /dev/null; if [ $? == 1 ]; then echo $line; fi; done < /var/tmp/jtlist
rpm -qa --queryformat='%{N}-%{V}-%{R}.%{arch}\n'
for k2 in $(rpm -qa); do rpm --setugids ${k2}; done for k2 in $(rpm -qa); do rpm --setperms ${k2}; done
sdiff <(sort list) <(sort masterList)
grep -v -e '^#\|^\W*$'
OR
grep '^[[:blank:]]*[^[:blank:]#;]' $file
date -d '1 month 15 days 2 hour 30 minute ago'
/sbin/ifconfig | grep 'inet ' | cut -d: -f2 | awk '{print $1}' | grep -v -e ^'\(127.0.0.1\|192.168.\|10.\)'
fc-list OR e.g. /usr/bin/fc-list :style=medium
Advanced Mail command which allow you to specify From.
it is now installed on most OS including RHEL / CentOS.
nail -eiIUdEFntBDNHRV~ -T FILE -u USER -h hops -r address -s SUBJECT -a FILE -q FILE -f FILE \ -A ACCOUNT -b USERS -c USERS -S OPTION users e.g. nail -r k2patel@mail.us -s "testing message" k2patel@hotmail.com
Print list of file in PWD
alias fltree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'" fltree
for k2 in {71..95} ; do sed -e 's!\$k2!'"$k2"'!g' <test2 ; done
authconfig --test | grep hashing
authconfig --passalgo=sha512 --update
sed -ie '/serial/s/[0-9][0-9]*/2014050900/'
cat file.ps | ghostview -landscape -
python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
Simple easy way to install perl module locally.
Simply install local::lib
In order to install module locally use command as shown below.
perl -MCPAN -Mlocal::lib -e 'CPAN::install(threads)'
Make sure you run sync command before each command here.
Alternatively you can use
sysctl -w vm.drop_caches=<number>
Free Dentries, Inodes and pagecache from cache memory
echo 3 > /proc/sys/vm/drop_caches
Free Inodes and Dentries from cache memory
echo 2 > /proc/sys/vm/drop_caches
*Free PageCache from memory**
echo 1 > /proc/sys/vm/drop_caches
Writing to /proc/sys/vm/drop_caches allows one to request the kernel immediately drop as much clean cached data as possible.
This will usually result in some memory becoming more obviously available; however, under normal circumstances this should not be necessary.
BE WARNED that using vm.drop_caches can cause a deadlock if the system is under heavy memory and I/O load!!!
ping -v -M do -s 8064 192.168.1.1
Simplest thing to do is use built in functionality to search and remove in command. Here is the file i've on my machine.
�^?
which translate to ''$'\250\177' <br> So check or list all the files with ascii in it.
ls [^[:ascii:]]*
now to remove
rm [^[:ascii:]]*
Regex can be modified to list all matching file before removal.
In linux proper way to test tcp or udp port connection without any software installed should be creating dev node.
/dev/<proto>/<host>/<port>
out put can be redirected to tty with help of cat.
cat < /dev/tcp/k2patel.in/3306
Setting mp3 tag on multiple file based on filename as song name.
Same artist.
while read k2; do id3tag -a'xyz guru' -A'SuperSpeed' -s"${k2%%.*}" -y'2021' "${k2}" ; done < <(ls *.mp3)
I had issue of no audio while playing file over DLNA.
I've did the transcoding so it can play audio on my Phillips 4K TV.
ffmpeg -i <input_file>.mp4 \ -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:5 -map 0:12 \ -c:v copy \ -c:a:0 truehd -strict -2 \ -c:a:1 ac3 \ -c:s copy \ <output_file>.mkv
OR
ffmpeg -i old_file.mp4 \ -map 0:0 -map 0:1 -map 0:3 -map 0:5 \ -c:v copy \ -c:a:0 ac3 \ -c:s copy \ new_file.mp4
OR
ffmpeg -i old_file.mkv \ -map 0:0 -map 0:1 -map 0:2 \ -c:v copy \ -c:a:0 ac3 \ -c:s copy \ -disposition:s:0 forced \ new_file.mkv