Archive for the 'Linux' Category

Page 2 of 14

ubuntu下MySQL服务器更改目录后问题

1
2
3
4
5
6
100811 18:42:06  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

修改下面文件中得权限列表可解决问题。

1
/etc/apparmor.d/usr.sbin.mysqld
1
2
/web/data/mysql/ r,
/web/data/mysql/** rwk,
Share

在Linux中把前台程序放到后台运行

  • 方法一:先通过 ctrl-z 把程序放到后台,再通过 bg %<jobid> 提交命令到后台,最后使用 disown -h %<jobid>。现在就可以退出终端,程序依然还在运行。
  • 方法二:使用screen和retty
    $ screen -S my_process
    $ retty $(pgrep my_process)
    /redraw
Share

怎样在linux下修改ID3信息

mid3iconv
由于Ubuntu中的Amarok等播放器只支持UTF8字符,所以在Amarok中常常出现乱码。解决方案如下:

1
sudo apt-get install python-mutagen

修改mp3中编码:
到你的music目录去

1
find . -iname "*.mp" -execdir mid3iconv -e GBK {} \;
Share

6个Linux性能监控命令行工具

  1. htop http://htop.sourceforge.net/
    一个可以让用户与之交互的进程查看器。作为文本模式的应用程序,主要用于控制台或 X 终端中。当前具有按树状方式来查看进程,支持颜色主题,可以定制等特性。
  2. Continue reading ’6个Linux性能监控命令行工具’

Share

Linux For Thinkpad 下投影仪使用

安装完Linux一般都会发现快捷键不好用了。

1、简单方法
切入到文本控制台CTRL+ALT+F1
执行 echo crt_enable > /proc/acpi/ibm/video
切回图形界面就可以使用投影仪了。
注:执行前确认  /proc/acpi/ibm/video 存在
如果不存在请往下看。

2、复杂且有效方法

linux-wiki

http://www.thinkwiki.org/wiki/Problem_with_video_output_switching

Share

cpulimit – 限制进程的 CPU 占用率

cpulimit

cpulimit 是一个简单而有用的小程序,通过它你可以限制一个进程的 CPU 占用率。如果善加利用,必将成为系统管理员的得力助手。

cpulimit 的用法也很简单,如上图所示,通过 -e 选项指定需控制的进程名(或 -p 选项指定 pid),-l 选项指定 CPU 的占用百分比即可。这里,我将 Chrome 的 CPU 占用率限制到 25%。

cpulimit 可从其项目主页下载,或通过你所用的 Linux 发行版包管理器安装。

Share

Bash Shell Keyboard shortcuts

The following shortcuts work when using default (Emacs) key bindings. Vi-bindings can be enabled by running set -o vi.

Tab ⇆ : Autocompletes from the cursor position.
Ctrl+a : moves the cursor at the beginning of the line (equivalent to the key Home).
Ctrl+e : (end) moves the cursor at the line end (equivalent to the key End).
Ctrl+p : (previous) recalls the previous command (equivalent to the key ).
Ctrl+n : (next) recalls the next command (equivalent to the key ).
Ctrl+r : (research) recalls the last command including the specified character(s). A second Ctrl+r recalls the next anterior command which corresponds to the research
Ctrl+s : Go back to the next more recent command of the research (beware to not execute it from a terminal because this command also launches its XOFF). If you changed that XOFF setting, use Ctrl+q to return.
Ctrl+o : executes the found command from research.
Ctrl+l : clears the screen content (equivalent to the command clear).
Ctrl+u : clears the line content before the cursor and copy it in the clipboard.
Ctrl+k : clears the line content after the cursor and copy it in the clipboard.
Ctrl+w : clears the word before the cursor and copy it in the clipboard.
Ctrl+y : (yank) adds the clipboard content from the cursor position.
Ctrl+d : sends an EOF marker, which (unless disabled by an option) closes the current shell (equivalent to the command exit).
Ctrl+c : sends the signal SIGINT to the current task, which aborts and closes it.
Ctrl+z : sends the signal SIGTSTP to the current task, which suspends it. To return to it later one can enter fg ‘process name’ (foreground).
Ctrl+x Ctrl+x : (because x has a crossing shape) alternates the cursor with its old position.
Ctrl+x Ctrl+e : (editor because it takes the $EDITOR shell variable) edits the current line in vi.
Alt+f : (forward) moves forward the cursor of one word.
Alt+b : (backward) moves backward the cursor of one word.
Alt+Del : cuts the word before the cursor.
Alt+d : cuts the word after the cursor.
Alt+u : capitalizes every character from the cursor’s position to the end of the current word.
Alt+l : lowers the case of every character from the cursor’s position to the end of the current word.
Alt+c : capitalizes the character under the cursor and moves to the end of the word.
Alt+r : cancels the changes and put back the line as it was in the history.

Share

How to keep alive with ssh server

1
ssh -o TCPKeepAlive fred@oracle1.com

or add follw to your $HOME/.ssh/config file

1
ServerAliveInterval 60
Share

Download file use bash script and wget

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
DOWN_DIR=/home/fred/example.com/upload/
while read line
#c=1
do
#c=`expr $c + 1`
#echo -e "$line \n"
file1=`echo -e $line| awk -F" " '{ print $1 }'`
file2=`echo -e $line| awk -F" " '{ print $2 }'`
dir1=$DOWN_DIR`echo $file2| awk -F"/" '{ print $1"/"$2 }'`
mkdir -p $dir1
wget $file1 -O $DOWN_DIR${file2}.jpg
#if [ $c -lt 3 ];then
#exit
#fi
done &lt; "/home/fred/src/db.txt"



Share

Linux下查看内存条数命令

1
$ dmidecode |grep -A16  "Memory Device$"
Share