Linux Tips
Modify the kernel to make Linux run faster:
# cd /usr/src/linux-2.4 # make mrproper # make menuconfig
This step will display a dialog,and I exclude some items which will never be used, for example, Fiber channel,isdr,and pcmcia,(Type “N”),and then save the new configuration,issue the following command:
# make dep (it will take about 5 minutes) # make clean (5 seconds) # make bzImage (10 minutes) # make modules (it's long and will take about 30 minutes) # make modules_install
Note: it is “modules_install” which have no backspace between “modules” and “_install”. and if issue the “make modules -install”, the process will failed with error. The final step is issueing the “reboot”. I’ve tried all the above steps, and my Linux runs faster after rebooting.
nroff: emulate nroff command with groff.
# nroff -man man/libnet.3 | less
Issue the commands as other user account:
# su - username -c "ls"
For example, let root issues “ls” :
# su - root -c "ls"
Uncompress the “.bz” file:
# tar -jvxf xxx.bz
If the file “/etc/inittab” was modified, issue the following command to make the configuration activity.
# init q
Q or q, tell init to re-examine the /etc/inittab fill.
S or s, tell init to switch to single user mode.
Issue some continuous commands, and it will break as soon as error happens.
# command1 && command2 && command3
Uncompress the file included in rpm:
# cat xxx.rpm | rpm2cpio | pax -r
How to mount harddisk and directory owned by local Windows system or Remote windows system?
# mount -t smbfs -o username=x, password=x, //share_path /mnt/c
Ethereal — capture packets.
Create and use .iso file:
# mkisofs -J -r -o xxx.iso /test # mount -o loop xxx.iso /mnt/cdrom
Uncompress xxx.bz file:
# tar -I xxx.bz or # bunzip2 xxx.bz
Check the file’s rpm name:
# rpm -qf /usr/bin/ls
List description information:
# rpm - qpi
List file information:
# rpm - qpl
Configure the Memory limitation in Grub:
grub> kernel /boot/vmlinuz-2.4.19 20 boot=/dev/hda2 mem=120MB
Type Chinese output:
# ls --show-control-chars
Make a Linux boot disk:
# mkbootdisk --device /dev/fd0 2.4.20
Where 2.4.20 is directory in /lib/modules
Modify the ethernet device’s MAC address:
# ifconfig eth0 down # ifconfig eth0 hw ether 00:AA:BB:CC:DD # ifconfig eth0 up
A very important command which is used to check ethernet card’s statue:
# mii-tool -v
mii-tool -view, manipulate media-independent interface status.This utility checks or sets the status of a network interface Media Independent Interface(MII) .
-w watch monitor for link status changes
# du ./ --max-depth=1 # du -sm /directory
List the existed users account in the Linux:
# cat -fl -d: /etc/passwd
Find the MAC address of local ethernet card:
# arp # /sbin/arp