`
weiqiang.yang
  • 浏览: 154704 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论
阅读更多
这里汇总一下平时用到的一些命令,方便需要的时候查询,不定期编辑
1. 计算一个字符串的md5
echo -n 'the_password' | md5sum -

   
引用
"-n" is supplied to force echo not to add a newline character automatically behind the string

    md5sum也可以换成sha*sum,比如sha256sum等

2. There are stopped jobs.
    这个消息是在推出控制台的时候碰到的,搜了下,然后才想起每次编辑某个文件又想看下log的时候,并不总是需要把vim退出:在运行某个程序的时候,按Ctrl-z可以把程序“挂起”(suspend),然后干点别的事情,然后再把程序调出来继续运行,在终端输入
   
jobs

    可以看到被挂起的程序列表,
vivi@H0334:~$ jobs
[1]-  Stopped                 vim
[2]+  Stopped                 vim c.html

    然后可以输入
fg $jobid

继续运行程序,$jobid就是输入jobs出现的列表的前面那个数字
引用
Unix allows you to suspend a program you are running and then go back to it later on. This is called "job control". When you are using a program interactively, it is said to be in the "foreground"; once it is stopped (with [CTRL-Z]) it is in the "background". At this point you can put the job back into the foreground by typing "fg", or tell it to continue to run in the background with "bg". The shell gives a number to each job that is running in the background or that has been stopped. To see the list of current jobs, type "jobs". Each job will be listed, preceded by its number. The job most recently stopped is referred to as the current job and will have a + sign in front of it. You can kill a job by typing:
  
 kill %n 

where n is the number of the job. A job left running in the background will stop when it needs input from the terminal.


使用wget创建一个站点的镜像

wget -mk http://www.example.com/

分享到:
评论
5 楼 weiqiang.yang 2012-01-17  
ubuntu安装受限的资源
sudo apt-get install ubuntu-restricted-extras
Microsoft true type
.rar support
Gstreamer plugin
adobe plugin
4 楼 weiqiang.yang 2012-01-05  
# 在文件管理器上直接右键打开terminal
sudo aptitude install nautilus-open-terminal

#!/bin/bash
# 快速共享文件的命令,执行之后只要把输出的地址贴一下就行
for line in `ifconfig | grep -o -E "inet addr:[0-9.]+" | grep -o -E "[0-9.]+"`; do
    echo "http://$line:8000"
done

echo "starting python simpleHttpServer..."
python -m SimpleHTTPServer
3 楼 weiqiang.yang 2011-09-21  
文件编码查看及其转换
1. 查看文件的编码

enca -L zh_CN filename

或者

file filename

也可以识别部分文件编码,貌似没有enca那么精确

2. 转换文件的编码
iconv -f gbk -t utf8 input_gbk -o output_utf8



3. 文件名的编码转换
convmv -f gbk -t utf8


确认之后再加上 --notest 参数执行一遍

4. 批量
#!/bin/bash
for f in `find . | grep -E "\.txt$"`; do
  echo "converting $f from gbk to utf8 ..."
  iconv -f gbk -t utf8 $f -o $f.tmp
  [ -f $f.tmp ] && mv $f.tmp $f
done
echo "done."

2 楼 weiqiang.yang 2011-09-10  
装系统的时候应该考虑好分区的问题,900多g的分区,用gparted调整了好久才调整成250g

查看分区的uuid命令
vivi@vivi:/dev$ sudo blkid
/dev/sda1: UUID="480e44ee-ee2c-41be-a7a5-86ecf87696b0" TYPE="ext4" 
/dev/sda5: UUID="6e628509-f7c2-41e0-a8da-b44a2f368ee0" TYPE="swap" 
/dev/sda6: UUID="9a9b8637-1283-4424-8ad0-b96ce11df2c9" TYPE="ext4" 
/dev/sda7: LABEL="backup" UUID="425963e9-6a50-4319-afb8-59d3a838e7ab" TYPE="ext4" 
/dev/sdb1: SEC_TYPE="msdos" LABEL="VVB" UUID="6804-E9D9" TYPE="vfat" 
1 楼 weiqiang.yang 2011-01-26  
同一个服务器上起两个tomcat web应用,端口不同,因为是在同一个域,所以访问两个应用的时候都会写同一个cookie,于是就会出现在一个应用登录拿一个sessionid,这时候去登录另外一个应用会把这个sessionid覆盖掉,于是这时候回到第一个应用,就会出现没有登录的情况

解决的办法是在tomcat启动的时候指定sessionid的key
#!/bin/sh
// .....
# ------------------------------------------
# Start/Stop Script for the CATALINA Server
// .....
# ------------------------------------------
JAVA_OPTS="$JAVA_OPTS 
             -Dorg.apache.catalina.SESSION_COOKIE_NAME=MYJSESSIONID 
             -Dorg.apache.catalina.SESSION_PARAMETER_NAME=myjsessionid"

相关推荐

Global site tag (gtag.js) - Google Analytics