Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, October 29, 2008

Create a Tar File of current Directory and Sub Directories


Create a tar file of current directory and all sub directories:


Just give the name of the directory to tar. For example, suppose you want to create a tar file for all the files (including all subdirectories) in the directory called myfiles. Give this command from the directory that contains myfiles:
Code:
tar cvf myfiles.tar myfiles

The find command is used to create a list of all the file names that end in .tex. The --files-from argument to tar is then used; this tells tar to only archive those files listed in /tmp/texfilenames.


To check the list of files in the tar file, you can use the t option. For example,

Code:
tar tf myfiles.tar | less 


Search for files and archive only select ones from a list in a file:


Code:
find myfiles -name "*.tex" > /tmp/texfilenames
tar cvf myfiles.tar --files-from /tmp/texfilenames

Sunday, October 12, 2008

Useful Ubuntu commands

Here are some of useful commands that I have come across:

List installed packages / Easy Restore



Create a list of installed packages:

Code:
dpkg --get-selections > installed-software
And if you wanted to use the list to reinstall this software on a fresh ubuntu setup,

Code:
dpkg --set-selections <> 
followed by

Code:
dselect