By Jun Salen
This is a compilation of tips and tricks I got from reading the mailing list from CentOS and PLUG which I will update from time to time.
How to Get Users List in a Linux Machine
As local user
- cat /etc/passwd
- Seperated by username, password, UID, GID, home directory, shell
- cat /etc/group
- Use this to see group information.
getent passwd
- This handles everything nsswitch.conf does (NIS, LDAP, xyzzy, whatever).
getent passwd | cut -d: -f1 | sort -u
- To get just a list of usernames
To check what is the IP address of the DHCP server where assigned IP leased from:
For CentOS 5, the command:
- grep dhcp-server-identifier /var/lib/dhclient/dhclient-eth0.leases
or for CentOS 4, the command:
- grep dhcp-server-identifier /var/lib/dhcp/dhclient-eth0.leases
To list all PCI device:
/sbin/lspci
To determine the change log of installed software:
rpm -qi –changelog <packagename>
yum install yum-changelog
Then …
man yum-changelog
or
repoquery –changelog foo
Robert Moskowitz Tips on Private Network IP Addresses:
If you use addresses from the 192.168 range, avoid the nets:
192.168.0.0, 192.168.1.0, 192.168.2.0, and 192.168.100.0 These are commonly used by various ‘appliances’. Choose something ‘wierd’ like 192.168.49.0 (or some other prime number less than 255). Though I tend to use 192.168.64.0, 192.168.96.0, or 192.168.128.0
Also avoid the 172.16 and 10. ranges. These are commonly used in Company internal private networks, and if you want to ‘VPN’ to them, it an cause unwanted results (like it won’t work).
This is general advice to anyone using private addresses for small usages.
To Get Memory Usage and Information:
free – for summary information
cat /proc/meminfo – for detailed information
To get hardware info in Linux:
/usr/sbin/dmidecode
To test for disk I/O performance:
Download ‘disktest’ utility from Linux Test Project(LTP) and do the ff:
Sequential reads:
disktest -B 4k -h 1 -I BD -K 4 -p l -P T -T 300 -r /dev/sdX
Sequential writes:
disktest -B 4k -h 1 -I BD -K 4 -p l -P T -T 300 -w /dev/sdX
Random writes:
disktest -B 4k -h 1 -I BD -K 4 -p r -P T -T 300 -r /dev/sdX
Random writes:
disktest -B 4k -h 1 -I BD -K 4 -p r -P T -T 300 -w /dev/sdX
Description of the options used:
-B 4k = 4k block ios
-h 1 = 1 second heartbeat
-I BD = block device, direct io
-K 4 = 4 threads, or 4 outstanding/overlapping ios, typical pattern
(use -K 1 for the raw performance of single drive, aka dd type output)
-p <l|r> = io type, l=linear, r=random
-P T = output metrics type “Throughput”
-T 300 = duration of test 300 seconds
-r = read
-w = write
These tests will run across the whole disk/partition and the write
tests WILL BE DESTRUCTIVE so be warned!
To determine PCI information and replacing LAN card info:
/sbin/lspci
In /etc/modprobe.conf
Put or replace alias entries for LAN card and restart network.
To get driver info of 3Ware Card:
/sbin/modinfo 3w-9xxx
How to know what version of CentOS
Option 1:
cat /etc/redhat-release
Option 2:
rpm -q centos-release
How-to Linux Upgrade
Step 1: # screen
Step 2: # yum upgrade yum\* rpm
Step 3: # yum clean all
Step 4: # yum upgrade
Step 5: # exit
Step 6: # reboot
How to compile Postfix file to BDB
/opt/zimbra/postfix/sbin/postmap protected_recipients
How-To Configure Yum Using Proxy
Add the following entry in /etc/yum.conf:
proxy=http://xxx.xxx.xxx.xxx:yyyy/
Where:
xxx.xxx.xxx.xxx = IP Address
yyyy = Port Number
To connect to the Internet through proxy:
Edit /etc/profile
export http_proxy=”http://proxy.server.name: port/
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.