blog.up-link.ro
24Nov/110

UNIX Tips: How to find broken symbolic links

In computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

1. To display a list of the broken links, execute:

find -L ${dir} -type l

2. To remove the broken links, execute:

find -L ${dir} -type l -print0 | xargs -0 rm
Do not forget to replace ${dir} with the desired directory.

Print This Post Print This Post


15Nov/110

Linux Tips: How to force fsck on the next reboot or boot sequence

fsck is a file system consistency check and interactive repair tool.
Here is a quick tip that will show how you can tell your Linux system to perform a fsck on its partitions on the next reboot. Normally this will happen by default, after some time as configured in the filesystem at creation time (or changed later): after a number of days or a number of filesystem mounts.

If for some reason, you want to force the system to run fsck on the next reboot just use one of the following options:

Print This Post Print This Post
2Nov/110

Linux: How to mount SMB/CIFS shares under Linux

This document provides help on mounting SMB/CIFS shares under Linux.
All files accessible in a Linux and UNIX systems are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

Use the mount command to mount remote SMB/CIFS shares under Linux as follows:

mount -t cifs //192.168.1.1/mySharedFolder -o username=myUser,password=myPassword /mnt/mySharedFolder

Where,
-t cifs : File system type to be mount
-o : are options passed to mount command, in this example I had passed two options. First argument is the user name (myUser) and second argument is the password (myPassword) to connect to the remote computer.
//192.168.1.1/mySharedFolder : remote computer and share name
/mnt/mySharedFolder : local mount point directory

Make sure to create /mnt/mySharedFolder first.

Print This Post Print This Post
25Oct/110

FreeBSD: How to mount SMB/CIFS shares under FreeBSD

This document provides help on mounting SMB/CIFS shares under FreeBSD Operating System.
The mount_smbfs command mounts a share from a remote server using SMB/CIFS protocol. You can easily mount MySharedFolder share using the following syntax:

mount_smbfs -I 192.168.1.1 //myUser@serverName/mySharedFolder /mnt/mySharedFolder

Where,
192.168.1.1 is the IP address of the remote computer.
myUser is your user name.
serverName is NETBIOS Server Name.
mySharedFolder is CIFS share name.
/mnt/mySharedFolder is the local mount point directory.

Print This Post Print This Post
22Sep/110

UNIX Tools: pipe viewer (pv) – monitor the progress of data through a pipe

Pipe Viewer (pv) allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and estimated time of arrival.

pv can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.

Print This Post Print This Post
5Aug/110

Linux: How to retrieve and change partition`s UUID

A Universally Unique Identifier (UUID) is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE).

How to retrieve UUID

On some unix systems a hard drives partition is referred by to as UUID instead of the location of the it relevant block device file for example like in /etc/fstab:

UUID=03136e34-6187-4720-8594-b27508ef978f /boot ext3 defaults,noatime 1 2

In this case it would be harder to find which partition is mounted behind /boot. Here are some ways how to retrieve relevant partition UUID.

Print This Post Print This Post
29Jul/110

FreeBSD: How To Rename Network Interfaces

To rename a network interface under FreeBSD, invoke ifconfig command as root:

ifconfig bge1 name net1

Observe that the interface formerly known as bge1 is now net1. To keep the change after reboot, add the following lines to /etc/rc.conf:

ifconfig_bge1_name="net1"
ifconfig_net1="inet 192.168.0.1 netmask 255.255.255.0"

Print This Post Print This Post
28Jul/110

How To Add a nullroute (blackhole filtering)

In computer networking, a null route or blackhole route is a network route that goes nowhere. Matching packets are dropped (ignored) rather than forwarded, acting as a kind of very limited firewall. The act of using null routes is often called blackhole filtering.

Null routing has an advantage over classical firewalls since it is available on every potential network router (including all modern operating systems), and adds virtually no performance impact. Due to the nature of high-bandwidth routers, null routing can often sustain higher throughput than conventional firewalls. For this reason, null routes are often used on high-performance core routers to mitigate large-scale denial-of-service attacks before the packets reach a bottleneck, thus avoiding collateral damage from DDoS attacks — although the target of the attack will be inaccessible to anyone.

Print This Post Print This Post
27Oct/100

How To Monitor Network Traffic by Process under Linux

NetHogs is a small network monitoring tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which process is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.

To install NetHogs under CentOS, Fedora, RHEL, enter:

yum install nethogs

To install NetHogs under Debian and Ubuntu, enter:

apt-get install nethogs

The default network interface to monitor is eth0. If you wish to use other device, simply type the argument after nethog, open the terminal and run the following command:

Print This Post Print This Post
17Oct/100

UNIX Tools: mytop – MySQL Monitoring Tool

MyTop is a console-based tool for monitoring the threads and overall performance of a MySQL server. It runs on most Unix systems. MyTop is a top clone for MySQL Server.

To install MyTop under FreeBSD, enter:

make install clean -C /usr/ports/databases/mytop

To install MyTop under CentOS, Fedora, RHEL, enter:

yum install mytop

To install MyTop under Debian, Ubuntu, enter:

sudo apt-get install mytop

Print This Post Print This Post