May 232014
 

Fedora 17 – Install Scanner

Fedora’s live KDE disk does not ship with any scanning software.  There are two very useful programs that I use for scanning, depending on what I am scanning.

Xsane
The most flexible scanning software available.  Xsane gives you fine grain control over scanning.  One very handy feature is the ability to batch scan multiple areas of your scanner, which is great for scanning photos using time-consuming high resolution settings.

Simple-scan
Just as the name indicates.  A very simple scanner.  Place document, hit scan, and go.  The one very nice feature of simple-scan is the ability to batch scan several sheets into a single PDF file, provided you have the hardware to do so.  Many multifunction printers have an automatic document feeder feature

Sane

Before any scanning software can be used, the backend that controls the scanner must be installed.  Sane, an acronym for Scanner Access Now Easy, is just that.  Install it, and go.  Any sane compatible scanner will work.  I’ve had success with HP MFC printers, and I have a Canon scanner.  Both work with no issues, including the wireless HP MFC printer!

As root,


yum -y install sane-backends-drivers-scanners
sane-find-scanner


You may find it necessary to unplug and re-plug in the USB cable to your scanner before trying one of the below scanning programs.

Xsane

As root, with your USB scanner attached and powered up


yum -y install xsane


Simple Scan

As root,


yum -y install simple-scan


Source
 

Sep 082013
 

Some systemctl examples to control the Linux system services:

To Stop a service
[root@server ~#]systemctl stop <daemon>.service

Restart a service [root@server ~#]systemctl restart <daemon>.service
Reload a service [root@server ~#]systemctl reload <daemon>.service
Status of a service [root@server ~#]systemctl status <daemon>.service
Display all service/daemon status [root@server ~#]systemctl -a                (type "q" for quit)
Add a service to startup [root@server ~#]systemctl enable <daemon>.service
Remove a service from startup [root@server ~#]systemctl disable <daemon>.service
Shutdown and halt the system [root@server ~#]systemctl halt
Shutdown and poweroff the system [root@server ~#]systemctl poweroff
Shutdown and reboot the system [root@server ~#]systemctl reboot
Jun 292013
 
Automounting a Windows Share from Linux:
$ mkdir /mnt/linuxDirectory
$ mkdir -p /root/projects/cifs/
$ vi /root/projects/cifs/mount.txt
username=windowsUserName
password=windowsPassword
$ vi /etc/fstab
//windows.machine/volume/or/path/to/folder /mnt/linuxDirectory cifs auto,users,credentials=/root/projects/cifs/mount.txt,domain=windowsDomain,file_mode=0600,dir_mode=0700,uid=linuxUser,gid=linuxUser
$ mount /mnt/linuxDirectory
$ ls /mnt/linuxDirectory
Aug 182012
 
General Startup
	To use vi: vi filename
	To exit vi and save changes: ZZ   or  :wq
	To exit vi without saving changes: :q!
	To enter vi command mode: [esc]

Counts
        A number preceding any vi command tells vi to repeat
	that command that many times.

Cursor Movement

	h       move left (backspace)

	j       move down

	k       move up

	l       move right (spacebar)

	[return]   move to the beginning of the next line

	$       last column on the current line

	0       move cursor to the first column on the
		current line

	^       move cursor to first nonblank column on the
		current line

	w       move to the beginning of the next word or
		punctuation mark

	W       move past the next space

	b       move to the beginning of the previous word
		or punctuation mark

	B       move to the beginning of the previous word,
		ignores punctuation

        e       end of next word or punctuation mark

        E       end of next word, ignoring punctuation

        H       move cursor to the top of the screen 

        M       move cursor to the middle of the screen

        L       move cursor to the bottom of the screen 

Screen Movement

       G        move to the last line in the file

       xG       move to line x

       z+       move current line to top of screen

       z        move current line to the middle of screen

       z-       move current line to the bottom of screen

       ^F       move forward one screen

       ^B       move backward one line

       ^D       move forward one half screen

       ^U       move backward one half screen

       ^R       redraw screen
		( does not work with VT100 type terminals )

       ^L       redraw screen
		( does not work with Televideo terminals )

Inserting

       r        replace character under cursor with next
		character typed

       R        keep replacing character until [esc] is hit

       i        insert before cursor

       a        append after cursor

       A        append at end of line

       O        open line above cursor and enter append mode

Deleting

	x       delete character under cursor

	dd      delete line under cursor

        dw      delete word under cursor

        db      delete word before cursor

Copying Code

        yy      (yank)'copies' line which may then be put by
		the p(put) command. Precede with a count for
		multiple lines.

        :t.     will duplicate the line.

        :t 7    will copy it after line 7.

        :,+t0   will copy current and next line at the
        beginning of the file.

        :1,t$   will copy lines from beginning of the file
        to the current cursor position, to the end of the file.

Put Command
        brings back previous deletion or yank of lines,
	words, or characters

        P       bring back before cursor

        p       bring back after cursor

Find Commands

	?       finds a word going backwards

	/       finds a word going forwards

        f       finds a character on the line under the
		cursor going forward

        F       finds a character on the line under the
		cursor going backwards

        t       find a character on the current line going
		forward and stop one character before it

	T       find a character on the current line going
		backward and stop one character before it

	;	repeat last f, F, t, T

Find and Replace Commands

        :%s/hello/goodbye/g   find hello and replace with goodbye

        :%s/^\(.*\)\n\1$/g    delete duplicate lines

        :%s/\n/ /g            join lines together

Miscellaneous Commands

	.	repeat last command

	u	undo last command issued

	U	undoes all commands on one line

	xp	deletes first character and inserts after
		second (swap)

	J	join current line with the next line

	^G	display current line number

	%	if at one parenthesis, will jump to its mate

	mx	mark current line with character x

	'x	find line marked with character x

	NOTE: Marks are internal and not written to the file.

Line Editor Mode
	Any commands from the line editor ex can be issued
	upon entering line mode.

	To enter: type ':'

	To exit: press[return] or [esc]

ex Commands
	For a complete list consult the
	UNIX Programmer's Manual

READING FILES
	copies (reads) filename after cursor in file
	currently editing

	:r filename

WRITE FILE
	:w 	saves the current file without quitting
	:20,40w filename write the contents of the lines numbered 20 through 40 to
	a new file named filename
MOVING

	:#	move to line #

	:$	move to last line of file

SHELL ESCAPE
	executes 'cmd' as a shell command.

	:!'cmd'

Source:
Jul 202012
 

As simple and straightforward as they may seem, text files still harbor an opportunity for compatibility problems. Different operating systems have traditionally used different ways to indicate line endings (line breaks). Mac OS has traditionally used the Carriage Return character (ASCII chcracter 13, aka CR or ^M) to indicate line breaks; unix has traditionally used the Line Feed character (ASCII 10, aka LF or ^J). Since Mac OS X derives from both heritages, it winds up using a mix of the two in various contexts. But most command line utilites only understand (and produce) files with unix-style breaks.Just to make things even more fun, there’s actually a third variant: MS-DOS its successors use a carriage return followed by a line feed to indicate a line break. Few Macintosh programs will generate such files, but if you need to deal with a file that came from a PC, you’ll probably want to convert it to a more native format on the Mac.

Fortunately, it’s fairly easy to convert the formats back and forth on the command line. Here are some examples of how to transform files back and forth:

tr '\r' '\n' <macfile.txt >unixfile.txt
convert the Mac-format file macfile.txt to unix format, and save
the result as unixfile.txt. tr is a program that does character
substitution, and in this case it's simply being used to replace
CR (written \r on the command line) with LF (written \n)
throughout the file.

tr '\r' '\n' <macfile.txt | grep fnord
convert the Mac-format file macfile.txt to unix format, then use
grep to search the file for the word "fnord". (Note: grep doesn't
understand Mac-style line breaks.)

tr '\n' '\r' <unixfile.txt >macfile.txt
convert the unix-format file unixfile.txt to Mac format, and save
the result as macfile.txt.

perl -p -e 's/\r/\n/g' macfile.txt >unixfile.txt
convert the Mac-format file macfile.txt to unix format, and save
the result as unixfile.txt. This is functionally identical to the
first example, but since perl is actually a very general
programming language, it can also do some other useful things...
BTW, he -e means the program will be the next thing on the command
line ('s/\r/\n/g' - perlese for replace all \r's with \n's), and
the -p means do this for each line of the file.

perl -pi -e 's/\r/\n/g' textfile.txt
convert the file textfile.txt from Mac-style (CR) line breaks to
unix-style (LF), and replace the original file with the converted
version (that's what the -i means).

perl -pi -e 's/\r\n?/\n/g' textfile.txt
convert the file textfile.txt from Mac-style (CR) or PC-style
(CRLF) line breaks to unix-style (LF), and replace the original
file.

perl -pi -e 's/\r\n?/\n/g' *.txt
convert all text files (or rather, files with .txt extensions)
in the current directory to unix-style breaks. Note that any that
were already in unix format will not be changed.

perl -pi -e 's/\n/\r/g' textfile.txt
convert the file textfile.txt from unix-style (LF) line breaks to
Mac-style (CR), and replace the original file. Source

Source
Sep 072010
 

POSIXExpressions-CharacterClasses

#!/bin/bash

#Make sure there are two arguments entered on the command line.
if [ $# -ne 2 ]
then
    echo “Error in $0 – Invalid Argument Count”
    echo “Error in $0 – Need two arguments”
    echo “Example Syntax: $0 input_file output_file”
    exit
fi

#Check if a file exists
if [ ! -f $infile ]
then
echo “Input file [$infile] not found – Aborting”
exit
fi