Posts Tagged ‘Terminal’

On a previous post I described how to change the LaTeX options of the Cadabra notebook.

I collaborate with a colleague, who uses the standard cadabra installation. Therefore, If I write a Cadabra notebook, he needs to pullback the personalised notebook to the standard one. The pullback script can be downloaded here!!!

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 20:20

Emacs 24.3.1 (Org mode 8.2.5h)



Read Full Post »

Goal: a cadabra notebook more LaTeX friendly.

  1. I run a Debian system. Don’t know why, but the original source code in the git repo didn’t work!!!What did I do? I downloaded the code from the Debian repository.
    $ sudo apt-get build-dep cadabra # Install all dependences
    $ mkdir -p ~/Software # Create a folder to download the source
    $ cd ~/Software # Move to the folder
    $ apt-get source cadabra # Download the source code (from Debian)
  2. On the cadabra folder created through the last command line, I looked for the window.cc file and open it
    $ emacs cadabra-1.29/gui/window.cc &
  3. On the window.cc file I changed:
    • The LaTeX package color by the improved xcolor, by changing the string
      << "\\usepackage[usenames]{color}\n"


      << "\\usepackage{xcolor}\n"
    • I added the LaTeX package listings, which improves the verbatim properties (among other things). Right after the mentioned xcolor line, I added the following
      << "\\usepackage{listings}\n"
      << "\\lstset{\n"
      << "  basicstyle=\\small\\color{blue}\\ttfamily,\n"
      << "  breaklines=true,\n"
      << "  columns=fullflexible,\n"
      << "  commentstyle=\\color{gray!60},\n"
      << "  morecomment=[l]{\\%\\%},\n}"

      This allows the Cadabra code to break at the end of the line instead of going out of the page, when compiled to LaTeX (similar to what breqn does on equations).

    • Now, I changed on the DataCell::c_input: case,1 the strings {\\color[named]{Blue}\\begin{verbatim}\n by \\begin{lstlisting}\n, and \n\\end{verbatim}}\n by \n\\end{lstlisting}\n.Far below, the lines with the code if(ln=="{\\color[named]{Blue}\\begin{verbatim}") { should be changed to if(ln=="\\begin{lstlisting}") {, as well as else if(ln=="\\end{verbatim}}") { should be changed to else if(ln=="\\end{lstlisting}") {.
    • Save all the changes
  4. Finally, time to compile
    $ ./configure
    $ make
    $ sudo make install
  5. If your compilation/installation went through, and you try to open an old cadabra notebook (a notebook created with the original cadabra code), the program will complain that the file is not compatible… but I created a small script to transform the old files into new files! Download it here!!USAGE:
    $ ./transf_cadabra oldfile.cnb newfile.cnb


1This is located a few lines below the lines where the LaTeX preamble is defined

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 10:09

Emacs 24.3.1 (Org mode 8.2.5h)


Read Full Post »

According to this post, the instructions to install the latest Skype on Debian are

$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo dpkg -i skype-debian_4.1.0.20-1_i386.deb
$ sudo apt-get install -f
$ sudo dpkg -i skype-debian_4.1.0.20-1_i386.deb

I followed these instructions and it worked alright on my second try!… Don’t know why the first time my Skype account was not recognised.

Ok, if it work… just remember that credit is not mine!


Author: Oscar Castillo-Felisola

Created: 2013-10-14 Mon 11:25

Emacs 23.4.1 (Org mode 8.2.1)


Read Full Post »

The command xarg is used to pass the standard output (of a previous command) as standard input to the following.

Worked Example

I want to delete all files in the current directory containing numbers in their names.

First, let me show you the list of files!!!

$ ls
calchep.rc   func1.mdl    lgrng1.mdl  lhep.rc       prtcls15.mdl  
prtcls4.mdl  qed.mdl       smnlg.mdl   uedqed.mdl  vars15.mdl  vars4.mdl
calchep.rc~  func2.mdl    lgrng2.mdl  newsm.mdl     prtcls1.mdl   
qcd.mdl      qed.mdl~      smren.mdl   ufo.rc      vars1.mdl
feynarts.rc  func4.mdl    lgrng2.tex  project.mdl   prtcls2.mdl   
qcd.mdl~     slhaplus.mdl  sm_tex.mdl  ufo-static  vars2.mdl
func15.mdl   lgrng15.mdl  lgrng4.mdl  project.mdl~  prtcls2.tex   
qeddip.mdl   sm_brst.mdl   stand.mdl   ug.out      vars2.tex

What a mess!!! I can use the grep command to show the files whose names have (at least a number)

$ ls | grep [0-9]

Finally, I would like to remove all these files, using rm command… I guess you’ll try something like

$ ls | grep [0-9] | rm 
rm: missing operand
Try 'rm --help' for more information.

Wrong!!! (bad luck for me)… the right answer is that the list should be pass like arguments to the command rm. Therefore, by doing

$ ls | grep [0-9] | xargs rm
$ ls
calchep.rc   project.mdl~  slhaplus.mdl  uedqed.mdl
calchep.rc~  qcd.mdl       sm_brst.mdl   ufo.rc
feynarts.rc  qcd.mdl~      smnlg.mdl     ufo-static
lhep.rc      qeddip.mdl    smren.mdl     ug.out
newsm.mdl    qed.mdl       sm_tex.mdl
project.mdl  qed.mdl~      stand.mdl

the job is done!!!



Read Full Post »

When I opened a terminal the prompt said


which is nice. But after changing the directory to Folder/Subfolder/Subsubfolder, it got messy,


Since the command

$ pwd

shows the path of current directory, I wanted to drop all this bothering information.


Open the terminal (or if it’s opened go to your personal folder)

$ cd

Open the .bashrc file

$ nano .bashrc

Look for the lines where

PS1='....some messy stuff here...'

is written, and erase the values \w from them.

Save the file (C-o) and exit (C-x).

Restart the terminal.

Read Full Post »

If for any reason you need to un-install Mathematica,  you should delete the files associated to it. If the installation was the usual one, follow the below steps.

$ cd /usr/local
$ sudo rm -r Wolfram
$ cd bin
$ sudo rm math mathematica Mathematica MathKernel mcc
$ cd ../../share
$ sudo rm -r Mathematica

This would be enough.


Read Full Post »

WARNING: The following is a PERSONAL brief of part of the second chapter of the book How Linux Works: what every superuser should know by Brian Ward

Linix device files are in the /dev directory. A device can be identified using the ls -l command.

An extract of the output from the command line ls -l /dev is shown below,

crw-rw----+ 1 root cdrom    21,   1 Sep  6 01:23 sg1
lrwxrwxrwx  1 root root           8 Sep  6 01:23 shm -> /run/shm
crw-------  1 root root     10, 231 Sep  6 01:23 snapshot
drwxr-xr-x  3 root root         220 Sep  6 01:23 snd
brw-rw----+ 1 root cdrom    11,   0 Sep  6 01:23 sr0
srw-rw-rw-  1 root root           0 Sep  6 01:23 log
prw-r--r--  1 root root           0 Sep  6 01:23 gpmdata

The first column is a code which indicates the type of ‘file’ (the first character) and permissions (the other nine characters).

If the first character is b, c, p, or s, then the file is a device. These letters stand for block, character, pipe, and socket, respectively:

  • block: Programs access data in a block device in.
  • character: Character devices work with data streams.
  • pipe: are like character devices, but there is another process at the other end of the I/O stream instead of a kernel driver.
  • socket: are special-purpose I/O files offering a type of network interface.

The numbers before the dates in the first two lines of the previous listing are the major and minor device numbers that help the kernel identify the device.


Read Full Post »

Older Posts »