Useful *nix commands

Posted by nonenas on Nov 30th, 2007
2007
Nov 30

Case: You have a text file containing multiple lines of comma seperated values. Some values have duplicates. You want to get rid of them. Let’s say for example that the files is called "file.txt", the second comma seperated field may have duplicates and you want to get all the unique values of the second field.

cat file.txt|cut -d ‘,’ -f2|sort|uniq

 

  • cat : we use "cat" to get the content of the file

 

  • cut -d ‘,’ -f2: we use the switch -d ‘,’ to specify that values are delimited by commas (’,') and the switch -f2 to get the second field

 

  • sort: we use "sort" in order to sort the contents of the file

 

  • uniq: we use "uniq" in order to get only the unique values.

 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Hard Disk Health

Posted by nonenas on Nov 28th, 2007
2007
Nov 28

The new era, with networked home PCs everywhere, usually turned on for hours or days led to a growing demand of silent PCs with large hard disk drives. The amount of data stored in these drives grows day by day and becomes more and more valuable. Large hard disk drives offer more space for data but also can cause greater damage in case of a defect.

A common mistake of users, which significantly shortens the lifetime of a hard disk drive is high temperature. A healthy temperature for a hard disk drive is up to 40oC (104oF). The need for silent PCs many times leads to boxes well insulated, with good ventilation for the CPU and the chipset but not proper ventilation for hard disks. Another usual mistake of users is the installation of many hard disk drives very close to each other, habit that leads to high hard disk drive temperatures as well. But what can a user do in order to protect his drive from high temperatures?

  • First of all measure the hard disks temperature. There are plenty of free utilities which measure the temperature of a hard disk drive. Drives which support S.M.A.R.T. have a build in temperature counter whose value can be viewed by programs that support S.M.A.R.T. monitoring. The counter has the ID C2 (attribute name HDA Temperature) and its value must be 100 or above.
  • If temperatures are high and hard disks are very close to each other inside the PC case, try to move them in more comfortable places.
  • Try to have good air-flow inside the PC case and don’t ignore hard disk drives.
  • Clean the dust from your box (We have seen PC cases which weighed 0,5 kgr less after cleaning)
  • You can always buy coolers for your hard disk drives.
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]