Linux Tips

Posted by M. 4Gani under Linuxi:

Convert latin1 to UTF-8 in MySQL
$ mysqldump -h localhost –user=myName -p –default-character-set=latin1 -c \
–insert-ignore –skip-set-charset dbname > dump.sql
$ iconv -f ISO-8859-1 -t UTF-8 dump.sql > dump_utf8.sql

Find out which charset is my file
$ iconv -f 8859-1 -t utf-8 FILE1> FILE2
$ iconv -f utf-8 -t 8859-1 FILE2 > FILE3
$ diff FILE1 FILE3

apt-get –purge remove NameOfPackage
apt-get install –reinstall NameOfPackage
apt-get –purge –reinstall install apache2.2-common apache2
apt-get install –reinstall libapache2-mod-php5 php5-cli php5-common php5-cgi

dpkg-reconfigure xserver-xorg
update-alternative -config x-session-manager

Cancel and kill a print job
lpstat -t
lpadmin -p lj -E

wget -c –user=user –password=passwd http://hostname…

Linux command line tips
find -name ‘*.[ch]’ | xargs grep -E ‘expr’
find -type f -print0 | xargs -r0 grep -F ‘example’

find . -exec grep “use GD” ‘{}’ /dev/null \; -print
find . -name “*.pl” -type f -exec grep “use GD” ‘{}’ /dev/null \; -print
Only get diffs. Do multiple times for troublesome downloads:
rsync -P rsync://rsync.server.com/path/to/file file

Configuration ssh host key verification
Edit & change your local ~/.ssh/config file and if the host key verification failed then:
ssh -p 2601 -u hostname or  ssh -p 2601@hostname
create file ~/.ssh/sfssh (ssh config file located in your user directory and add the following lines to the sfssh file:
exec ssh -1 -l -p 2601 -P “$@”

edit .bashrc in your home directory and add the following line:
export CVS_RSH=$HOME/.ssh/sfssh; export CVS_RSH

Search and replace the new hostname in all local files:
find . -type f | xargs perl -pi -e ‘s/sourceforge.old/sourceforge.new/g’



See more website here...

  • Odlinks
  • Farsi-News
  • Advertise Here