Using partprobe to avoid reboot after re-partitioning
Submitted by zhigang on Thu, 2009-06-18 11:29In my memory, the Linux kernel only reads partition table information at system initialization. So it needs reboot to get the new partition table info after re-partitioning. Until I see partprobe recently, I change my mind.
- Add new comment
- Read more
- 9 reads
Locally Administered Address (LAA) and Universally Administered Address (UAA)
Submitted by zhigang on Fri, 2008-12-12 11:41Locally Administered Address (LAA) is a type of MAC address when the burned-in address (BIA) within the MAC address is overridden by the user. In these cases the second bit of the most significant byte of the Organisationally Unique Identifier (OUI) is changed to a binary 1.
- Add new comment
- Read more
- 568 reads
Install grub into disk/filesystem image
Submitted by zhigang on Mon, 2008-11-24 17:28PyGrub can operate on filesystem image as well as disk image. To install grub into a disk image use this script grub_install_disk_image.sh
- Add new comment
- Read more
- 206 reads
How to Prevent DHCP Client from Receiving IP from a Specific Server?
Submitted by zhigang on Thu, 2008-07-03 17:00Sometimes, people may encounter multiple misconfigured DHCP servers in a LAN. Then you may keep receiving wrong IP/Gateway/DNS information that prevent you from connecting to the Internet.
Here's how to prevent your host from receiving DHCP information from the misconfigured server.
- Add new comment
- Read more
- 210 reads
Oracle Enterprise Linux Security
Submitted by zhigang on Tue, 2008-03-18 16:36My friend Ozgur Yuksel answers about Oracle Enterprise Linux security:
- SELinux - http://www.nsa.gov/selinux/
- Netfilter IPtables - http://www.netfilter.org/
- Linux kernel auditing - http://people.redhat.com/sgrubb/audit/
- VPN/IPSec - http://ipsec-tools.sourceforge.net/
- TCP wrappers - ftp://ftp.porcupine.org/pub/security/index.html
- AIDE - http://www.cs.tut.fi/~rammer/aide.html
- RPM GPG signature as an IDS - http://rpm.org/
- GPG - http://gnupg.org/
- SSL - http://www.openssl.org/
- SSH - http://www.openssh.com/
- stunnel - http://www.stunnel.org/
- mod_ssl - http://www.modssl.org/
- nmap - http://nmap.org/
- tcpdump/libpcap - http://www.tcpdump.org/
- wireshark - http://www.wireshark.org/
- nss - http://www.mozilla.org/projects/security/pki/nss/
- Frequent/proactive kernel security updates from Unbreakable Linux Network - http://linux.oracle.com/
- Oracle Validated Configurations - http://www.oracle.com/technology/tech/linux/validated-configurations/ind...
- Open source - against HP-UX, AIX, Windows etc. - http://www.gnu.org/copyleft/gpl.html
- Add new comment
- Read more
- 226 reads
Linux Free Memory Calculation
Submitted by zhigang on Tue, 2008-03-18 15:14Free memory can be seen from the "free" command output:
$ free
total used free shared buffers cached
Mem: 2066184 1420776 644600 0 49140 647396
-/+ buffers/cache: 724240 1341136
Swap: 2097144 112 2048136
Real free memory ~= free + buffers + cached
- Add new comment
- Read more
- 254 reads
Find Tips &Tricks
Submitted by zhigang on Tue, 2008-03-18 14:24Common usage
$ find . -type d -exec chmod 755 {} \;
$ find . -type f -exec chmod 644 {} \;
Using Regular Expressions (regex)
If the "-name" option cannot satisfy your need, remember to use the "-regex" option, which offers more powerful parttern matching.
- Add new comment
- Read more
- 162 reads
Using "\n" as delimiter of cut
Submitted by zhigang on Mon, 2008-03-17 17:35You cannot specify "\n" directly with Bash:
$ brctl show | cut -d "\n" -f 2 | cut -f 1 cut: the delimiter must be a single character Try `cut --help' for more information.
The correct syntax is:
$ brctl show | cut -d " > " -f 2 | cut -f 1 testbr
But "\n" can be used directly in system call of other programming language rather than Bash. Eg.
# python
Python 2.4.3 (#1, Jun 6 2007, 15:09:38)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> status = os.system('brctl show | cut -d "\n" -f 2 | cut -f 1')
testbr
>>> import commands
>>> print commands.getoutput('brctl show | cut -d "\n" -f 2 | cut -f 1')
testbr
- Add new comment
- 179 reads
Using Cscope in Vim
Submitted by zhigang on Mon, 2008-03-17 11:06Generate a cscope database
$ cscope -b -R
For Linux kernel and some other packages which have built-in cscope target in Makefile:
$ make cscope
Configure Vim to locate a cscope database:
:cs add cscope.out
My cscope settings in ~/.vimrc:
- Add new comment
- Read more
- 221 reads
Using Ctags in Vim
Submitted by zhigang on Mon, 2008-03-17 10:51Generate a tags file using ctags
$ ctags *.c $ ctags -R . $ ctags -L flist
For Linux kernel and some other packages which have built-in tags target in Makefile:
$ make tags
Configure Vim to locate a tags file
set tags=/my/dir/tags set tags=/my/dir1/tags, /my/dir2/tags set tags=tags;/
My ctags settings in ~/.vimrc:
"ctags settings set tags=tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags
Jump to a tag
:tag <tagname>
- position the cursor over a tag name and then press:
Ctrl-]
$ vim -t <tagname>
Come back from a tag jump
:pop
Ctrl-t
Reference
- Add new comment
- 185 reads


Recent comments
2 weeks 3 days ago
3 weeks 1 day ago
3 weeks 5 days ago
5 weeks 4 days ago
18 weeks 4 days ago
18 weeks 4 days ago
29 weeks 4 days ago
41 weeks 10 hours ago
1 year 13 weeks ago
1 year 20 weeks ago