FAQforge provides answers for frequently asked questions for the Linux-, MAC and Windows operating systems.

Windows XP makes backup copies of your system files which may use a lot of space on your harddisk. To empty the system file cache, click on Start > run…  Now enter the command “sfc /purgecache” and click on “Ok”.

sfc_purgecache

To get detailed information on the CPU, use this command:

cat /proc/cpuinfo

The output will look similar to this:

cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 107
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
stepping        : 2
cpu MHz         : 2900.171
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc [6]
bogomips        : 5945.45

Get detailted information on memory usage:

cat /proc/meminfo

MemTotal:      4116112 kB
MemFree:        470164 kB
Buffers:        154592 kB
Cached:        1658332 kB
SwapCached:        488 kB
Active:        2304500 kB
Inactive:      1017644 kB
HighTotal:     3243840 kB
HighFree:       183672 kB
LowTotal:       872272 kB
LowFree:        286492 kB
SwapTotal:     4200888 kB
SwapFree:      4197128 kB
Dirty:            4764 kB
Writeback:           0 kB
AnonPages:     1378960 kB
Mapped:         135580 kB
Slab:           289720 kB
PageTables:      16680 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   6258944 kB
Committed_AS: 3779921956 kB
VmallocTotal:   118776 kB
VmallocUsed:     11892 kB
VmallocChunk:   106628 kB

Information about disk usage

df -h

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md2              375G   41G  315G  12% /
tmpfs                 2.0G     0  2.0G   0% /lib/init/rw
udev                   10M   52K   10M   1% /dev
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/md1              510M   37M  448M   8% /boot

And the partitions:

fdisk -l

Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000d6430

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       10255    82373256   83  Linux
/dev/sda2           10256       10443     1510110    5  Extended
/dev/sda5           10256       10443     1510078+  82  Linux swap / Solaris

Linux: How to view log files on the shell?

Saturday, August 8, 2009 - posted by Till

Many linux servers are administered on the commandline e.g. with a SSH connection. In the following article, I will explain several shell commands that make it easy to view logfiles.

The most important command is “tail”. Tail can be used to read the last lines from a file. Examples:

Get the last 100 lines from the Debian mail log file:

tail -n 100 /var/log/mail.log

To get all newly added lines from a log file in realtime on the shell, use the command:

tail -f /var/log/mail.log

to quit tail and go back to the commanline press the keys [ctrl] + [c]

If you want to get the last 1000 lines from a log file and they do not fit into your shell window, you can use the command “more” to be able to view them line by line.

tail -n 1000 /var/log/mail.log | more

press [space] to go to the next line or [ctrl] + [c] to quit.

If you want to search for a specific term in a large file, the command “grep” comes in handy. Example: We search for the email address “tom@anydomain.tld” in the mail log file:

grep “tom@anydomain.tld” /var/log/mail.log

If you want to view the whole content of file on the shell, use the command “cat”. Example:

cat /proc/cpuinfo

will show you detailed info about the CPU of your computer.

How to reinstall Windows XP without having to activate it again

Thursday, August 6, 2009 - posted by Till

If you have to reinstall Windows XP on the same computer e.g. because your old installation went instable or you tested some software, you normally have to activate your copy of Windows XP again. This will work 2 or 3 times with the online acticvation but then Microsoft will force you to call them by phone to get a very long activation number. To avoid the  activation procedure for the new installation, make a copy of the file:

C:\Windows\system32\wpa.dbl

on your current activated installation to a USB disk or external harddrive and copy it back to the new installation.

Where can I request ISPConfig features?

Thursday, August 6, 2009 - posted by Till

Please post feature requests to the ISPConfig bugtracking system:

http://bugtracker.ispconfig.org

How to avoid that wordpress replaces — with – in HTML

Wednesday, August 5, 2009 - posted by Till

If you run a blog that covers topics from Linux / Unix like we here at FAQforge and you include Linux shell commands in a wordpress post, you might have noticed that WordPress replaces the char combination “–” with – in the HTML sources. But the replacement – is displayed by the browser as “-” and not “–”. So if someone copys your shell command examples to execute them, they will not work. To fix this behaviour, edit the file wp-includes/formatting.php in wordpress and replace the lines 55 and 56:

$static_characters = array_merge(array(‘—’, ‘ — ‘, ‘–’, ‘ – ‘, ‘xn–’, ‘…’, ‘“’, ‘\’s', ‘\’\”, ‘ ™’), $cockney);
$static_replacements = array_merge(array(‘—’, ‘ — ‘, ‘–’, ‘ – ‘, ‘xn--’, ‘…’, $opening_quote, ‘’s’, $closing_quote, ‘ ™’), $cockneyreplace);

with:

$static_characters = array_merge(array(‘—’, ‘ — ‘, ‘xn–’, ‘…’, ‘“’, ‘\’s', ‘\’\”, ‘ ™’), $cockney);
$static_replacements = array_merge(array(‘—’, ‘ — ‘, ‘xn--’, ‘…’, $opening_quote, ‘’s’, $closing_quote, ‘ ™’), $cockneyreplace);

Backing up OpenVZ virtual machines with vzdump

Tuesday, August 4, 2009 - posted by Till

Vzdump is a perl script that makes live backups of OpenVZ virtual machines very easy. The following steps are for Debian Linux but vzdump can be used on all other linux distributions. Only the installation may vary.

Download and install vzdump from http://download.openvz.org/contrib/utils/vzdump/

cd /tmp
wget http://download.openvz.org/contrib/utils/vzdump/vzdump_1.1-2_all.deb
dpkg -i vzdump_1.1-2_all.deb

Create the backup directory

mkdir /home/backup

Create a backup of all virtual machines as compressed (tar.gz) archive and send a email report to the root user when finished.

vzdump –dumpdir /home/backup –suspend –compress –mailto root –all

vzdump can also be used to restore a backup.  Example: restore the backup of the virtual machine 101:

vzdump –restore /home/backup/vzdump-101.tgz 101

To restore the backup to a different virtual machine, you can specify a differnt target ID. E.g. restore the backup of vm 101 to the virtual machine with the ID 500:

vzdump –restore /home/backup/vzdump-101.tgz 500

Where can I report bugs in ISPConfig?

Tuesday, August 4, 2009 - posted by Till

Please report bugs in ISPConfig to the bugtracking system:

http://bugtracker.ispconfig.org

How to get the status of a Linux software raid?

Monday, August 3, 2009 - posted by Till

The current status of a Linux software raid is written to the file /proc/mdstat. You can view the status on the shell with the command:

cat /proc/mdstat

The output will look similar to this:

server:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
726266432 blocks [2/2] [UU]

md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
4200896 blocks [2/2] [UU]
resync=PENDING

md0 : active raid1 sda1[0] sdb1[1]
2104448 blocks [2/2] [UU]

The above setup is a raid 1 system, this means that the data is mirrored to both disks. If one disk would have failed, you would see [_U] when the first disk has failed or [U_] when the second disk has failed in the output instead of [UU].