Archive for category Tips Everyday

How to reset the root password on Linux

Today, i had a big hassle earlier on by accidentally changed my linux password policy and set the expiration for all the password a date before the current time :) That proves again Monday Morning is always not the most effective day during the week. LOL

But i managed to reset the password following this video, very good one.

Put it here in case you guys make the stupid mistake as i did today :)

No Comments

How to mount remote windows drive to linux

To remotely mount your windows driver to linux:

eg. mount d drive,

mount -t cifs -o username=${user},password=${password} //${IP}/d$ /mnt/windowsdriver

t: file system tile (cifs or nfs, ntfs)

o:options

,

No Comments

jar command

//create Jar file

jar -cmf

c:create

f:file

m:manifast

eg. jar -cmf -C ./workspace/jar-test/classes myJarTest.jar *.class

//Extract Jar file

jar -xf

x:extract

f:file

eg. jar -xf myJarTest.jar

// update jar file

jar -uf

u: update

eg. jar uf foo.jar foo.class

//list jar file content as a table

jar -tf

t:table

eg. jar -tf myJarTest.jar

, ,

No Comments

如何结束占用端口的线程

比如80端口被占用 (qq音乐开机占用我的80或者是8080端口)。如果你不清楚哪个程序在占用你的端口的话。

windows:

netstat -aon  //找出哪个线程在占用你的80端口,eg.35454线程在占用80端口。

taskkill /pid 35454 //结束占用80端口的程序,现在80端口就可用了。

linux:

lsof -P | grep 80

kill 35454

, , ,

No Comments

sql基于时间查询(select)

返回所有posts表中,2009年5月13号到16号的记录。created是posts表的timestamp。

select * from posts where date(created) bettwen date(2009-05-13) and date(2009-05-16)

除了date(),还有year(),month(),day()可以使用。year(2009-05-13) 返回2009,month(2009-05-13)返回05,day(2009-05-13)返回13

Happy Coding…

2 Comments