Archive for the 'Linux' Category

 

List disk storage devices info in Linux..

Mar 18, 2010 in Linux

Use:

parted -l

or

fdisk -l

wget usage example..

Mar 03, 2010 in Linux, Network, Web

wget –recursive -x -l 0 -e robots=off –wait 1 \
-U Mozilla –no-parent –user=user –password=password \
https://hudson.dev.java.net/svn/hudson/trunk/hudson/plugins/ivy/

Linux DNS configuration notes..

Jul 01, 2009 in Linux

  • — The DNS server is ‘named’
    — $ ps -ef | egrep named
    — $ /etc/init.d/named status
    — Config file is /etc/named.conf (see example below)
  • — Configuration examples in /etc/named.conf file
    -- // Reverse DNS map
    zone "10.168.192.in-addr.arpa" {
            type master;
            file "/var/named/192.168.10.rev";
            };
    
    -- // Forward DNS map
    zone "mydomain.com" {
            type master;
            file "/var/named/mydomain.com.hosts";
            };
    
  • — file “/var/named/mydomain.com.hosts”
    $ttl 38400
    @       IN      SOA     dns.mydomain.com. root (
                            2008081601
                            10800
                            3600
                            604800
                            38400 )
                    IN      NS      dns.mydomain.com.
                    IN      MX      10 dns.mydomain.com.
    dns             IN      A       192.168.10.2
    mach01          IN      A       192.168.10.50
    ;; .. other machines..
    machdbs01       IN      A       10.100.2.21
    ecnfs02         IN      CNAME   machdbs01
    ecnapp02        IN      CNAME   machdbs01
    ;; External machines
    machext01       IN      A       68.246.97.42
    ecnpart02       IN      A       68.246.97.43
    ....
    

scp multiple distinct files ..

Jun 26, 2009 in Linux

scp  \
 user@machine:"/somepath/file1.txt \
/somepath/file2.doc \
/someotherpath/file3.c \
/somepath/file4.php \
/anypath/file5.bsh" \
.

Make sure there is (are) no space(s) after the back-slashes
and note the “.” (dot) at the end.. or replace the dot with
any target folder to copy the files to.

RedHat Enterprise Networking note..

Jun 18, 2009 in Linux, Network

The /etc/sysconfig/network file contains the
HOSTNAME and the GATEWAY.

The /etc/sysconfig/network-scripts/ifcfg-eth0 file contains the
IPADDRess, NETMASK and BROADCAST addresses.

LDAP backup and reload ..

May 12, 2009 in Linux

To backup:
— cd /etc/openldap
— slapcat -l backup.ldif

To reload:
— stop ldap (/etc/init.d/ldap stop)

— cd /var/lib/ldap

— mv world world0

— mkdir /var/lib/ldap/world

— chown ldap:ldap /var/lib/ldap/world

— /etc/init.d/ldap start

— cd /etc/openldap

— slapadd -l backup.blah

— chown -R ldap:ldap /var/lib/ldap/world

Mounting an ISO file..

Feb 25, 2009 in Linux

sudo mount -o loop /path/to/file.iso /somedir
ls /somedir

Searching for files in Debian distribution packages..

Jan 06, 2009 in Linux, Ubuntu

# apt-get install apt-file
# apt-file update
# apt-file search gtk+-2
libgtk-directfb-2.0-dev: /usr/lib/pkgconfig/libgtk-directfb-2.0-0/gtk+-2.0.pc
libgtk2.0-dev: /usr/lib/pkgconfig/gtk+-2.0.pc
lsb-build-desktop3: /usr/lib/lsb3/pkgconfig/gtk+-2.0.pc
valac: /usr/share/vala/vapi/gtk+-2.0.deps
valac: /usr/share/vala/vapi/gtk+-2.0.vapi

Identify bash interactive shell..

Nov 11, 2008 in Linux


export __BASHIAS=0
if [ "$(echo $- | grep -c i)" == 1 ]
then
	export __BASHIAS=1
fi

...

if [[ ${__BASHIAS} = 1 && ... ]]
then
	...
fi

Setting up swap space ..

Oct 17, 2008 in Linux

# dd if=/dev/zero of=/swapfile bs=1M count=128
# mkswap -L swapfile /swapfile
# swapon /swapfile
[...]
# swapoff /swapfile
# rm /swapfile