Using bash command rename to rename multiple files at once

Using rename against multiple patterns on Ubuntu version=”15.04 (Vivid Vervet)”

So I had several folders of files where I wanted to rename them all cutting the cruft off the beginning and end of the file. Fortunately the part of the file that I wanted to keep was also incrementing.

Probably a thousand ways to do this but rename is so easy.

A few options to consider when using the rename command.
-v: Print names of files successfully renamed.
-n: Show what files would have been renamed.
-f: Force overwrite existing files.

The rename command uses perlexpr: Perl Expression.

The issue:

Example files:
xxxxxxxxxText01yyyyyyyyyy.zip
xxxxxxxxxText02yyyyyyyyyy.zip
xxxxxxxxxText03yyyyyyyyyy.zip

First we can do a test run by specifying the n option.
rename -n ‘s/xxxxxxxxx//g’,’s/yyyyyyyyyy//g’ *.zip
rename(xxxxxxxxxText01yyyyyyyyyy.zip, Text01.zip)
rename(xxxxxxxxxText02yyyyyyyyyy.zip, Text02.zip)
rename(xxxxxxxxxText03yyyyyyyyyy.zip, Text03.zip)

We see the results are what we are after and now what we need so to complete the rename.

rename ‘s/xxxxxxxxx//g’,’s/yyyyyyyyyy//g’ *.zip

ls -ltra
Text03.zip
Text02.zip
Text01.zip

That is about as simple as it can be.

Posted in bash, Linux | Leave a comment

Presentation ownCloud 8 Server

Presentation on ownCloud 8 installation from the March 2015 meeting of BGLUG.

Presentation included the server setup through ownCloud 8 setup.

ownCloud logo with background

This is just a place holder for the actual presentation that I did for the Bluegrass Linux User Group on ownCloud 8. Presentation saved in LibreOffice Impress format, PDF, and the actual notes that I used that night in text format.

While the notes and presentation will leave you with a running instance of ownCloud 8, I do not consider this a completed project. These notes are just a starting point to learning more about ownCloud 8, SELinux, and CentOS.

Presentation for LibreOffice Impress:
Presentation_ownCloud_Server

Presentation in PDF format:
Presentation_ownCloud_Server

Notes in text:
03-15_BGLUG_ownCloud_notes

Posted in Internet, Linux | Tagged | 1 Comment

Cryptoheros sajica

Cryptoheros sajica

A break from the Linux and tech posts to talk Tropical fish.

I recently rediscovered an old favourite Cryptoheros sajica.

According to Wikipedia:

The T-bar cichlid (Cryptoheros sajica), also known as Sajica cichlid is a Central American species of cichlid found in freshwater streams and lakes on the Pacific slope of Costa Rica. It was formerly known as Archocentrus sajica, but the taxonomy was revised as a result of a study by Juan Schmitter-Soto. The fish is tan colored with seven indistinct bars on the body. The third bar is usually prominent and coupled with a dark lateral stripe running from the gill cover results in a horizontal T-shaped mark, hence the common name of T-bar cichlid.

Males reportedly can reach up to 5 inches (12cm) in length and from what I have read it is possible to raise a group of 6 to maturity in a tank as small as 75 gallons, due to it being one of the more “peaceful member” of the Convict cichlids.

Evidently Cryptoheros sajica spawning behaviours include cave spawning and open substrate spawning.

Looking at images on Google the males can develop a nuchal hump and develop long filaments on the dorsal and anal fins.

My fish are eating just about anything. They pick at algae, eat all flake and pellets along with live baby guppies that enter the tank.

Tank temp is 76.

pH is around 7.

One of my fish at 1.5 inches:

Cryptoheros sajicaTo learn more about Cryptoheros sajica:

Posted in Tropical Fish | Tagged , | Leave a comment

CentOS 7 and Linuxacademy.com

CentOS 7 and Linuxacademy.com

centos

Just finished a nice overview course of the new CentOS 7 release over at LinuxAcademy. The course is not meant to be in depth training but at a little over two hours of training it covered a lot of the new features and difference in past releases.

Using CentOS as a desktop is not something I would normally think about but CentOS 7 has a very nice implementation of Gnome 3 that is user friendly.

Course outline:

Introduction

  • Introduction to CentOS 7

Documentation and Support Lifecycle

  • Documentation: How to Read the Freaking Manual
  • CentOS Support Lifecycle
  • CentOS and Red Hat: Enterprise Partners

Installation Considerations and Examples

  • Installation: Which Type to Choose
  • Installation: VMWare ESXi Considerations
  • Installation: Oracle VirtualBox Considerations

Fundamental Changes

  • Systemd vs. Sysvinit
  • Runlevel Management
  • Security Changes – System Defaults

Administration and Management

  • Network Adapter: Standardized Naming
  • Filesystem and Automounting: UUID Standard
  • Remote Administration: VNC as a Systemd Service

CentOS 7: Your New Desktop Environment?

  • Introducing Gnome Shell (Gnome 3)
  • Gnome Shell: Customization with Gnome Tweak Tool
  • GUI Tools for Administration

The Future of the CentOS Distribution

  • Red Hat Stewardship and Upcoming Plans

Entertaining as always and very informative.

I am a paying customer and in no other way am I associated with the LinuxAcademy.com.

Posted in Linux | Tagged , , | Leave a comment

Fedora Server 21 Beta Cockpit

Fedora Server 21 Beta Cockpit

Cockpit is a server manager from Redhat that allows easy administration of GNU/Linux servers via a web browser. Cockpit is currently enabled on the Fedora 21 Server edition beta.

Cockpit currently supports:

  • Storage administration
  • Inspecting journals
  • The starting and stopping of services
  • Network Administration
  • Monitor multiple servers at one time.
  • Includes a command line interface in the web browser.

Simple interface makes it easier for new and old administrators to get work done.

Screen shots of Cockpit:

Storage administration:

Fedora Server 21 Beta Cockpit System storage area in Cockpit

System storage area in Cockpit

Services:

Fedora Server 21 Beta Cockpit System services area in Cockpit

Fedora Server 21 Beta Cockpit System services area in Cockpit

Links to more information:

Posted in Uncategorized | Leave a comment

words symlink is broken

/usr/share/dict/words Symlink is Broken?

While doing some work from the shell with on a laptop newly loaded with Debian 7 I had trouble with use spell check.

Try running the command below and look at the output.

matthew@sysX:~$ look administrator
look: /usr/share/dict/words: No such file or directory
matthew@sysX:~$ ls -l /usr/share/dict/words
lrwxrwxrwx 1 root root 30 Jan 22 2013 /usr/share/dict/words -> /etc/dictionaries-common/words

So I look for the words file and it is not there.

matthew@mldlpt:~$ sudo ls -l /etc/dictionaries-common/words
ls: cannot access /etc/dictionaries-common/words: No such file or directory

Searching google showed this being an issue if the dictionaries-common package is installed.

matthew@sysX:~$ sudo apt-get remove dictionaries-common

Removing dictionaries-common wants to remove a lot of programs that depend on dictionaries-common so be careful. A few programs that were using this package were GIMP, Midori, and VLC.

After this your symlink to words works, but I like some of the programs that were about to be removed, and so I put them back.

So instead of removing the dictionaries-common package I thought this might be a better approach.

Find the installed dictionaries.

matthew@sysX:~$ locate american-english
/usr/share/dict/american-english
/usr/share/man/man5/american-english.5.gz

Unlink the current words link.

matthew@sysX:~$ sudo unlink usr/share/dict/words

Create the new symlink.

matthew@sysX:~$ sudo ln -s /usr/share/dict/american-english /usr/share/dict/words

And now my commands work and I have not experienced any downsides.

matthew@sysX:~$ look administrator
administrator
administrator’s
administrators

My system:

matthew@sysX:~$ cat /etc/os-release
PRETTY_NAME=”Debian GNU/Linux 7 (wheezy)”
NAME=”Debian GNU/Linux”
VERSION_ID=”7″
VERSION=”7 (wheezy)”
ID=debian
ANSI_COLOR=”1;31″
HOME_URL=”http://www.debian.org/”
SUPPORT_URL=”http://www.debian.org/support/”
BUG_REPORT_URL=”http://bugs.debian.org/”

Posted in bash, Computers, Linux | Leave a comment

modprobe vboxdrv failed

What is “modprobe vboxdrv failed. Please use ‘dmesg’ to find out why”?

Recently while updating my personal servers I found that I could not access my virtual machines through phpVirtualBox.

I was able to enter the user ID and password but I then received an error about Exception Object which is shown below.

modprobe vboxdrv failed. Please use 'dmesg' to find out why

phpvirtualbox_erorr

 

 

 

 

 

 

 

 

Strange, I have not seen this error before, and my searches on Google were returning that there was an issue with php’s config file.

So off to the command line where I looked at the config file and it appeared to be OK. I had a backup of the config file for php. So I compared the backup to the current file which showed the files were the same.

A few more searches with Google kept leading me to same results. I thought to myself that my Google search skills must be getting weak, or I was just missing something.

So I went to the command line and found that vboxdrv service was not running and I tried to start the service:

service vboxdrv start
Starting VirtualBox kernel modules           [FAILED]
(modprobe vboxdrv failed. Please use ‘dmesg’ to find out why)

So I issued the dmesg command which showed nothing and it was here that it dawned on me that the last round of updates also included a kernel update.

The fix is to recompile.

/etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                        [  OK  ]
Recompiling VirtualBox kernel modules                  [  OK  ]
Starting VirtualBox kernel modules                         [  OK  ]
[root@main ~]# service vboxdrv start
Starting VirtualBox kernel modules                         [  OK  ]
[root@main ~]# shutdown -r now

And now I can log into phpVirtualBox and see my virtual machines.

Posted in Internet, Linux, Web Development | Leave a comment

Linux Online Education

Linux Online Education

I have been looking at different opportunity’s for a Linux online education and have recently started taking courses over at Linux Academy. I also want to state that I am a paying customer and did not receive any compensation for this post.

About Linux Academy:

The Linux Academy provides hundreds of comprehensive step-by-step training videos on Linux, Python, and Android. Our Linux courses will help you on your journey from beginner to Linux Professional in no time! Our courses are geared to prepare you for the Linux+ and LPIC Certifications. If your tastes go beyond just Linux, you can branch out into Python and Android Development, all for the same basic subscription!

I like Linux Academy’s overall layout, and all of the course material is on topic and well done.Linux Online Education

The main courses are broken into several subjects, which contain videos, exercises and course notes, some of which you can download.

While watching the course videos you can and should follow along using a real server that Linux Academy provides.

When I did have concerns with the course material, I was able to place a support request and the response to my questions were addressed in a timely manner.

An online forum is also available where other “students” and staff will respond to your questions and concerns which is another big plus.

Some of the courses offered by Linux Academy:

  • Introduction To Linux (Run Linux As Your Desktop)
  • Linux+ LPIC Level 1 Exam 101
  • Linux+ LPIC Level 1 Exam 102
  • LPIC Level 2 Exam 201
  • AWS Certified Solutions Architect – Associate Level
  • AWS Certified Developer – Associate Level
  • AWS Certified SysOps Administrator – Associate Level
  • Introduction To Python On Linux
  • Introduction To VMware ESXi

As you can see the courses provided are varied and cover current topics.

So far I have completed the following courses:

Looking for Linux Online Education has been a challenge, and while there are really good free sites available I  think the money spent on Linux Academy is worth every penny.

So go ahead and start your Linux online education. Linux Academy offers a $1.00 fourteen day trial to get you started.

Posted in Education, Internet, Linux | Tagged , | Leave a comment

Install FreeBSD on KVM

Install FreeBSD on KVM

These are my notes on how to install FreeBSD on KVM.

My notes on how to install FreeBSD on KVM. The following is how I was able to get a FreeBSD 10 server up and running on KVM.

Download an ISO from the FreeBSD Project’s ftp site.

FreeBSD

FreeBSD

Create your disk.

dd if=/dev/zero of=/var/lib/libvirt/images/FreeBSD1.qcow2 bs=1M count=12288

This is the command that I used to create the VM.

virt-install \
–name=freebsd \
–file=/var/lib/libvirt/images/FreeBSD1.qcow2 \
–file-size=12 \
–nonsparse \
–graphics spice \
–vcpus=1 \
–ram=1024 \
–cdrom=/home/matthew/Downloads/FreeBSD-10.0-RELEASE-amd64-disc1 \
–network bridge=virbr0 \
–os-type bsd \
–os-variant=freebsd \

First we need to check for updates.
freebsd-update fetch
We should see this output which will end up outputing the packages to update to the console:
freebsd-update fetch
Looking up update.FreeBSD.org mirrors… 5 mirrors found.
Fetching public key from update2.freebsd.org… done.
Fetching metadata signature for 10.0-RELEASE from update2.freebsd.org… done.
Fetching metadata index… done.
Fetching 2 metadata files… done.
Inspecting system… done.



The following files will be updated as part of updating to 10.0-RELEASE-p7:
/bin/freebsd-version
/boot/kernel/ciss.ko
/boot/kernel/ciss.ko.symbols


Now to actually apply the updates.
freebsd-update install
Installing updates… done.

Now we should now have a server running FreeBSD 10, but what to do with the server will be for another time.

More information on FreeBSD can be found on their home page.

Posted in Internet, Technology, Unix | Leave a comment

Install LXQt on OpenSUSE 13.1

Install LXQt on OpenSUSE 13.1

What is LXQt?

LXQt is the Qt port and the upcoming version of LXDE, the Install LXQt OpenSuseLightweight Desktop Environment. It is the product of the merge between the LXDE-Qt and the Razor-qt projects: A lightweight, modular, blazing-fast and user-friendly desktop environment.

How to install LXQt on OpenSUSE 13.1.

First create the repo file /etc/zypp/repos.d/LXDE-QT.repo

 

You can do this with the zypper command.
zypper ar -f http://download.opensuse.org/repositories/X11:/lxde:/lxqt/openSUSE_13.1/

Or manually create the file:

vim etc/zypp/repos.d/LXDE-QT.repo and add:

[X11_lxde_lxqt]
name=QT porting of the famous LXDE Desktop Environment (openSUSE_13.1)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/X11:/lxde:/lxqt/openSUSE_13.1/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/X11:/lxde:/lxqt/openSUSE_13.1/repodata/repomd.xml.key
enabled=1

Now to actually install LXQt.

First update the system:
zypper refresh

Now install LXQT:
zypper in -t pattern lxde-qt

Explanation of the command above:

  • in = install.
  • -t = type of package.
  • pattern = group of packages required or recommended to install some functionality.

Now you can log out of your current session and then at the login prompt choose LXQt and then log back into your computer.

I was prompted to setup wireless and then setup power management. After that it has been pretty smooth.

So far CPU utilization stays low and memory usage is less than 1 GB. Swap use has been 0.

References:

Posted in Linux | Tagged , | 4 Comments