Skip navigation.
Home
Drive Open Source Software Movement.

Using partprobe to avoid reboot after re-partitioning

In 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.

Locally Administered Address (LAA) and Universally Administered Address (UAA)

Locally 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.

Install grub into disk/filesystem image

PyGrub 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

How to Prevent DHCP Client from Receiving IP from a Specific Server?

Sometimes, 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.

Oracle Enterprise Linux Security

My 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

Linux Free Memory Calculation

Free 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

Find Tips &Tricks

Common 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.

Using "\n" as delimiter of cut

You 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

Using Cscope in Vim

Generate 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:

Using Ctags in Vim

Generate 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

  1. Tip #94: Questions & Answers about using tags with Vim.
  2. Ctags Home Page.
    Syndicate content