7 More Red Hat
®
Linux
™
Tips and Tricks
1-800-COURSES
www.globalknowledge.com
Expert Reference Series of White Papers
Written and Provided by
Introduction
Are you looking for a quick and simple reference guide to help you navigate Red Hat® Linux
T
M
systems?
Look no further. Global Knowledge and Red Hat have assembled a second set of Tips and Tricks written by Red
Hat Certified Engineers
®
(RHCEs) to give you an edge on managing these systems:
1.
If a file has a link count greater than 1, is there a simpler w
ay to find out what other file names are
hard-linked to it?
2. Which interface is eth0?
3. Quick-and-dirty automounts
4. How can I make dd give me a progress report?
5.
Tar vs. Star—The battle of xattrs
6. New default mount options in Red Hat
®
Enterprise Linux
Tricks
Copyright ©2007 Global Knowledge T
raining LLC. All rights reserved.
Page 2
2.Which interface is eth0?
by Paul Morgan, Red Hat Certified Engineer
®
If you’re not sure which physical interface is eth0 and which is eth1 (or eth2), run:
ethtool -p eth0 5
This blinks the LED on the interface for five seconds—without interrupting network traffic.
3. Quick-and-dirty automounts
by Joshua Hoffman, Red Hat Certified Engineer
®
1. Enable the /net map in /etc/auto.master.
2. Create a new directory to hold your network mounts:
mkdir /network
3. Create links for the mounts you want:
cd /network
ln -s /net/server1/var/ftp/pub/Server Server
4. Now you can just use the links:
cd /network/Server
5. Best of all, this always works:
ls /network
6.
This trick even works for NIS user homedirs:
cd /home
ln -s /net/server1/home/guests guests
4. How can I make dd give me a progress report?
by Andrew C. Dingman, Red Hat Certified Engineer
®
USR1 signal to all processes you own named dd.
$ pkill -USR1 ^dd$
kill and killall support the -USR1 option in the same manner.
If you want a periodic status report, you can extend the same idea with watch in another terminal. Since
we’re just sending a signal,
there won’t be any output in the display from watch, but it’s a nice shortcut for
periodic execution.
$ watch -n5 -- pkill -USR1 ^dd$
Will send signal USR1 to any dd process you own every five seconds, triggering dd to tell you where it is in
the transfer and how fast it’s going. Remember, look at
dd’s terminal for the output!
$ dd if=/dev/zero of=/tmp/demo bs=1M count=1536
137+0 records in
137+0 records out
143654912 bytes (144 MB) copied, 5.66717 seconds, 25.3 MB/s
249+0 records in
249+0 records out
261095424 bytes (261 MB) copied, 11.5736 seconds, 22.6 MB/s
388+0 records in
387+0 records out
5.Tar vs. Star – The battle of xattrs
by Forrest Taylor, Red Hat Certified Engineer
®
In Red Hat
®
Enterprise Linux
®
4, tar could not handle the extra information stored in ext2 and ext3 file sys
-
tems called Extended
--no-selinux Do not use the SELinux attributes
--no-acls Do not use the ACL attributes
--no-xattrs Do not use any xattrs, including SELinux and ACL.
By default, tar does not archive the
xattrs, thus the previous three options are normally used at the time
of restore.
Additionally, newly created file systems in Red Hat Enterprise Linux 5 now contain the
acl and
user_xattr default mount options, so these tar options are necessary for good backups.
6. New default mount options in Red Hat Enterprise
Linux 5
by Forrest Taylor, Red Hat Certified Engineer
®
Newly created file systems in Red Hat
®
Enterprise Linux
®
5 now have new default mount options. For instance,
if I created /boot at install time on /dev/sda1, I can view these new mount options using tune2fs:
# tune2fs -l /dev/sda1
tune2fs 1.39 (29-May-2006)
Filesystem volume name: /boot
Last mounted on: <not available>
Filesystem UUID: ea84e45d-ba84-4346-bf7c-1988c123a4a5
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode
dir_index
filetype needs_recovery sparse_super large_file
Default mount options: user_xattr acl