bash

Downgrade to previous version: yum

Posted on

Sometime yum update just breaks everything. We experienced this, and had to go backup to previous versions. In RHEL6 and RHEL7 you can run this command:

which will give you a list of transactions ID’s. Now you just need to figure out how far you want to go back in the history, and do […]

Linux

Openstack – new volume

Posted on

I have managed to create my first server in an openstack enviroment here at university of Bergen. I can see my instance in the Dashboard: Next thing was to add a volume: Project -> Compute -> Volumes: Create Volume After creating it, I had to go to “Manage Attachments”, and in Manage Volumen Attachments, I […]

bash

Match email address

Posted on

If you have a file with several lines that contains email addresses that you like to extract, you can do that with Linux grep command: File “emails.txt”: somestreng anotherstring 342345 somename.lastname@domain.com where somename.lastname@domain.com is the string you like to extract: you can do this with: grep -EiEio ‘\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b’ emails.txt Result: somename.lastname@domain.com

Git

git-cola in Windows 7

Posted on

I have Windows 7 on my computer, but needed to run a git gui tool for our project. Searching on Google I found several, but they all were software for Linux. We have plenty of Linux Redhat servers, but no one running X window. I installed then a Xming X server (http://sourceforge.net/projects/xming/) on my Windows […]

bash

Searching in Excel files

Posted on

I had to find a specific Microsoft Spreadsheet among thousands of files on a mapped network drive O: on a Windows 7 Computer. The problem was that searching and indexing was only performed on local disk like C: and D: so I could only search for keyword in local Excel files. It is not optimal, […]

bash

Postgresql 9.1 BACKUP DUMP BASH script

Posted on

We wrote an improved postgresql dump bash script for Postgresql version 9.1. This one will save each dump file with the name: database_name_DAYNAME.sql.bz2 In this way, we would only have 7 backups at any time, because each file will be overwritten after seven days. Since our backup system (TSM) saves 7 versions of each file, […]

bash

Mysql SQL in bash one-liner

Posted on

If you just need a quick way to get some data from a mysql database in your shell (bash), you could do something like this in one line:

If you don’t like to scroll: -bash-3.2$ mysql -h your.server.edu -u db_username -pcat /path/to/your/homedir/secretpasswordfile -e “use databasename; SELECT tablename.columnname FROM tablename where id like ‘421111’ and […]

bash

Check http headers with wget

Posted on

If you want to see the http headers from your shell, you can do it with:   wget –no-check-certificate –server-response –spider https://yourwebsite.something The result would be something like:

Linux

rdesktop from Linux

Posted on

You can easily access your Windows computer desktop from a Linux computer with the tool rdesktop:

where -k no specify that the keyboard is norwegian -z to compress -p- prompt for password before connecting -f full screen (to quit full screen press CTRL-ALT-ENTER) host is either the hostname or IP adresse of your windows […]

bash

Colours in nano

Posted on

I am writing most of my bash script with nano editor. If one want to get colours in nano, on can do:

which will give a list of what is available on your system: /usr/share/nano/html.nanorc /usr/share/nano/java.nanorc /usr/share/nano/man.nanorc /usr/share/nano/mutt.nanorc /usr/share/nano/nanorc.nanorc /usr/share/nano/perl.nanorc /usr/share/nano/python.nanorc /usr/share/nano/ruby.nanorc /usr/share/nano/sh.nanorc Now, you can do:

and add your prefered styling. Since […]