blog.up-link.ro
24May/100

How To change MTU size under FreeBSD and Linux

The maximum transmission unit (MTU) of a layer of a communications protocol is the size (in bytes) of the largest protocol data unit that the layer can pass onwards.

1. Changing the MTU size with ifconfig tool

In order to change the MTU size, use ifconfig as follows:

ifconfig [Interface] mtu [SIZE] up
ifconfig eth0 mtu 1500 up

NOTE: This will only work if supported by both the network interface card and the network components such as switch.

Print This Post Print This Post
13May/100

UNIX Tools: fdupes – Get rid of duplicate files

fdupes is a  tool for identifying or deleting duplicate files residing within specified directories. It first compares file sizes and MD5 signatures, and then performs a byte-by-byte check for verification.

1. Install fdupes

Type the following commands to install fdupes in FreeBSD:

# cd /usr/ports/sysutils/fdupes
# make install clean

Type the following command to install fdupes in CentOS / Fedora / RHEL (make sure you have rpmforge repo enabled):

Print This Post Print This Post
3May/100

Unix-like Tips and Tricks: BASH Redirection

Bash is a POSIX shell with a number of extensions. It is the shell for the GNU operating system from the GNU Project. It can be run on most Unix-like operating systems.

In this article I'll talk about bash redirections.

Print This Post Print This Post
2May/100

Bandwidth Monitoring Tools for FreeBSD and Linux: iftop

Bandwidth represents the capacity of the connection. The greater the capacity, the more likely that greater performance will follow, though overall performance also depends on other factors, such as latency.

iftop is a free open-source tool to measure bandwidth utilization on the network interfaces on your systems. As the name predicts, iftop is what "top" utility is for CPU usage measurement.

To install iftop in CentOS, Fedora, RHEL ( make sure you have DAG repository enabled ):

# yum install iftop

Print This Post Print This Post
29Apr/100

UNIX-like Tips and Tricks: find command

The find program is a search utility on Unix-like operating systems. It searches through one or more directory trees of a filesystem, locating files based on some user-specified criteria. By default, find command returns all files below the current working directory. Further, find command allows the user to specify an action to be taken on each matched file. In this article I'll show you some tips for using the find command.

To begin, let's look at the basic structure of the find command:

find start_directory  test  options  criteria_to_match  action_to_perform

Example:

In the following command, find will search for any file with the "php" extension in the current directory:

# find . -name "*.php" -print

Print This Post Print This Post
26Apr/100

How To Change MAC Address in Linux, BSD, Unix

Media Access Control address (MAC address) is a unique identifier assigned to most network adapters or network interface cards (NICs) by the manufacturer for identification, and used in the Media Access Control protocol sub-layer. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number. It may also be known as an Ethernet Hardware Address (EHA), hardware address, adapter address, or physical address.

1. Change MAC Address in Linux ( CentOS, Debian, Fedora, RHEL, Slackware, SuSE, Ubuntu )

# ifconfig [interface name] down
# ifconfig [interface name] hw ether [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig eth0 down
# ifconfig eth0 hw ether 1A:2B:3C:4D:5E:6F
# ifconfig eth0 up

Print This Post Print This Post
24Apr/100

FreeBSD: How To Prevent Users from seeing information about processes owned by others

FreeBSD has inbuilt security measure to disallow users to see processes that are being run under another UID to avoid information snooping. To enable this security feature via sysctl, type the following commands:

sysctl security.bsd.see_other_uids=0
sysctl security.bsd.see_other_gids=0

To enable this security feature on boot, add the following lines to /etc/sysctl.conf:

# Hide UID and GID from other users
security.bsd.see_other_gids=0
security.bsd.see_other_uids=0
Print This Post Print This Post
23Apr/100

Bandwidth Monitoring Tools for FreeBSD and Linux: nload

Bandwidth in computer networking refers to the data rate supported by a network connection and it represents the capacity of the connection.

nload is a ncurse based network traffic analyser.
nload allow a system administrator to easily monitor the traffic going on its network. It provide both a graph of incoming and outgoing traffic as well as network data transfer statistics.

Print This Post Print This Post
20Apr/100

How To add Extra Repositories in Ubuntu Linux

A software repository is a storage location from which software packages may be retrieved and installed on a computer.

It's very easy to add extra repositories in Ubuntu Linux. In this article I'll show you how to add some useful repositories to your Ubuntu distribution.

First, we have to backup our sources.list by typing in terminal:

# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

To add extra repositories proceed with the next steps.

Print This Post Print This Post
14Apr/100

How To Export MySQL data to CSV file

In this article I'll show you how to export MySQL database to a CSV file.

1. Export MySQL data to CSV file using a simple "SELECT" statement

If you want to export your mysql table into a csv file you need to run the following command:

# mysql -u username -ppassword database -e "SELECT * INTO OUTFILE '/tmp/filename.csv'  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'  LINES TERMINATED BY '\r\n' FROM table;"

username is your mysql username
password is your mysql password
database is your mysql database
table is the table you want to export

You can find the exported CSV file in the /tmp directory. The name of the file is filename.csv.

2. Export MySQL data to CSV file using "sed"

If you want to export your mysql table into a csv file you need to run the following command:

Print This Post Print This Post