find /path/to/files* -mtime +5 -exec rm {} \;
Monday, October 29, 2012
Delete Files Older than 5 days
Ref. http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/
find /path/to/files* -mtime +5 -exec rm {} \;
find /path/to/files* -mtime +5 -exec rm {} \;
Wednesday, October 24, 2012
[Android] Flash Android Official ROM without ROOT
ü Prerequisite
: (Warning – This might cause the warranty of product issue)
2.
PdaNet for Android (pdanetz350.exe - Version 3.50 installer)
3.
Galaxy Nexus Official ROM (takju-jzo54k-factory-92830c0b.tgz)
※ps. Version
Desc
ü Procedure
:
1.
Install Driver - pdanetz350.exe
2.
Connect Galaxy Nexus to PC (enable usb debug
mode)
※Setup à Developer options à Turn On à check USB debugging
↑Figure For step 3,4,5
3.
Choose the Current Version You
are using. (Mine is 4.0.4)
4.
Use “Inial Setup” to help you
automatically check if there is anything error.
5.
Unlock (Data would be gone in this step and
reboot the mobile)
6.
Enable usb debug mode again
7.
Clikc “Flash Stock + Unroot” à Choose the ROM(takju) you just download
Tuesday, October 16, 2012
Linux Package Management - RPM, DPKG
===============================================
dpkg
===============================================
Install Package ---->
-i(--install)
Remove Package---->
-r(--remove):remove totally exluding config file
-p(--purge) :remove totally
including config file
Query Package ---->
-l(--list) :list all package
-L package:print info
about package(file location…)
-S file:Search which
package is the file belong to (such as rpm –qf)
===============================================
apt-get
===============================================
apt-get
-d:Only download the
package file
-y:force to answer yes
install
package:install
remove package:remove
update:list
available package
===============================================
rpm
===============================================
rpm db location: /var/lib/rpm
rpm
--rebuilddb
---------------------------------------------------------------------------
Package Verify
---------------------------------------------------------------------------
-V
Package : Verify the changed file belonged to the package and list them.
-Va : List all the changed file belonged
to all packages.
-Vp Package : List possibly changed file
belonged to the package.
-Vf
file : Verify if the file is been changed.
-K Package : check the Package’s MD5 checksum and pgp.
--checksig:check Package’s
MD5 checksum and pgp.
S :file Size differs
M :Mode differs
(includes permissions and file type)
5 :MD5 sum differs
D :Device major/minor
number mis-match
L :readLink(2) path
mis-match
U :User ownership
differs
G :Group ownership
differs
T :mTime differs
import keys : rpm --import
/usr/share/rhn/RPM-GPG-KEY
/usr/share/doc/rpm-4.4.2/RPM-GPG-KEY
/usr/share/doc/fedora-release-5/RPM-GPG-KEY
/etc/pki/rpm-gpg/RPM-GPG-KEY
---------------------------------------------------------------------------
rpm -ivh Package
---------------------------------------------------------------------------
-i :install
-v :show the process
-h :show the process in
percent.
--nodeps :
--nomd5 :
--noscripts :
--replacefiles :
--replacepkgs :
--force :
--test :
---------------------------------------------------------------------------
Upgrade and Update
---------------------------------------------------------------------------
-Uvh : Install and update.
-Fvh : Upgrade only if the older package
is installed
---------------------------------------------------------------------------
Remove Package
---------------------------------------------------------------------------
rpm –e Package
rpm –e Package
--allmaches : Remove all versions of the
package which match PACKAGE_NAME.
rpm –e Package
--nodeps : Don't check dependencies before
uninstalling the packages.
---------------------------------------------------------------------------
Query
---------------------------------------------------------------------------
rpm
-q Package : check if the package
exists.
rpm
-ql Package : List all the files belonged to the package.
rpm
-qi Package : Print info about the package.
rpm
-qf file : Search which package is the file belong to.
rpm
-qc Package : List the config file of the package.
rpm
-qd Package : List the document about the package location.
rpm
-qR Package : List the dependency of the package(prequesite).
rpm
-qa :List all the installed package.
Tuesday, October 09, 2012
Linux Bash Array Usage using IFS
Ref. http://go-linux.blogspot.tw/2007/03/basharray.html
#!/bin/bash
#Put everything into array.
array=(Redhat Novell MicroSoft Sun IBM HP Dell)
#Print all value in array , seperated by IFS(:).
IFS=:
echo "${array[*]}"
#Print all value in array , seperated by IFS(\n).
IFS=$'\n'
echo "${array[*]}"
#Print all value in array , seperated.
echo "${array[@]}"
#Print the count of array.
echo "${#array[@]}"
Re:
array[0]=Redhat
array[1]=Novell
array[2]=MicroSoft
array[3]=Sun
array[4]=IBM
array[5]=HP
array[6]=Dell
Redhat:Novell:MicroSoft:Sun:IBM:HP:Dell
Redhat
Novell
MicroSoft
Sun
IBM
HP
Dell
Redhat Novell MicroSoft Sun IBM HP Dell
7
#Put everything into array.
array=(Redhat Novell MicroSoft Sun IBM HP Dell)
#Print all value in array , seperated by IFS(:).
IFS=:
echo "${array[*]}"
#Print all value in array , seperated by IFS(\n).
IFS=$'\n'
echo "${array[*]}"
#Print all value in array , seperated.
echo "${array[@]}"
#Print the count of array.
echo "${#array[@]}"
Re:
array[0]=Redhat
array[1]=Novell
array[2]=MicroSoft
array[3]=Sun
array[4]=IBM
array[5]=HP
array[6]=Dell
Redhat:Novell:MicroSoft:Sun:IBM:HP:Dell
Redhat
Novell
MicroSoft
Sun
IBM
HP
Dell
Redhat Novell MicroSoft Sun IBM HP Dell
7
Monday, October 08, 2012
Linux RPM Query command
Ref. http://www.cyberciti.biz/faq/how-do-i-find-what-dependencies-a-rpm-file-has/
How do I find what dependencies a rpm file has?
rpm -qpR {.rpm-file}
rpm -qR {package-name}
rpm -qR {package-name}
How do I remove rpm package recursively?
By using yum remove ---
yum remove {package-name}
Saturday, October 06, 2012
PHP Time Calculate using "strtotime"
Ref. http://stackoverflow.com/questions/277247/increase-days-to-php-current-date
<?php
$day=3;
echo date("Y-m-d",strtotime("+$day days"));
?>
It would display the date in 3 days.
<?php
$day=3;
echo date("Y-m-d",strtotime("+$day days"));
?>
It would display the date in 3 days.
Monday, October 01, 2012
Shell Script Output with Color - Bash
Ref. http://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/
#!/bin/bash
# tputcolors
echo
echo -e "$(tput bold) reg bld und tput-command-colors$(tput sgr0)"
for i in $(seq 1 7); do
echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)"
done
echo ' Bold $(tput bold)'
echo ' Underline $(tput sgr 0 1)'
echo ' Reset $(tput sgr0)'
echo
#!/bin/bash
# scriptname - description of script
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 1) # red
bldblu=${txtbld}$(tput setaf 4) # blue
bldwht=${txtbld}$(tput setaf 7) # white
txtrst=$(tput sgr0) # Reset
info=${bldwht}*${txtrst} # Feedback
pass=${bldblu}*${txtrst}
warn=${bldred}*${txtrst}
ques=${bldblu}?${txtrst}
Subscribe to:
Comments (Atom)



