<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bash Shell &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="http://lifelinux.com/category/bash-shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Tue, 05 Apr 2016 15:12:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.15</generator>
	<item>
		<title>How To Backup Data in CentOS Using Bash Script</title>
		<link>http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/</link>
					<comments>http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 05 Apr 2016 15:08:40 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=2114</guid>

					<description><![CDATA[<p>Today, I will show you simple bash script I&#8217;m using to backup data in CentOS server. Before We beginning, please ensure you have &#8220;rsync&#8221; package installed. 1. Setting up Backup script Make a new directory with following command # mkdir -p /bak # chown root.root # chmod 700 /bak Create a bash script # vi [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/">How To Backup Data in CentOS Using Bash Script</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Today, I will show you simple bash script I&#8217;m using to backup data in CentOS server. Before We beginning, please ensure you have &#8220;rsync&#8221; package installed.<br />
<span id="more-2114"></span></p>
<h2>1. Setting up Backup script</h2>
<p>Make a new directory with following command</p>
<pre>
# mkdir -p /bak
# chown root.root
# chmod 700 /bak
</pre>
<p>Create a bash script </p>
<pre>
# vi /bak/fbk.sh
# chmod +x /bak/fbk.sh
</pre>
<p>Add the following code</p>
<pre>#!/bin/bash
# Full Backup Server 
# Support backup multiple directories, multiple databases and files configuration
# Copyright (c) 2010-2013 LongVNIT 
# This script is licensed under GNU GPL version 2.0 or above

### SERVER BACKUP
SERVER="1.1.1.1"
USERNAME="username"
IDENTITY="id_rsa"
SSH_PORT="22"

### MYSQL INFO
MHOST="localhost"
MUSER="root"
MPASS="password"

### BACKUP DIRECTORY
BAK="/bak"
DATA="/home"
MYSQL=$BAK"/db"
CONF=$BAK"/conf"
EXCLUDE=$BAK"/exclude.txt"
TEMP_DIR=$BAK"/tmp"

### BACKUP DATA TYPE: 1 FULL, 2: 1-3-5
TYPE=2
DAILY=$(date +"%u")

### MYSQL BACKUP FUNCTION
doMySQL() {
	DBS="$(mysql -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
	[ ! -d $MYSQL/$DAILY ] &amp;&amp; mkdir -p $MYSQL/$DAILY || rm -f $MYSQL/$DAILY/mysql*
	for db in $DBS
	do
		mysqlcheck -or -u$MUSER -p$MPASS $db
		FILE=$MYSQL/$DAILY/mysql-$db.gz
		mysqldump -u $MUSER -h $MHOST -p$MPASS $db | gzip -9 &gt; $FILE
	done
	
	### BACKUP
	rsync -av --delete -e "ssh -p $SSH_PORT -i $BAK/$IDENTITY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" $MYSQL/$DAILY/* $USERNAME@$SERVER:db/$DAILY
}

doConfig() {
	rm -rf $TEMP_DIR/*
	mkdir -p $TEMP_DIR/etc
	
	# Backup system configuration
	cp /etc/sysctl.conf $TEMP_DIR/etc

	# Backup iptables
	iptables-save &gt; $TEMP_DIR/iptables.txt &gt; /dev/null 2&gt;&amp;1

	# Backup my.cnf
	if [ -e /etc/my.cnf ]; then
		cp /etc/my.cnf $TEMP_DIR/etc
	fi

	if [ -d /etc/lcache ]; then
		cp -R /etc/lcache $TEMP_DIR/etc
	fi

	# Backup sshd
	cp -R /etc/ssh $TEMP_DIR/etc

	# Backup crontab
	crontab -l &gt; $TEMP_DIR/crontab.txt &gt; /dev/null 2&gt;&amp;1

	# Backup logrotate
	cp -R /etc/logrotate.d $TEMP_DIR/etc

	# Backup init.d
	cp -R /etc/init.d $TEMP_DIR/etc

	# Backup fstab
	cp /etc/fstab $TEMP_DIR/etc

	# Backup webserver configuration
	if [ -d /webserver ]; then
		mkdir -p $TEMP_DIR/webserver
	fi

	# Backup PHP
	if [ -d /webserver/php ]; then
		mkdir -p $TEMP_DIR/webserver/php
		cp -R /webserver/php/etc $TEMP_DIR/webserver/php
	fi

	# Backup Apache
	if [ -d /webserver/apache ]; then
		mkdir -p $TEMP_DIR/webserver/apache
		cp -R /webserver/apache/conf $TEMP_DIR/webserver/apache
	fi

	# Backup Lighttpd
	if [ -d /webserver/lighttpd ]; then
		mkdir -p $TEMP_DIR/webserver/lighttpd
		cp -R /webserver/lighttpd/conf $TEMP_DIR/webserver/lighttpd
	fi

	# Backup Nginx
	if [ -d /webserver/nginx ]; then
		mkdir -p $TEMP_DIR/webserver/nginx
		cp -R /webserver/nginx/conf $TEMP_DIR/webserver/nginx
	fi

	# Backup proftpd
	if [ -d /webserver/proftpd ]; then
		mkdir -p $TEMP_DIR/webserver/proftpd
		cp -R /webserver/proftpd/etc $TEMP_DIR/webserver/proftpd
	fi
	
	# Backup Pure-FTPD
	if [ -f /etc/pure-ftpd.conf ]; then
		mkdir -p $TEMP_DIR/pure-ftpd
		cp -R /etc/pure* $TEMP_DIR/pure-ftpd
	fi
	
	# Backup webserver etc
	if [ -d /webserver/etc ]; then
		cp -R /webserver/etc $TEMP_DIR/webserver/
	fi
	
	# BACKUP
	[ ! -d $CONF ] &amp;&amp; mkdir -p $CONF || rm -f $CONF/conf-$DAILY.tar.gz
	tar cvfz $CONF/conf-$DAILY.tar.gz $TEMP_DIR/*
	### BACKUP
	rsync -av --delete -e "ssh -p $SSH_PORT -i $BAK/$IDENTITY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" $CONF/* $USERNAME@$SERVER:conf/
}

doData() {
	### BACKUP
	rsync -av --delete -e "ssh -p $SSH_PORT -i $BAK/$IDENTITY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --exclude-from $EXCLUDE $DATA/* $USERNAME@$SERVER:data/$DAILY
}

### PROCESS
doConfig;
doMySQL;
if [ $TYPE=="2" ]; then
	if [[ $DAILY=="1" || $DAILY=="3" || $DAILY=="5" ]]; then
		doData;
	fi
else
	doData;
fi
</pre>
<h2>Setting up Crontab</h2>
<p>Now I will show you how to schedule our backup process. In CentOS we use cron jobs in order to schedule task. For setting up cron jobs we use &#8220;crontab -e&#8221; command in command line.<br />
Example: I want to run this backup process on daily at 3:00 PM.</p>
<pre>
01 03 * * * /bak/fbk.sh
</pre>
<g:plusone href="http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/">How To Backup Data in CentOS Using Bash Script</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-backup-data-in-centos-using-bash-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</title>
		<link>http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/</link>
					<comments>http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/#respond</comments>
		
		<dc:creator><![CDATA[Unix]]></dc:creator>
		<pubDate>Tue, 16 Feb 2016 06:58:51 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[create socks with ssh]]></category>
		<category><![CDATA[create socks5]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=2108</guid>

					<description><![CDATA[<p>This guide will show you how to establish a secure connection for browsing the web through a tunnel between your computer and your server. With this method, you will set up a tunnel between your computer and your server. All your web traffic will be encrypted and forwarded from your server on to its final [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/">How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>This guide will show you how to establish a secure connection for browsing the web through a tunnel between your computer and your server. With this method, you will set up a tunnel between your computer and your server. All your web traffic will be encrypted and forwarded from your server on to its final destination.<br />
<span id="more-2108"></span></p>
<p>Socket Secure (SOCKS) is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 additionally provides authentication so only authorized users may access a server. Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded.</p>
<p>It works by launching a SOCKS proxy server on your computer using SSH. It will listen on a local port and your browser will connect to the web using that service.</p>
<h2>Creating the SOCKS Server</h2>
<p>The first step is to create the SOCKS server and establish a connection to your server with following command</p>
<pre># ssh -fNT -D &lt;your_ip_server&gt;:&lt;define_socks_port&gt; &lt;user_name&gt;@&lt;your_ip_server&gt;
</pre>
<p><strong>Options</strong><br />
-f: go to background<br />
-N: do not execute a remote program<br />
-T: disable pseudo-tty allocation<br />
-D: Define port forwarding and talks to the clients via SOCSK5 or SOCKS4 protocols</p>
<h2>Running as a service</h2>
<p>The first, Create a user called name &#8220;socks&#8221; and setup this account login to your server via SSH private key without password.</p>
<pre># useradd socks
</pre>
<p>To setup this account login your service via SSH private key, please read this <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2">article</a></p>
<p>The second, Login with socks and type the following command</p>
<pre># mkdir /opt/socks
# chown root.root -R /opt/socks
# chmod 700 /opt/socks
# touch /opt/socks/run.sh
# chmod +x /opt/socks/run.sh
# cp -R /home/socks/.ssh/id_rsa /opt/socks/
</pre>
<p>Append bellow content to /opt/socks/run.sh</p>
<pre>#/bin/bash
IPS="1.1.1.1 2.2.2.2 3.3.3.3"
SOCKS_PORT=9999
SSH_PORT=22
SSH_USER=socks

# Auto get list IPs on your server
# IPS=`ifconfig | grep "inet a" | awk '{print $2}' | grep -v "127.0" | cut -d: -f2`

for IP in $IPS
do
        echo "Building socks $IP"
        ssh -D $IP:$SOCKS_PORT -fN -p $SSH_PORT  -i /opt/socks/id_rsa $SSH_USER@$IP
done
</pre>
<g:plusone href="http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/">How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Centos: How To List All / Delete Hidden Files Recursively ?</title>
		<link>http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/</link>
					<comments>http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 29 Aug 2014 08:47:54 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[File System]]></category>
		<category><![CDATA[find command]]></category>
		<category><![CDATA[list hidden files]]></category>
		<category><![CDATA[list hidden folders]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1925</guid>

					<description><![CDATA[<p>I need to find and list all hidden files including directories on a Linux server (CentOS). How can I recursively list all hidden files and directories? How do I save result in a text file? And How do I delete all hidden files/directories ? Using the find command to list all hidden files recursively # [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/">Centos: How To List All / Delete Hidden Files Recursively ?</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>I need to find and list all hidden files including directories on a Linux server (CentOS). How can I recursively list all hidden files and directories? How do I save result in a text file? And How do I delete all hidden files/directories ?<br />
<span id="more-1925"></span></p>
<h2>Using the find command to list all hidden files recursively</h2>
<pre>
# find <path> -name ".*" -print
</pre>
<p>Example</p>
<pre>
# find /etc/ -name ".*" -print
/etc/skel/.bashrc
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/.pwd.lock
</pre>
<p>Or, </p>
<pre>
# find <path> -name ".*" -ls
</pre>
<p>Example</p>
<pre>
# find /etc/ -name ".*" -ls
1310797    4 -rw-r--r--   1 root     root          124 May 11  2012 /etc/skel/.bashrc
1310794    4 -rw-r--r--   1 root     root           18 May 11  2012 /etc/skel/.bash_logout
1310796    4 -rw-r--r--   1 root     root          176 May 11  2012 /etc/skel/.bash_profile
1310854    0 -rw-------   1 root     root            0 Dec 12  2012 /etc/.pwd.lock
</pre>
<p>If you only want to search only hidden files:</p>
<pre>
# find <path> -type f -iname ".*" -ls
</pre>
<p>Example</p>
<pre>
# find /usr -type f -iname ".*" -ls
8915163    4 -rw-r--r--   1 root     root          760 Sep 19  2012 /usr/share/man/man5/.k5login.5.gz
8651596    4 -rw-r--r--   1 root     root           40 May 11  2012 /usr/share/man/man1/..1.gz
8654188    4 -rw-r--r--   1 root     root         2438 Aug 25 14:29 /usr/local/lib/php/.depdb
8654187    0 -rw-r--r--   1 root     root            0 Aug 25 14:29 /usr/local/lib/php/.depdblock
8654186    0 -rw-r--r--   1 root     root            0 Aug 25 14:29 /usr/local/lib/php/.lock
...
</pre>
<p>Or, If you only want to search only hidden directories:</p>
<pre>
find <path> -type d -iname ".*" -ls
</pre>
<p>Example</p>
<pre>
# find /usr -type d -iname ".*" -ls
8654180    4 drwxr-xr-x   3 root     root         4096 Dec 12  2012 /usr/local/lib/php/.channels
8785283    4 drwxr-xr-x   2 root     root         4096 Dec 12  2012 /usr/local/lib/php/.channels/.alias
8654179    4 drwxr-xr-x   5 root     root         4096 Dec 12  2012 /usr/local/lib/php/.registry
...
</pre>
<p>To remove all hidden files recursively</p>
<pre>
# find <path> -type f -iname ".*" -print0 | xargs -0 rm -f
</pre>
<p>Example</p>
<pre>
# Delete all hidden files of apache server
# find /var/www/html -type f -iname ".*" -print0 | xargs -0 rm -f
</pre>
<g:plusone href="http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/">Centos: How To List All / Delete Hidden Files Recursively ?</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/centos-how-to-list-all-delete-hidden-files-recursively/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>10 Linux Find Command Examples</title>
		<link>http://lifelinux.com/10-linux-find-command-examples/</link>
					<comments>http://lifelinux.com/10-linux-find-command-examples/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Thu, 08 Sep 2011 02:42:39 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[cli command directory file find grep linux linux-unix locate regex search]]></category>
		<category><![CDATA[find command example]]></category>
		<category><![CDATA[linux find command]]></category>
		<category><![CDATA[linux find example]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1168</guid>

					<description><![CDATA[<p>The Linux find command is very powerful. It can search the entire filesystem to find files or directories according to the search criteria that you specify. In this article, I&#8217;ll show 10 examples of Linux find command that will be very useful to both newbies and experts. 1. Find files using name # find /etc [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/10-linux-find-command-examples/">10 Linux Find Command Examples</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>The Linux <strong>find command</strong> is very powerful. It can search the entire filesystem to find files or directories according to the search criteria that you specify. In this article, I&#8217;ll show 10 examples of Linux <strong>find command</strong> that will be very useful to both newbies and experts.<span id="more-1168"></span></p>
<h2>1. Find files using name</h2>
<pre># find /etc -name passwd</pre>
<p>Sample ouputs</p>
<pre>/etc/cron.daily/passwd
/etc/passwd
/etc/pam.d/passwd</pre>
<h2>2. Find files using name and ignoring case</h2>
<pre># find /etc -iname Passwd</pre>
<p>Sample ouputs</p>
<pre>/etc/cron.daily/passwd
/etc/passwd
/etc/pam.d/passwd</pre>
<h2>3. Find files based on file type</h2>
<p>Find only the socket files</p>
<pre># find . -type s</pre>
<p>Find all directories</p>
<pre># find . -type d</pre>
<p>Find only the normal files</p>
<pre># find . -type f</pre>
<h2>4. Find files by modification time</h2>
<pre># find . -mtime -7</pre>
<p>Sample outputs</p>
<pre>./.dbus/session-bus/c08a8197eb71b09ea24402430000000a-0
./.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys
...</pre>
<h2>5. Find Files by Size</h2>
<p>Find files bigger than 100MB</p>
<pre># find /var -size +100M</pre>
<p>Sample outputs</p>
<pre>/var/lib/mysql/ibdata1
...</pre>
<p>Find files smaller than 100MB</p>
<pre># find /var -size -100M</pre>
<p>Sample outputs</p>
<pre>/var/cache/debconf/templates.dat-old
/var/cache/debconf/passwords.dat
/var/cache/debconf/templates.dat
/var/cache/debconf/config.dat
...</pre>
<h2>6. Find files using permission</h2>
<pre># find /var -perm 777</pre>
<p>Sample outputs</p>
<pre>/var/spool/mail
/var/run/mysqld/mysqld.sock
/var/run/avahi-daemon/socket
/var/run/dbus/system_bus_socket
...</pre>
<h2>7. Find and delete</h2>
<p>Clean PHP files</p>
<pre># find . -iname "*.php" -exec rm -rf {} \;</pre>
<p>Or</p>
<pre># find . -iname "*.php" -print | xargs rm –f</pre>
<h2>8. Find all empty files</h2>
<pre># find /var -empty</pre>
<p>Sample outputs</p>
<pre>/var/opt
/var/cache/pm-utils
/var/cache/pppconfig
/var/cache/jetty
/var/cache/apt/archives/lock
...</pre>
<h2>9. Finding files only in current directory not finding on sub directories</h2>
<pre># find /etc -maxdepth 1 -name passwd</pre>
<p>Sample outputs</p>
<pre>/etc/passwd</pre>
<h2>10. Find files with different file extensions</h2>
<pre># find / -type f \( -name "*.php" -o -name "*.php5" \)</pre>
<p>Sample outputs</p>
<pre>/var/cache/dictionaries-common/sqspell.php
/var/cache/dictionaries-common/sqspell.php5
..</pre>
<g:plusone href="http://lifelinux.com/10-linux-find-command-examples/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/10-linux-find-command-examples/">10 Linux Find Command Examples</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/10-linux-find-command-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Auto Backup Server Files &#038; MySQL To FTP Server</title>
		<link>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/</link>
					<comments>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/#comments</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Tue, 23 Aug 2011 13:12:00 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup data]]></category>
		<category><![CDATA[backup mysql]]></category>
		<category><![CDATA[backup script]]></category>
		<category><![CDATA[backup service]]></category>
		<category><![CDATA[centralized storage]]></category>
		<category><![CDATA[ftp backup]]></category>
		<category><![CDATA[ftp servers]]></category>
		<category><![CDATA[gnu tar]]></category>
		<category><![CDATA[incremental backup]]></category>
		<category><![CDATA[incremental backups]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql databases]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[nas backup]]></category>
		<category><![CDATA[script generator]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[storage array]]></category>
		<category><![CDATA[tape backups]]></category>
		<category><![CDATA[tar command]]></category>
		<category><![CDATA[tar gz]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1000</guid>

					<description><![CDATA[<p>This is a simple script take to daily backup server files and MySQL databases to FTP server. Make sure you have lftp client installed. Type the following command if you are using Centos/Fedora/RedHat # yum install lftp If you are using Ubuntu/Debian # sudo apt-get install install lftp Create the folder /backup, enter # mkdir [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/">Auto Backup Server Files &#038; MySQL To FTP Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>This is a simple script take to daily backup server files and MySQL databases to FTP server. Make sure you have lftp client installed. Type the following command if you are using Centos/Fedora/RedHat</p>
<pre>
# yum install lftp
</pre>
<p><span id="more-1000"></span><br />
If you are using Ubuntu/Debian</p>
<pre>
# sudo apt-get install install lftp
</pre>
<p>Create the folder /backup, enter</p>
<pre>
# mkdir /backup
# chmod 0600 /backup
</pre>
<p>Create backup.sh file, enter</p>
<pre>
# vi /backup/backup.sh
</pre>
<p>Add the following content to backup.sh</p>
<pre>
#!/bin/bash
# Daily backup script
# Backup Server Files & MySQL
# Support backup multiple directories and multiple databases
# Copyright (c) 2010-2011 lifeLinux <http://www.lifelinux.com/>
# This script is licensed under GNU GPL version 2.0 or above

### Webserver directory
WD="/var/www/domain"

### MySQL Server Login Info ###
MUSER="root"
MPASS="MYSQL_ROOT_PASSWORD"
MHOST="localhost"
DBS="DATABASE_NAME_1 DATABASE_NAME_2"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
TAR="$(which tar)"

### Backup directory
BAK="/backup"

### FTP SERVER Login info ###
FTPU="FTP USER"
FTPP="FTP PASSWORD"
FTPS="FTP SERVER IP"
DAILY=$(date +"%u")

[ ! -d $BAK/$DAILY ] && mkdir -p $BAK/$DAILY || /bin/rm -f $BAK/$DAILY/*

for db in $DBS
do
	FILE=$BAK/$DAILY/mysql-$db.gz
	$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done

WDS=`dir $WD`

for w in $WDS
do
	FILE=$BAK/$DAILY/source-$w.gz
	$TAR -zcvf $FILE $WD/$w/* 
done

lftp -u $FTPU,$FTPP -e "mkdir $DAILY;cd $DAILY; mput $BAK/$DAILY/*; quit" $FTPS
</pre>
<p>Set cron job</p>
<pre>
# crontab -e
</pre>
<p>If you want to auto backup at 3:00AM, add the following line to crontab</p>
<pre>
00 03 * * * /backup/backup.sh > /dev/null 2>&1
</pre>
<g:plusone href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/">Auto Backup Server Files &#038; MySQL To FTP Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How To Clear Shell History On Centos / RedHat</title>
		<link>http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/</link>
					<comments>http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/#comments</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Mon, 22 Aug 2011 05:50:26 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[~/.bash_history]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[command history]]></category>
		<category><![CDATA[export LESSHISTFILE="-"]]></category>
		<category><![CDATA[history -c]]></category>
		<category><![CDATA[history command]]></category>
		<category><![CDATA[history type]]></category>
		<category><![CDATA[logout]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unset HISTFILE]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=945</guid>

					<description><![CDATA[<p>To clear shell history, type the following command: $ history -c Or remove .bash_history file $ rm -rf ~/.bash_history Turn off shell history To turn off shell history for all users, type the following command as root # echo "unset HISTFILE" >> /etc/profile To turn off shell history for a specific user, type the following [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/">How To Clear Shell History On Centos / RedHat</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>To clear shell history, type the following command:</p>
<pre>
$ history -c
</pre>
<p>Or remove .bash_history file</p>
<pre>
$ rm -rf ~/.bash_history
</pre>
<p><span id="more-945"></span></p>
<h2>Turn off shell history</h2>
<p>To turn off shell history for all users, type the following command as root</p>
<pre>
# echo "unset HISTFILE" >> /etc/profile
</pre>
<p>To turn off shell history for a specific user, type the following command</p>
<pre>
$ echo "unset HISTFILE" >> /home/USER/.bash_profile
</pre>
<h2>Display shell history</h2>
<p>To display shell history, type the following command</p>
<pre>
$ history | more
</pre>
<p>Sample outputs</p>
<pre>
74  exit
75  cd /etc/samba/
76  ll
77  vi smb.conf
78  exit
79  cd /home/site.com/scripts/
80  dir
81  cd cassandra/
82  dir
83  cd conf/
84  duir
...
</pre>
<g:plusone href="http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/">How To Clear Shell History On Centos / RedHat</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-clear-shell-history-on-centos-redhat/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How To Display vi / vim Text Editor Line Numbers</title>
		<link>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/</link>
					<comments>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Mon, 30 May 2011 02:14:50 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[display vi line nymber]]></category>
		<category><![CDATA[line numbers]]></category>
		<category><![CDATA[readability]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[Show Line Numbers In vi]]></category>
		<category><![CDATA[Show Line Numbers In vim]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[vim off line number]]></category>
		<category><![CDATA[vim on line number]]></category>
		<category><![CDATA[vim text editor]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=857</guid>

					<description><![CDATA[<p>Displaying line numbers in vi/vim can be very useful for debugging code errors and to improve overall readability of a program. For example, if we are writing C program or Shell script and want to check coding mistakes after running or compiling it, turning on or off this feature may help a lot to identify [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/">How To Display vi / vim Text Editor Line Numbers</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Displaying line numbers in vi/vim can be very useful for debugging code errors and to improve overall readability of a program. For example, if we are writing C program or Shell script and want to check coding mistakes after running or compiling it, turning on or off this feature may help a lot to identify coding problem.<br />
<span id="more-857"></span></p>
<h3>Display line numbers in vi/vim</h3>
<p>To display line numbers along the left side of a window, type any one of the following:</p>
<pre>:set nu</pre>
<p>or</p>
<pre>:set number</pre>
<p>Sample output<br />
<a href="http://www.lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png"><img class="aligncenter size-full wp-image-862" title="vi_show_line_numbers" src="http://www.lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png" alt="vi_show_line_numbers" width="500" srcset="http://lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png 641w, http://lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers-300x180.png 300w" sizes="(max-width: 641px) 100vw, 641px" /></a></p>
<h3>Hide line numbers in vi/vim</h3>
<p>To turn off line number again, type the following command:</p>
<pre>
:set nu!
</pre>
<h3>Make vi/vim show line numbers by default</h3>
<p>The vimrc files contains optional runtime configuration settings to initialize vi/vim when it starts. On Unix/Linux based systems, the file is named .vimrc. To display line numbers every time you start vi/vim, append following line to your ~/.vimrc file:</p>
<pre>
set number
</pre>
<p>Save and close the file, type</p>
<pre>
:wq!
</pre>
<g:plusone href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/">How To Display vi / vim Text Editor Line Numbers</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>10 lsof Command Examples</title>
		<link>http://lifelinux.com/10-lsof-command-examples/</link>
					<comments>http://lifelinux.com/10-lsof-command-examples/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sat, 14 May 2011 16:41:13 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[command line options]]></category>
		<category><![CDATA[fuser command]]></category>
		<category><![CDATA[grep command]]></category>
		<category><![CDATA[grep program]]></category>
		<category><![CDATA[internet connections]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux-distributions]]></category>
		<category><![CDATA[list open files]]></category>
		<category><![CDATA[ls command]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[lsof command]]></category>
		<category><![CDATA[netstat command]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[port numbers]]></category>
		<category><![CDATA[process id]]></category>
		<category><![CDATA[proto]]></category>
		<category><![CDATA[ps command]]></category>
		<category><![CDATA[running processes]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[udp]]></category>
		<category><![CDATA[UNIX]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=523</guid>

					<description><![CDATA[<p>The lsof command or &#8220;list open files&#8221; command in Linux is a powerful tool. In Linux and Unix everything behind the scenes are just files. This includes IP sockets, pipes, unix sockets, directories, devices, even inodes are just files. This means that lsof can actually tell you a lot of information of what is going [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/10-lsof-command-examples/">10 lsof Command Examples</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>The <strong>lsof command</strong> or &#8220;list open files&#8221; command in Linux is a powerful tool. In Linux and Unix everything behind the scenes are just files. This includes IP sockets, pipes, unix sockets, directories, devices, even inodes are just files. This means that lsof can actually tell you a lot of information of what is going on on your system.<span id="more-523"></span></p>
<h3>Synopsis</h3>
<pre>
lsof [ -?abChlnNOPRstUvVX ] [ -A A ] [ -c c ] [ +|-d d ] [ +|-D D ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ +|-L [l] ] [ -m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -- ] [names] 
</pre>
<h3>Example 1: Show all opened files</h3>
<p>Type the following command</p>
<pre>
lsof | more
</pre>
<p>Sample outputs</p>
<pre>
COMMAND     PID      USER   FD      TYPE     DEVICE      SIZE       NODE NAME
init          1      root  cwd       DIR      253,4      4096          2 /
init          1      root  rtd       DIR      253,4      4096          2 /
init          1      root  txt       REG      253,4     38652   41746599 /sbin/init
init          1      root  mem       REG      253,4    129900   16252964 /lib/ld-2.5.so
init          1      root  mem       REG      253,4   1693812   16252965 /lib/libc-2.5.so
init          1      root  mem       REG      253,4     20668   16253168 /lib/libdl-2.5.so
init          1      root  mem       REG      253,4    245376   16253222 /lib/libsepol.so.1
init          1      root  mem       REG      253,4     93508   16253815 /lib/libselinux.so.1
init          1      root   10u     FIFO       0,17                 1277 /dev/initctl
...
</pre>
<h3>Example 2: Show all opened internet sockets</h3>
<p>Using the -i flag lsof will list the internet sockets currently opened</p>
<pre>
lsof -i
</pre>
<p>Sample outputs</p>
<pre>
COMMAND     PID   USER   FD   TYPE   DEVICE SIZE NODE NAME
sshd       2537   root    3u  IPv6     5348       TCP *:rockwell-csp2 (LISTEN)
mysqld     2625  mysql   11u  IPv4     5463       TCP *:mysql (LISTEN)
httpd      2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
...
</pre>
<h3>Example 3: Shows all networking related to a given port 80</h3>
<pre>
lsof -i :80
</pre>
<p>Sample outputs</p>
<pre>
COMMAND   PID   USER   FD   TYPE   DEVICE SIZE NODE NAME
httpd    2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
httpd    2731 apache   58u  IPv6 39448263       TCP server.com:http->adsl-dynamic-pool-xxx.hcm.fpt.vn:23527 (ESTABLISHED)
httpd    2731 apache   60u  IPv6 39448302       TCP server.com:http->crawl-66-249-69-83.googlebot.com:35190 (ESTABLISHED)
httpd    2731 apache   61u  IPv6 39448336       TCP server.com:http->v16-13.opera-mini.net:37548 (ESTABLISHED)
httpd    2731 apache   62u  IPv6 39448388       TCP server.com:http->v16-13.opera-mini.net:37561 (ESTABLISHED)
httpd    2731 apache   64u  IPv6 39447543       TCP server.com:http->adsl.viettel.vn:13636 (FIN_WAIT2)
</pre>
<h3>Example 4: Show all TCP/UDP connections</h3>
<pre>
lsof -i TCP
</pre>
<p>Sample outputs</p>
<pre>
sshd       2537   root    3u  IPv6     5348       TCP *:rockwell-csp2 (LISTEN)
mysqld     2625  mysql   11u  IPv4     5463       TCP *:mysql (LISTEN)
httpd      2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
...
</pre>
<h3>Example 5: List open files associated with process ID</h3>
<p>The flag +p will display all open files associated with specific process ID, example with process ID is 2625</p>
<pre>
lsof +p 2625
</pre>
<p>Sample outputs</p>
<pre>
COMMAND  PID  USER   FD   TYPE     DEVICE      SIZE     NODE NAME
mysqld  2625 mysql  cwd    DIR      253,4      4096 21495811 /var/lib/mysql
mysqld  2625 mysql  rtd    DIR      253,4      4096        2 /
mysqld  2625 mysql  txt    REG      253,4   7020300 50999198 /usr/libexec/mysqld
mysqld  2625 mysql  DEL    REG      253,4           16253135 /lib/libcrypto.so.0.9.8e.#prelink#.64u8kX
mysqld  2625 mysql  mem    REG      253,4           16252984 /lib/libm-2.5.so (path inode=16253122)
mysqld  2625 mysql  DEL    REG      253,4           50996047 /usr/lib/libgssapi_krb5.so.2.2.#prelink#.YYIHuy
mysqld  2625 mysql  mem    REG      253,4           16252990 /lib/libselinux.so.1 (path inode=16253815)
mysqld  2625 mysql  mem    REG      253,4           16256252 /lib/libsepol.so.1 (path inode=16253222)
mysqld  2625 mysql  mem    REG      253,4     50848 16253138 /lib/libnss_files-2.5.so
mysqld  2625 mysql  mem    REG      253,4           16253825 /lib/librt-2.5.so (path inode=16253220)
mysqld  2625 mysql  mem    REG      253,4           16252942 /lib/ld-2.5.so (path inode=16252964)
mysqld  2625 mysql  mem    REG      253,4           50996107 /usr/lib/libstdc++.so.6.0.8 (path inode=50989584)
mysqld  2625 mysql  mem    REG      253,4           50996061 /usr/lib/libkrb5.so.3.3 (path inode=50999803)
mysqld  2625 mysql  mem    REG      253,4           16252980 /lib/libdl-2.5.so (path inode=16253168)
...
</pre>
<h3>Example 6: Show what a given user has open</h3>
<p>The flag -u will show what a given user has open</p>
<pre>
lsof -u apache
</pre>
<p>Sample outputs</p>
<pre>
COMMAND   PID   USER   FD   TYPE     DEVICE      SIZE     NODE NAME
httpd    2731 apache  cwd    DIR      253,4      4096        2 /
httpd    2731 apache  rtd    DIR      253,4      4096        2 /
httpd    2731 apache  txt    REG      253,4   3120954 51157630 /usr/local/apache/bin/httpd
httpd    2731 apache  mem    REG      253,4    375710 51157607 /usr/local/apache/lib/libaprutil-1.so.0.3.10
httpd    2731 apache  mem    REG      253,4     45432 16253184 /lib/libcrypt-2.5.so
httpd    2731 apache  mem    REG      253,4      7748 16253849 /lib/libcom_err.so.2.1
httpd    2731 apache  mem    REG      253,4      7880 16253845 /lib/libkeyutils-1.2.so
httpd    2731 apache  mem    REG      253,4    937178 51157689 /usr/local/apache/modules/mod_security2.so
httpd    2731 apache  mem    REG      253,4    129208 16253851 /lib/libpcre.so.0.0.1
...
</pre>
<g:plusone href="http://lifelinux.com/10-lsof-command-examples/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/10-lsof-command-examples/">10 lsof Command Examples</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/10-lsof-command-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find Large Files In Linux</title>
		<link>http://lifelinux.com/find-large-files-in-linux/</link>
					<comments>http://lifelinux.com/find-large-files-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Fri, 13 May 2011 15:54:44 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[find command]]></category>
		<category><![CDATA[Find files larger than a certain size]]></category>
		<category><![CDATA[Find files within specified size limits]]></category>
		<category><![CDATA[Find Large Files]]></category>
		<category><![CDATA[ls command]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=478</guid>

					<description><![CDATA[<p>Find files larger than a certain size This example finds all the files under /root directory which are larger than 50k [root@lifelinux ~]# find /root -size +50k Sample output /root/ioncube/ioncube_loader_lin_5.3_ts.so /root/ioncube/ioncube_loader_lin_4.1.so /root/ioncube/ioncube_loader_lin_5.1.so /root/ioncube/ioncube_loader_lin_4.2.so ... Find files within specified size limits Example, type the following command to limit the search to find only files with the [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/find-large-files-in-linux/">Find Large Files In Linux</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><h3>Find files larger than a certain size</h3>
<p>This example finds all the files under /root directory which are larger than 50k</p>
<pre>[root@lifelinux ~]# find /root -size +50k</pre>
<p>Sample output</p>
<pre>/root/ioncube/ioncube_loader_lin_5.3_ts.so
/root/ioncube/ioncube_loader_lin_4.1.so
/root/ioncube/ioncube_loader_lin_5.1.so
/root/ioncube/ioncube_loader_lin_4.2.so
...</pre>
<p><span id="more-478"></span></p>
<h3>Find files within specified size limits</h3>
<p>Example, type the following command to limit the search to find only files with the size of 50k to 100k</p>
<pre>[root@lifelinux ~]# find /var/log -size +50k -size -100k</pre>
<p>Sample output</p>
<pre>/var/log/secure.2
/var/log/munin/munin-node.log
/var/log/munin/munin-limits.log
...</pre>
<p>If you want to list them with ls, type the following command</p>
<pre>[root@lifelinux ~]# find /var/log -size +50k -size -100k -exec ls -lha {} \;</pre>
<p>Sample output</p>
<pre>-rw------- 1 root root 59K Apr 30 22:01 /var/log/secure.2
-rw-r--r-- 1 root root 54K May 13 23:05 /var/log/munin/munin-node.log
-rw-r--r-- 1 munin munin 94K May 13 23:05 /var/log/munin/munin-limits.log</pre>
<h3>Further readings</h3>
<p><a href="http://linux.about.com/od/commands/l/blcmdl1_find.htm">Find command</a></p>
<g:plusone href="http://lifelinux.com/find-large-files-in-linux/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/find-large-files-in-linux/">Find Large Files In Linux</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/find-large-files-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Using yum command on CentOS / RedHat</title>
		<link>http://lifelinux.com/using-yum-command-on-centos-redhat/</link>
					<comments>http://lifelinux.com/using-yum-command-on-centos-redhat/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sat, 30 Apr 2011 07:27:48 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[rhel 5]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[yum]]></category>
		<category><![CDATA[yum check]]></category>
		<category><![CDATA[yum command]]></category>
		<category><![CDATA[yum install]]></category>
		<category><![CDATA[yum list]]></category>
		<category><![CDATA[yum update]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=307</guid>

					<description><![CDATA[<p>yum is an interactive, automated update program which can be used for maintaining systems using rpm. Synopsis yum [options] [command] [package ...] The following is a list of the most commonly used yum commands: Install a package yum install [package name] Used to install the latest version of a package or group of packages. If [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/using-yum-command-on-centos-redhat/">Using yum command on CentOS / RedHat</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>yum is an interactive, automated update program which can be used for maintaining systems using rpm.</p>
<h3>Synopsis</h3>
<pre>
yum [options] [command] [package ...]
</pre>
<p><span id="more-307"></span><br />
The following is a list of the most commonly used yum commands:</p>
<p><strong>Install a package</strong></p>
<pre>
yum install [package name]
</pre>
<p>Used to install the latest version of a package or group of packages. If no package matches the specified package name(s), they are assumed to be a shell glob, and any matches are then installed.</p>
<p><strong>Update the specified packages</strong></p>
<pre>
yum update [package name]
</pre>
<p>Used to update the specified packages to the latest available version. If no package name/s are specified, then yum will attempt to update all installed packages.</p>
<p><strong>Check update</strong></p>
<pre>
yum check-update
</pre>
<p>This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available.</p>
<p><strong>Remove a package</strong></p>
<pre>
yum remove [package name]
</pre>
<p>Used to remove specified packages, along with any other packages dependent on the packages being removed.</p>
<p><strong>Determine which packages provide a specific file or feature</strong></p>
<pre>
yum provides [file name]
</pre>
<p><strong>Find any packages containing the specified keyword</strong></p>
<pre>
yum search [keyword]
</pre>
<p>This command is used to find any packages containing the specified keyword in the description, summary, packager and package name fields of RPMs in all repositories.</p>
<p><strong>For a complete list of available yum commands, refer to man yum.</strong></p>
<pre>
man yum
</pre>
<p>Sample outputs:</p>
<pre>
NAME
       yum - Yellowdog Updater Modified

SYNOPSIS
       yum [options] [command] [package ...]

DESCRIPTION
       yum  is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete pro-
       cessing based on "repository" metadata. It can also perform installation of new packages, removal of old packages and  perform  queries  on  the
       installed  and/or  available  packages  among many other commands/services (see below). yum is similar to other high level package managers like
       apt-get and smart.

       While there are some graphical interfaces directly to the yum code, more recent graphical interface development is happening with PackageKit and
       the gnome-packagekit application.

       command is one of:
        * install package1 [package2] [...]
        * update [package1] [package2] [...]
        * check-update
        * upgrade [package1] [package2] [...]
        * remove | erase package1 [package2] [...]
        * list [...]
        * info [...]
        * provides | whatprovides feature1 [feature2] [...]
        * clean [ packages | headers | metadata | dbcache | all ]
        * makecache
        * groupinstall group1 [group2] [...]
        * groupupdate group1 [group2] [...]
        * grouplist [hidden] [groupwildcard] [...]
        * groupremove group1 [group2] [...]
        * groupinfo group1 [...]
        * search string1 [string2] [...]
        * shell [filename]
        * resolvedep dep1 [dep2] [...]
        * localinstall rpmfile1 [rpmfile2] [...]
        * localupdate rpmfile1 [rpmfile2] [...]
...
</pre>
<h3>Example: Install LAMP with single command by yum</h3>
<p>Enter the following command:</p>
<pre>
yum install httpd mysql mysql-server php 
</pre>
<g:plusone href="http://lifelinux.com/using-yum-command-on-centos-redhat/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/using-yum-command-on-centos-redhat/">Using yum command on CentOS / RedHat</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/using-yum-command-on-centos-redhat/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
