Monthly Archives: October 2013

curl usage

curl -IL “URL”

this will send a HEAD request (-I), follow through all redirects (-L), and display some useful information in the end.

you can get more with GET request:

curl -sL -w "%{http_code} %{url_effective}\\n" "URL" -o /dev/null
  • url_effective
  • http_code
  • http_connect
  • time_total
  • time_namelookup
  • time_connect
  • time_pretransfer
  • time_redirect
  • time_starttransfer
  • size_download
  • size_upload
  • size_header
  • size_request
  • speed_download
  • speed_upload
  • content_type
  • num_connects
  • num_redirects
  • ftp_entry_path

Kloxo MR – kloxomr

This is special edition (fork) of Kloxo with many features not existing on Kloxo official release (6.1.12+). This fork named as Kloxo-MR (meaning ‘Kloxo fork by Mustafa Ramadhan’)

cd /
yum update -y

yum install yum-utils yum-priorities vim-minimal subversion curl zip unzip -y
yum install telnet -y

setenforce 0
echo ‘SELINUX=disabled’ > /etc/selinux/config

cd /etc/yum.repos.d/

wget https://github.com/mustafaramadhan/kloxo/raw/release/kloxo-mr.repo –no-check-certificate

yum install kloxomr

run  Kloxo install script:

 

sh /usr/local/lxlabs/kloxo/install/setup.sh

find files bigger and smaller than 4096 bytes

find . -type f -size +4096c
find . -type f -size -4096c

The -size switch explained:

-size n[cwbkMG]

    File uses n units of space. The following suffixes can be used:

    `b'    for 512-byte blocks (this is the default if no suffix  is
                                used)

    `c'    for bytes

    `w'    for two-byte words

    `k'    for Kilobytes       (units of 1024 bytes)

    `M'    for Megabytes    (units of 1048576 bytes)

    `G'    for Gigabytes (units of 1073741824 bytes)

    The size does not count indirect blocks, but it does count
    blocks in sparse files that are not actually allocated. Bear in
    mind that the `%k' and `%b' format specifiers of -printf handle
    sparse files differently. The `b' suffix always denotes
    512-byte blocks and never 1 Kilobyte blocks, which is different
    to the behaviour of -ls.

					

run scripts at boot time – Debian

Debian uses a Sys-V like init system for executing commands when the system runlevel changes – for example at bootup and shutdown time.

If you wish to add a new service to start when the machine boots you should add the necessary script to the directory/etc/init.d/. Many of the scripts already present in that directory will give you an example of the kind of things that you can do.

You can use update-rc.d to manage run time scripts.

update-rc.d example_service defaults

4K file size

All file systems have a cluster or block size, or the smallest amount of disk space that can be allocated to hold a file. Even if the actual file size is smaller than the cluster/block size, it will still consume one cluster, or 4K on your file system. The cluster size depends on the file system, and the file system options.

If it contains zero bytes, as Gilles pointed out, it uses zero blocks/clusters but one inode on typical *nix file systems, which better answers the caveat, “unless it’s blank.”

dd if=/dev/zero of=1_byte.bin bs=1 count=1

But wait a minute:

du -sh 1_byte.bin
4.0K 1_byte.bin

 

bbFTP

bbFTP is a file transfer software. It implements its own transfer protocol, which is optimized for large files (larger than 2GB) and secure as it does not read the password in a file and encrypts the connection information.
bbFTP main features are:

  • Encoded username and password at connection
  • SSH and Certificate authentication modules
  • Multi-stream transfer
  • Big windows as defined in RFC1323
  • On-the-fly data compression
  • Automatic retry
  • Customizable time-outs
  • Transfer simulation
  • AFS authentication integration
  • RFIO interface