-
One line to remove all unneeded old kernel for Ubuntu
Posted on December 5th, 2011 Add commentsAlong with the kernel keeps updating, many old kernels are kept in the system. For normal users, those old kernels are no longer needed, so the best way just remove them.
To remove all kernels, just run the single line with below:1dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge*Original post from here
164 views
-
Ubuntu Desktop Screen Upside down??
Posted on September 3rd, 2010 2 commentsI used to have an Nvidia video card on Ubuntu and use Nvidia Xserver drive for it, but couple days ago I decided to remove that card and use the onboard video card which is INTEL GMA 950.
After take the Nvidia out, I have to generate the new xorg.conf file for the X Windows and new video device. So, just use Ctrl + Alt + F1 switch to text mode, and run:1234sudo service gdm stopsudo Xorg -configuremv xorg.conf.new /etc/X11/xorg.confsudo rebootAfter reboot, the desktop screen become to upside down. Even can’t type anything in terminal. To fix it, just switch to text mode again, rename “/etc/X11/xorg.conf” to “/etc/X11/xorg.conf.new”, then reboot. The screen is back to normal but no video driver, then use synaptic to find any package beginning with “nvidia”, and remove them all. Last thing is change “/etc/X11/xorg.conf.new” back to “/etc/X11/xorg.conf” and reboot, then all set.
827 views
-
Create tablespace on NFS based LINUX + Oracle
Posted on February 8th, 2010 Add commentsWhen the first time to create tablespace on SQLplus, it shows:
“ORA-27040: file create error, unable to create file. Linux-x86_64 Error: 13: Permission denied”
So I just change my home directory to “777”, then getting the error
“ORA-27054: NFS file system where the file is created or resides is not mounted with correct options”
After check the “autofs” settings, I found the content of file “auto.home” has problem which is something wrong with NFS mount options. The solutions is change the original content
* -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp oracle.server.com:/users/&
to
* -rw,bg,hard,intr,rsize=32768,wsize=32768,suid,nfsver=3,tcp oracle.server.com:/users/&
918 views
-
SSH + X11 display after su to another user
Posted on January 26th, 2010 Add commentsSometimes we need to run the X11 application window via SSH. For example, I am user “A”, and SSH to host “example”. To be possible running X11 application window, we need to type the command:
#ssh -Y A@example
In addition to the SSH restriction, we need to run an X application as someone other than yourself. For example, the Virtualbox can be only run by user “B”. If the user “A” can sudo to become user “B” or “A” is the root, in order to allow user “B” access to user “A”’s display, B needs to import “A”’s
.Xauthority
cookie. We can usexauth
to accomplish this and it’s a quick one-liner beforesudo su - B
:A@example:~#xauth extract – :`echo $DISPLAY |awk -F: ‘{print $2}’` | sudo su – B -c “/usr/bin/xauth merge -”
A@example:~#sudo su – B
B@example:~#VirtualBox &
441 views
-
VI中替换命令的具体用法
Posted on January 12th, 2010 Add commentsVI中替换命令可以简单的写成以下命令:
:[range]s /[st1]/[st2]/g
其中:
- [range]表示替换命令的查找范围:
- 1. “%” 表示所有行
- 2. “.” 表示当前行
- 3. “$” 表示最末行
例如,:%s/[st1]/[st2] 表示查找文件中所有[st1]的字符串,并替换成[st2]
:-5,+5s/[st1]/[st2] 表示查找目前行的前五行和后五行中[st1]的字符串,并替换成[st2] - “s”表示替换命令
- [st1]表示要查找的字符串
- [st2]表示希望把匹配的字符串变成的字符串
- “g”表示可选项,放在命令末尾,表示对搜索字符串的每次出现进行替换;不加 g,表示只对搜索字符串的首次出现进行替换;g 放在命令开头,表示对正文中所有包含搜索字符串的行进行替换操作。
482 views - [range]表示替换命令的查找范围:
Recent Comments