Archive for the ‘Linux’ Category

Linux move migrate user info or transfer a copy of “/” tree

Wednesday, January 13th, 2016

Users from the command line:

adduser techmint -G users,<othergroups>
deluser username
addgroup groupname
adduser username newgroup

System backup

This article is about using rsync to transfer a copy of your “/” tree, excluding a few select folders. This approach is considered to be better than disk cloning with dd since it allows for a different size, partition table and filesystem to be used

… … …

This command depends on brace expansion available in both the bash and zsh shells. When using a different shell, --exclude patterns should be repeated manually.
# rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder

Using the -aAX set of options, the files are transferred in archive mode, ensuring that symbolic links, devices, permissions and ownerships, modification times, ACLs and extended attributes are preserved.

The --exclude option will cause files that match the given patterns to be excluded. The contents of /dev, /proc, /sys, /tmp and /run were excluded because they are populated at boot (while the folders themselves are not created), /lost+found is filesystem-specific. Quoting the exclude patterns will avoid expansion by shell, which is necessary e.g. when backing up over SSH. Ending the excluded paths with * will still ensure that the directories themselves are created if not already existing.

Be aware that you will need a Linux compatible file system, eg: ext4 to maintain symlinks etc, when using the -aAX options.

Copy old user to new user

sudo adduser newuser

sudo usermod -a -G adm,users newuser

sudo cp -av /home/olduser/. /home/newuser/

<or   rsync -aP /home/olduser/. /home/newuser/  >

sudo chown -R –from=olduser newuser:newuser /home/newuser

(logout and in again to see new group permissions active)

find -name "*foo*.filetype" -exec rename 's/foo/bar/' {} ";"

find /folder/. -name bar -type d -execdir mv {} baz \;

-execdir changes directory to the parent before executing the command, so the mv here will be local to each parent directory.

linux fax server

Wednesday, January 13th, 2016
hylafax free fax server
Using the hylafax server via web site

PDF bookmarks export to index

Saturday, January 2nd, 2016

I occasionally need to create an index from the bookmarks of a PDF. Here are the steps  I took.

First I used bates stamping to give my original document page numbers. I use PDF-Xchange Editor (paid) which includes bates stamping. There are other alternatives to create the page numbering.

Download jpdbookmarks and extract the whole folder (there is no need to install). I just put my extracted folder on the desktop

For MS Windows, run jpdfbookmarks.exe — for Linux or other see documentation in the folder

Within jpdbookmarks, open the document that has the bookmarks you want to convert to an index.

On the menu bar select <Tools/Dump> which will dump the bookmarks into a text file. Once that is done you can close jpdbookmarks.

Open the resulting text file (I named mine index.txt) in Scite (or some other text program that allows regex search and replace).

This is an example of one line from the text file:

Nonprofit Board Governance/1,Black,notBold,notItalic,open,TopLeftZoom,87,91,0.0

The number just after the forward slash is the page number the bookmark would go to. The other information to the right of that is irrelevant for my index.

Within Scite I use the find and replace tool with regular expressions.

First I replace the forward slash with a tab.

Pay attention to the checked boxes as well as the Find What and Replace with. Click on Replace All.

scite replace forward slash

Next I want to get rid of the extraneous information — from the comma after the page number to the end of the line.

scite replace other info

Now I have a nice text file with the bookmark name and the relevant page number.

I copied the text from Scite, then I went into Libre Writer, pasted, and used a tab stop that included dots (actually, I used the special character elipsis because it has a little more spacing than the default dot). Finished formatting in Writer and then saved as a pdf, inserted that pdf into my original pdf to have an index page.


Running VB.NET applications on Linux using Mono

Thursday, December 17th, 2015

Linux remote management

Thursday, December 17th, 2015

dsh allows a user to run commands over multiple machines