<?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>Linux Explore &#187; tar</title>
	<atom:link href="https://blog.linuxexplore.com/tag/tar/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.linuxexplore.com</link>
	<description>Exploring Linux</description>
	<lastBuildDate>Mon, 07 Apr 2014 00:30:50 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>More Helpful Commands in Linux</title>
		<link>https://blog.linuxexplore.com/2012/08/24/more-helpful-commands-in-linux/</link>
		<comments>https://blog.linuxexplore.com/2012/08/24/more-helpful-commands-in-linux/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 19:26:36 +0000</pubDate>
		<dc:creator><![CDATA[linuxexplore]]></dc:creator>
				<category><![CDATA[Linux Explore Tips & Tricks]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[backdrop image]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[command line tools]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[enterprise-it]]></category>
		<category><![CDATA[inkscape]]></category>
		<category><![CDATA[intowire]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[KStars]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Administrator]]></category>
		<category><![CDATA[Linux hacks]]></category>
		<category><![CDATA[Linux Howto]]></category>
		<category><![CDATA[Linux Tips]]></category>
		<category><![CDATA[Linux Tricks]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[SVG file]]></category>
		<category><![CDATA[tar]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://linuxexplore.wordpress.com/?p=609</guid>
		<description><![CDATA[A backdrop of stars Difficulty: Easy Application: KStars You may already have played with KStars, but how about creating a KStars backdrop image that&#8217;s updated every time you start up? KStars can be run with the &#8211;dump switch, which dumps out an image from your startup settings, but doesn&#8217;t load the GUI at all. You&#8230;]]></description>
				<content:encoded><![CDATA[<h2>A backdrop of stars</h2>
<ul>
<li>Difficulty: Easy</li>
<li>Application: KStars</li>
</ul>
<p>You may already have played with KStars, but how about creating a KStars backdrop image that&#8217;s updated every time you start up?</p>
<p>KStars can be run with the &#8211;dump switch, which dumps out an image from your startup settings, but doesn&#8217;t load the GUI at all. You can create a script to run this and generate a desktop image, which will change every day (or you can just use this method to generate images).</p>
<p>Run KStars like this:</p>
<pre>kstars --dump --width 1024 --height 768 --filename = ~/kstarsback.png</pre>
<p>You can add this to a script in your ~/.kde/Autostart folder to be run at startup. Find the file in Konqueror, drag it to the desktop and select &#8216;Set as wallpaper&#8217; to use it as a randomly generated backdrop.</p>
<h2>Open an SVG directly</h2>
<ul>
<li>Difficulty: Easy</li>
<li>Application: Inkscape</li>
</ul>
<p>You can run Inkscape from a shell and immediately edit a graphic directly from a URL. Just type:</p>
<pre>inkscape <a href="http://www.somehost.com/graphic.svg" rel="nofollow">http://www.somehost.com/graphic.svg</a></pre>
<p>Remember to save it as something else though!</p>
<h2>Editing without an editor</h2>
<ul>
<li>Difficulty: Intermediate</li>
<li>Application: Various</li>
</ul>
<p>Very long files are often hard to manipulate with a text editor. If you need to do it regularly, chances are you&#8217;ll find it much faster to use some handy command-line tools instead, like in the following examples.</p>
<p>To print columns eg 1 and 3 from a file file1 into file2, we can use awk:</p>
<pre>awk '{print $1, $3}' file1 &gt; file2</pre>
<p>To output only characters from column 8 to column 15 of file1, we can use cut:</p>
<pre>cut -c 8-15 file1 &gt; file2</pre>
<p>To replace the word word1 with the word word2 in the file file1, we can use the sed command:</p>
<pre>sed "s/word1/word2/g" file1 &gt; file2</pre>
<p>This is often a quicker way to get results than even opening a text editor.</p>
<h2>Backup selected files only</h2>
<ul>
<li>Difficulty: Intermediate</li>
<li>Application: tar</li>
</ul>
<p>Want to use tar to backup only certain files in a directory? Then you&#8217;ll want to use the -T flag as follows. First, create a file with the file you want to backup:</p>
<pre>cat &gt;&gt; /etc/backup.conf
# /etc/passwd
# /etc/shadow
# /etc/yp.conf
# /etc/sysctl.conf
EOF</pre>
<p>Then run tar with the -T flag pointing to the file just created:</p>
<pre>tar -cjf bck-etc-`date +%Y-%m-%d`.tar.bz2 -T /etc/backup.conf</pre>
<p>Now you have your backup.</p>
<p><a href="http://www.intowire.com/iWiRE/blog/view/57463/more-helpful-commands-in-linux#.UDZyp9Pzxw4.wordpress">Read more&#8230;&#8230;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.linuxexplore.com/2012/08/24/more-helpful-commands-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>File encryption/decryption Linux</title>
		<link>https://blog.linuxexplore.com/2011/01/20/file-encryptiondecryption-linux/</link>
		<comments>https://blog.linuxexplore.com/2011/01/20/file-encryptiondecryption-linux/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 18:12:35 +0000</pubDate>
		<dc:creator><![CDATA[linuxexplore]]></dc:creator>
				<category><![CDATA[Linux Explore How to]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[Linux Howto]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[password on tar file]]></category>
		<category><![CDATA[tar]]></category>
		<category><![CDATA[tar with encryption]]></category>
		<category><![CDATA[tar with password]]></category>

		<guid isPermaLink="false">http://linuxexplore.wordpress.com/?p=333</guid>
		<description><![CDATA[Openssl is one of the best tools which can be used to encrypt/decrypt files. You can password protect your important data to avoid misuse. To encrypt your files use the command: openssl des3 -salt -in $FILENAME -out ${FILENAME}.des3 To decrypt the file use the command: openssl des3 -d -salt -in ${FILENAME}.des3 -out ${FILENAME} You can&#8230;]]></description>
				<content:encoded><![CDATA[<p>Openssl is one of the best tools which can be used to encrypt/decrypt files. You can password protect your important data to avoid misuse.</p>
<p>To encrypt your files use the command:</p>
<pre>openssl des3 -salt -in $FILENAME -out ${FILENAME}.des3</pre>
<p>To decrypt the file use the command:</p>
<pre>openssl des3 -d -salt -in ${FILENAME}.des3 -out ${FILENAME}</pre>
<p>You can also use my script ‘tarcrypt.sh’ to encrypt/decrypt files. This script is using tar to compress/decompress with encryption/decryption functionality.</p>
<pre>#!/bin/sh
#
# 'tarcrypt.sh' script can used to compress/decompress the data with encryption.
#
# This script is created &amp; tested by Rahul Panwar.
# WARNING!!! Use it at your own risk.
# Please report the bugs or queries to panwar.rahul@gmail.com

VERSION="Version 1.1.0.1nCreated by: Rahul Panwar"
PASS=""
PASS_OPTION=""
EXT_OPTION=""
COMP_FILE="encrypted_file"

DATA_FILES_ALL=""

# Usage
usage ()
{
	echo "Usage:"
	echo "	${0##*/} -c " [  ... "  [-p ]"
	echo "	${0##*/} -x  [-C ] [-p ]"
	echo "	${0##*/} -h"
	echo "	${0##*/} -v"
	echo "OPTIONS:"
	echo "	-c|--compress	: Compress and encrypt the file(s) or directory(ies)
					for multiple files use double quotes (for example "file1 file2 dir1")."
	echo "	-x|--decompress	: Decrypt and uncompress the file"
	echo "	-p|--password	: Password to encrypt/decrypt the file"
	echo "	-C|--extract	: Change directory, to extract the compressed file, default is current directory"
	echo "	-h|--help	: To see this help"
	echo "	-v|--version	: Check the version"
}
[ $# = 0 ] &amp;&amp; usage &amp;&amp; exit 1

# to encrypt files using openssl
encrypt_file()
{
	FNAME=$1

	#openssl des3 -salt -in "$FNAME" -out "$FNAME.des3"
	openssl des3 -salt -out "$FNAME" ${PASS_OPTION}
}

# to decrypt the files using openssl
decrypt_file()
{
	FNAME=$1

	#openssl des3 -d -salt -in "$FNAME" -out "${FNAME%.[^.]*}"
	openssl des3 -d -salt -in "$FNAME" ${PASS_OPTION}
}

# compress and encrypt the files
en_comp()
{
	tar -czp ${DATA_FILES} | encrypt_file ${COMP_FILE}
}

# decrypt and uncompress the files
de_comp()
{
	decrypt_file ${COMP_FILE} | tar ${EXT_OPTION} -xz
}

# main function
main_function()
{
	compress=""
	decompress=""
	extract=""
	password=""
	while test "$1" != "" ; do
		OPT=$1
		OPT_VAL1=$2
		OPT_VAL2=$3
		case "$OPT" in
			--compress|-c)
				DATA_FILES_ALL="${OPT_VAL1}"
				[ ! "${OPT_VAL2}" ] &amp;&amp; echo -e "No encrypt filename, using default name: ${COMP_FILE}"
				COMP_FILE=${OPT_VAL2:-$COMP_FILE}
				compress=1
				shift
				[ "$OPT_VAL2" ] &amp;&amp; shift
			;;
			--decompress|-x)
				COMP_FILE=${OPT_VAL1:-$COMP_FILE}
				decompress=1
				shift
			;;
			--password|-p)
				PASS=${OPT_VAL1}
				[ "$PASS" ] &amp;&amp; password=1 &amp;&amp; PASS_OPTION="-pass pass:${PASS}"
				shift
			;;
			--extract|-C)
				[ ! -d "$OPT_VAL1" ] &amp;&amp; echo -e "Extract directory not exists" &amp;&amp; exit 1
				EXT_OPTION="-C ${OPT_VAL1:-$PWD}"
				extract=1
				shift
			;;
			--help|-h)
				usage
				exit 0
			;;
			--version|-v)
				echo -e "${VERSION}"
				exit 0
			;;
			-*)
				echo "Error: no such option $OPT"
				usage
				exit 1
			;;
			*)
				echo -e "Error: invalid option $OPT"
				usage
				exit 1
		esac
		shift
	done

	if [ "$compress" ] &amp;&amp; [ "$decompress" ]; then
		echo -e "n-c and -x can't be used simultaneouslyn" &amp;&amp; usage &amp;&amp; exit 1
	elif [ "$extract" ] &amp;&amp; [ "$compress" ]; then
		echo -e "n-C can only use with -x optionn" &amp;&amp; usage &amp;&amp; exit 1
	fi
}

main_function "$@"
if [ "$compress" ]; then
	for FILES in ${DATA_FILES_ALL}; do
		[ -e "${FILES}" ] &amp;&amp; DATA_FILES="${DATA_FILES} ${FILES}"
	done
	if [ ! "${DATA_FILES}" ]; then
		echo -e "No file(s) found to compress" &amp;&amp; exit 2
	fi
	echo "==&gt; compressing"
	en_comp &amp;&gt;/dev/null &amp;&amp; echo "success" || echo "failure"
elif [ "$decompress" ]; then
	[ ! -e "${COMP_FILE}" ] &amp;&amp; echo -e "No file to decrypt" &amp;&amp; exit 2
	echo "==&gt; decompressing"
	de_comp &amp;&gt;/dev/null &amp;&amp; echo "success" || echo "failure"
fi</pre>
<p>If you found any bug in the script, please write your comment. I like to improve this, so suggestions are most welcome.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.linuxexplore.com/2011/01/20/file-encryptiondecryption-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
