Tuesday, November 27, 2012

Check the dir size

To check the Dir size.
=====================

[root@TESTBED ~]# du -h --max-depth=1 /opt/ | sort -n -r

[root@TESTBED ]# du -h --max-depth=1 | sort -n -r


File size
=====

[root@TESTBED ]# du -h -s /opt/abc.txt

[root@TESTBED ]# du -h -s /opt/*

Clear the memory cache.

Clear the memory cache.
======================

# sync; echo 3 > /proc/sys/vm/drop_caches

Hardware clock set

# hwclock --show
$ date

Set clock

To set the system clock directly:

# date MMDDhhmmYYYY



Hardware Clock Set
====================
To set the hardware clock directly (the argument must be in local time, even if you keep your hardware clock in UTC.):

# hwclock --set --date="YYYY-MM-DD hh:mm:ss"

# hwclock --set --date=hh:mm:ss"


or

Synch time to hardware to OS / OS to hardware

The hardware clock can be set from the system clock and vice versa:

# hwclock --systohc
# hwclock --hctosys

Create a local compressed tarball from remote system directory

Create a local compressed tarball from remote host directory


# ssh user@host "tar -cf - /path/to/dir" | gzip > dir.tar.gz

Public Key issue while installing rpm through yum


Public Key issue while installing rpm through yum.

============================================

1. Check keys.
  
    find / -name "*GPG*"

  - Will get answers like below

    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-former
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-rhx
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-auxiliary
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta


2. Go to the /etc/pki/rpm-gpg/
    # cd /etc/pki/rpm-gpg/

3. type the below command.
   # rpm --import *GPG*

 The above command wont be give any kind of output.

Adding SWAP by dd command

Create and add swap space in linux.
===========================

#dd if=/dev/zero of=/swap1 bs=1024 count=1048576

#dd if=/dev/zero of=/dev/swap1 bs=1G count=4

#mkswap /swap1

#swapon /swap1

#free -m


bs=1024 ( 1MB )
count=1048576 ( 1GB )

Adding proxy in Linux

Adding proxy in Linux
===================

Run the below commands  in terminal to get proxy details for temporary.

export http_proxy=http://proxy-ip:port/
export https_proxy=https://proxy-ip:port/

export http_proxy=http://proxy-url:port/
export https_proxy=https://proxy-url:port/


Add the proxy details in /etc/profile to permanent changes and access to all users (global set),
or else add in user .bach_profile file to get effect on selected user.


---------------------------------------------

For FTP

$export ftp_proxy=http://<proxy-server-ip>:<port>

with auth
$export ftp_proxy=http://<user>:<password>@<proxy-server-ip>:<port>

------------------------------------------

For svn

#vi /etc/subversion/servers


[global]
#http-proxy-host=my.proxy
#http-proxy-port=80
#http-proxy-username=[username]
#http-proxy-password=[password]