Friday, May 30, 2008

Some Linux commando's Redhat

Tar and zip file:
tar zcf oblog.tar.gz *

Get RedHat release:
cat /etc/redhat-release

Get the processor information:
cat /proc/cpuinfo

Get memory information:
cat /proc/meminfo

Determine if an machine is 32bit or 64bit:
uname -a
64 bit:
Linux hostname 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:58:43 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

32 bit:
uname -a
Linux hostname 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386 GNU/Linux

What is LISTING on a specific port:
netstat -a | grep {PORT_NUMBER}


lsof -i tcp:{PORT_NUMBER}

ssh to another host without a password:
#Generate a key pair
cd $HOME/.ssh/
ssh-keygen -t rsa

#copy the key pair to the server from which you want to log in:
cat | ssh host 'cat>>.ssh/authorized_keys'

What is the biggest file in a directory:
du --max-depth=1 /home/ | sort -n -r

Size of multiple directories
du -sH *

No comments:

Post a Comment