Category Archives: Bash - Page 2

Yum Update excluding packages

http://www.cyberciti.biz/faq/redhat-centos-linux-yum-update-exclude-packages/

yum –exclude=perl* update

Block IP addresses with iptables

iptables -A INPUT -s IP-ADDRESS -j DROP

then save

service iptables save

Spawn Rsync Expect Timeout!

So you’ve written a bash script to do a rsync backup, but the script times out?

Scratching your heading trying to figure out what the issue is?

CHROOT local users to their own directory

Once VSFTPD is installed, edit the

/etc/vsftpd/vsftpd.conf file and add the following line if it does not exist

chroot_local_user=YES

PID Off….

find out the process ID of a process

pidof processname

to kill it?

kill -9 PID

Copy files between servers using SCP

scp username@hostB:~/myfile.file /localdir

hostB is the remote server we want to copy the file from

Proc Info

System Info – procinfo
procinfo gathers some system data from the /proc directory and prints it formatted on the screen.

Some of the information displayed is

Free up some memory with DROP Cache

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

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
This is a non-destructive operation, and dirty objects are not freeable, the user should run “sync” first in order to make sure all cached objects are freed

Change the default editor for Crontab

export EDITOR=nano

Install the virtual viewer a VNC Client

Install the Virtual Viewer VNC Client
yum install virt-viewer