Pages

Using "tmux" for managing multiple screens

TMUX (tmux) is a fantastic tool for doing multitasks in terminal. For a programmer and researchers whose work involves coding, tmux is an essential tool.

In Ubuntu Linux, it can be installed by apt command.

To install from source code, download the package from this GitHub link.

Here are the important commands to use tmux.

tmux
tmux attach
ctrl + B   (the default prefix for tmux)
prefix + c   "Creates a window"
prefix + ,   To name/rename the panel
prefix + $  To name/rename the session
prefix + % vertical split
prefix + "   horizontal split
prefix + d   detach
prefix + d   ? to list all shortcuts
prefix + --> arrow : moves cursor to the right pane
prefix + <-- arrow : moves cursor to the left pane

To resize the panel size, prefix + Right /Lef/Down/Up arrow (i.e. --> or <--)
(Note that prefix followed by right/left arrow will move the cursor to the right/left pane)

It is also possible to restart entire tmux session after the restart. For this you need to use
tmux resurrect command. More on this later.

You can also see:
https://github.com/ssthurai/tmux-resurrect
https://github.com/ssthurai/tmux-continuum
For more commands, see this GitHub page on tmux.




Linux Onliners


To copy multiple files to multiple-different names
for f in *.txt ; do cp -p "$f" " ${f/text/texttobereplaced"; done

To copy a single file to multiple files 
for file in foo*.txt; do cp singlefile "$file" ; done
Note: Here, you have to create the files using touch.


To check the total size of a list of files in a directory
du -ch *.out | tail -n 1


To find all the instances of files with specific extension and delete all of them (recursively).
Before deleting, check all the files that will be deleted
find . -name "*.bak" -type f
Now, to if you are sure that these are the files to delete, run following command.
find . -name "*.bak" -type f -delete



Reference
Ask Ubuntu


How to disable the sound when using terminal in Windows 10?

How to disable the annoying notification sound when we do something wrong in the terminal (in Windows)?

Here is the simple way.

On the task bar, right click on the sound icon.

Select Open Volume Mixer. Here, click on the sound icon to disable the sound (like here)





How to hide (white out) some portions in a pdf file

How to hide (white out) some portions in a pdf file before printing?

We may have come across following situation.

You may want to print a research article or any file (which is in .pdf format).

But it may have a lot of pictures that may completely empty your cartridge. You may want to print other portions without this image. Also you may want hide certain portion of the text when you take print out.

Of course. You can do these with the Acrobat Reader (from Adobe)
But, How to do these in the free version of the Adobe Reader?

Here is a simple way.


  1. Open the file in Adobe Reader
  2. Go to Edit --> Paste
  3. A rectangular box will appear (with some text which is typed by you recently)
  4. Adjust the corners/sides of the box so that it hides entire Figure/portion that you want to hide
  5. You may delete the text or you may type some text inside this box
  6. You can also change the color of the outline by right clicking on the box and changing the property.


Hope it helps.





Quantum Espresso Series: How to run calculations in Quantum Espresso

I found a blog where nuts and bolts of doing calculations in Quantum Espresso code. In the blog post from quantumbarista.blogspot.com , the author Ryan Cloke has discussed the "Electronic Structure Calculations of Graphene Nanoribbons Using Quantum Espresso".

This blog post provides a detailed description on how to compute the band structure of a graphene nanoribbon.

Have a look at it.

I will do calculations and update to you later.


Quantum Espresso Series: Installing Quantum Espresso in Ubuntu 16.04 for newbies

Quantum Espresso is a opensource code for studying the electronic properties of materials. Installation of Quantum Espresso had been a difficult task earlier for new comers (now I believe that it is easy)

In this guide, I provide an easy way to install Quantum Espresso in Ubuntu 16.04. The hardware requirements can be seen here.

First check whether you have a FORTRAN complier (gfortran is a free FORTRAN compiler which is available in Ubuntu by default)

To update to new version of gfortran,

sudo apt-get install gfortran

This will install/update gfortran.

Now go the Quantum Espresso site.

Go to download page.

Download the specific version of the code you want.

Download the examples.

Extract the code using xzvf *.tz

Run ./configure

This will tell you if there is need for the installation of any packages

If configure is success,

Run make pw

Then move to examples folder

Now, you can run the specific examples

If there is need for 

You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...