How do I bulk rename some files in bash?

You can use several tools to accomplish the same. Here is an example using sed, but you can probably easily replace "sed -re" with "perl -pe" (and \1 with $1)

for BAM in `ls Filtered_BAM_*_H3K27me*.bam`; do
NEW=$(echo "$BAM" | sed -re 's@Filtered_BAM_(.+)\.bam@\1-nodups-xs-filtered-sorted.bam@g');
mv $BAM $NEW;
samtools index $NEW;
samtools flagstat $NEW > $NEW".stats";
done
# The main part is this:
echo "$BAM" | sed -re 's@Filtered_BAM_(.+)\.bam@\1-nodups-xs-filtered-sorted.bam@g'
# Which captures parts of the string by (.+) and then put back in the string using \1 .
# This uses the alternative separator '@' instead of '/', this can be benificial if you try to replace for example part of a directory structure that contains '/'s

How to setup a linux machine with nfs, nis and automounter?

Well I don't know either, but you can use this tutorial made by smart people from Russel group:

http://www.russelllab.org/private/wiki/index.php/Desktop_Setup

How to add user to sudoers list in Ubuntu?

Every user in the group admin is also a sudoer. This means you just add the user to the admin group by saying:

sudo adduser admin

Where is all the memory on the server?

You are wondering why the free memory is close to 0 on your 60 Gb RAM server while nobody is logged in, no big processes seems to run according to top?

Well, check the cached column (using top or free -m), if all memory is in there, it is simply that the server is using it for IO caching (for better performance). No worries, this cached memory is considered as free i.e. it is given back to jobs if needed.

How to install a software package in SEPP

How to check network IO on a slow server?

A reply from M. Wahlers about how to find processes causing huge peak of IO traffic.

run 'sudo iftop'

this will (hopefully) show the hosts to which all the network bandwidth goes

Then, simultaneously run 'netstat -tap' and search for the hosts causing most

of the network use found above. This will give you the PID of the rogue process.

This is all assuming that there is only a few processes running wild...

Also, IO monitoring can be done with : 'dstat --top-io' and 'nmon'

How to use passwordless SSH login?

This simple tutorial explains you how to save be able to login to an ssh session with a passwordless ssh key using one simple alias. Especially useful for automated tasks that need to login to other servers. But, as this has some security implications, you might want to limit this usage to internal use only (see also this post on serverfault). Another option is to make use of keychains that manages your password protected keys - see for example, the help on github.com.

- Open the terminal and edit with your favourite text editor (vim in this case) the file .bashrc:

vim ~/.bashrc

- Add the new alias to the file (obviously change “user” with your SSH username and “host.com” with your SSH address host):

alias s='ssh -2 -p 22 user@host.com'

- This means that every time you will type “s” in your terminal, that line will be executed. You can change the letter “s” to another one if you prefer.

The “-2″ option is used to force SSH2 connections instead of simple SSH.

The “-p 22″ option is used to connect via SSH to the port 22 (usually the default port).

Run these commands one time only (you can copy and paste each one) in the following order; remember to change “user” and “host” with your data:

How to start a RStudio Server session with environment variables globally set

as we did it for spinoza and schroedinger to load the 2014 version of texlive.

Input/Output error? Check your quota

If you are working in your home e.g. /home/ and you get random input/output errors it might be that you exceed your quota.

To see if this is the case run "quota -v -s -f /home", you can ofcourse easily make this into an alias like "alias myquota='quota -v -s -f /home'"

Rename many files using a regex

Using sed is very powerful e.g.

remove all numbers and first underscore from file name

ls | sed -rn "s/^[0-9]+_(.*)/mv '&' '\1'/ p" | sh

-n : quiet mode-r : extended regular expressions^0-9+_ : start with some digits, followed by an underscore(.*) : what we will keepmv ‘&’ ‘\1’ : what we will do : move the matching files (‘&’) to what we will keep (‘\1’)p : print the command|sh : execute the command

first execute without |sh to first see what would happen

mix in text in the ‘\1’ like 'prefix\1suffix' or use more regex captures