Checking Bad Sector/Bad Blocks via Terminal

Bad Sector/Bad Block

A bad sector is a sector on a computer’s disk drive that cannot be used due to permanent damage to the disk surface.

There are two ways to detect bad sectors in Linux: you can use the Disk Utility GUI, or use the command line. You can use the badblocks command to check your hard disk for bad sectors:

$ sudo badblocks -v /dev/sdb1

For more info type the following command:

$ man badblocks

Badblocks will give us the number of bad sectors in our hard disk drive.

Display System Information via Terminal

System Information Commands

df: The df command displays filesystem disk space usage for all mounted partitions. “df -h” is probably the most useful – it uses megabytes (M) and gigabytes (G) instead of blocks to report. (-h means “human-readable”)

-h, –human-readable print sizes in human readable format (e.g., 1K 234M 2G)

-T, –print-type print file system type

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              10G  5.1G  4.5G  52% /home
/dev/sdb1              25G   23G  2.2G  92% /media/Label

$df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext4     10G  5.1G  4.5G  52% /home
/dev/sdb1  fuseblk     25G   23G  2.2G  92% /media/Label

For more info type the following command:

$df --help

du: The du command displays the disk usage for a directory. It can either display the space used for all subdirectories or the total for the directory you run it on.

-h, –human-readable print sizes in human readable format (e.g., 1K 234M 2G)
      –si like -h, but use powers of 1000 not 1024

-s, –summarize display only a total for each argument

$ du -h /home/user
1024k /home/user/files
5.1G /home/user

$du -sh /home/user
5.1G /home/user

For more info type the following command:

$du --help

Howto: Symbolic Links

Symbolic Links

NAME
     ln – make links between files

SYNOPSIS
     ln [OPTION]… [-T] TARGET LINK_NAME (1st form)
     ln [OPTION]… TARGET (2nd form)
     ln [OPTION]… TARGET… DIRECTORY (3rd form)
     ln [OPTION]… -t DIRECTORY TARGET… (4th form)

DESCRIPTION

In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with –symbolic. When creating hard links, each TAR? GET must exist. Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory.

$ ln -s source file or directory (then the) link-name
Example:
$ ln -s ~/source-folder/sourcefile /backupfile

Find your MAC address via Terminal

How to find your MAC address

There are several ways to open up your Terminal and view your MAC address. And I’ll show some of them. Now, let’s go to Applications > Accessories then startup Terminal.

Alternative:
  • By default, your terminal shortcut keys is configured to “CTRL+ALT+T” (press simultaneously) from your keyboard.
  • Press “ALT+F2” from your keyboard and type “gnome-terminal” (without the quotes) then click the Run button.

Type the following in to your Terminal to display your MAC Address.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:4c:51:gf:38:5e
          inet addr:192.168.100.100  Bcast:192.168.255.255  Mask:255.255.255.0
          inet6 addr: fe80::34c:51ff:fegf:385e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:97015 errors:0 dropped:0 overruns:0 frame:0
          TX packets:140964 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:41803450 (41.8 MB)  TX bytes:121567347 (121.5 MB)
          Interrupt:18 Base address:0xb800
$ ifconfig | grep HWaddr
eth0     Link encap:Ethernet HWaddr 00:4c:51:gf:38:5e
--- It will display a list of your Ethernet card and their MAC address
$ ifconfig | grep Ethernet
eth0     Link encap:Ethernet HWaddr 00:4c:51:gf:38:5e
--- It will display a list of your Ethernet card and their MAC address

Thanks for dropping by!