Recovering file systems using fsck

Fsck (File System ChecK) – checks and restores file systems.

Before starting the scan, unmount the file system with the command:

umount /dev/sda1

An example of starting a scan (where /dev/sda1 is a device or partition to be checked):

fsck -V -C -f /dev/sda1

View brief documentation:

man fsck

I will describe some startup keys:
-C (display progress bar if possible)
-M (do not check mounted file systems)
-p (auto mode)
-y (agree to all questions)
-n (disagree on all questions)
-f (forced check)
-V (more detailed information)

Installing and using the nbtscan network scanner

Install command in Linux Ubuntu/Debian:

sudo apt-get install nbtscan

The Windows version can be downloaded from http://www.unixwiz.net/tools/nbtscan.html

Network scan example:

nbtscan 192.168.1.0/24

I will describe the possible startup keys:
-O FILENAME (output information to file)
-v (more detailed information output)
-p (port indication)
-H (generate HTTP header)
-m (MAC address indication)
-n (do not convert names to DNS, display only IP)
-t NUMBER (response time in seconds, default 1)
-v (display version nbtscan)

Minicom error solution “Device /dev/ttyS0 is locked”

Sometimes if the connection to Linux from which the connection was made via Minicom is lost, then the next time you start Minicom, you could see an error:

Device /dev/ttyS0 is locked.

The name /dev/ttyS0 may be different, depending on what COM port you have.
To avoid such an error, it is necessary to correctly shut down Minicom using the CTRL-A keys and then the Q key.

You can solve the problem by killing the process as a root user with the command:

killall -9 minicom

In Ubuntu, use the command:

sudo killall -9 minicom

Or you can simply delete the file «LCK..ttyS0» in the /var/lock/ directory.

After that, the error will not be displayed.

How to convert a list of IP addresses to DNS names

In Linux, you can convert a list of IP addresses into DNS names, for example, by a simple script.

To do this, create an empty file with the extension .sh, make it executable and add the content to it:

#!/bin/sh
while read ip traf ; do
    name=`host $ip|awk '{print $NF}'`
    echo -e "$name\t$ip\t$traf"
done >name_ip_traf.lst <ip_traf.lst

Where ip_traf.lst is a file with a list of IP addresses that need to be converted to DNS names.

You can make it executable by the command:

chmod +rwx file.sh

Run the script in the directory where it is located by the command:

./file.sh

Or run by specifying the full path:

/dir/file.sh

After the startup, you must wait for a while or interrupt the execution by pressing CTRL+C.