Category Archives: The Lab

Unix Useful Commands

alias + “pushd .”
alias – “popd”
alias u “cd ..”
alias p “pwd”
>> put in ~/.mycshrc

“history”
history | grep command-name
!<number>
Untar gz:
tar -xvzf file.tar.gz
Untar:
tar -xvf file.tar

 

Repeat previous command

  1. up arrow
  2. Type !! and press enter
  3. Type !-1 and press enter.
  4. Press Control+P will display the previous command
Advertisements

Commonly used Vim commands

:sav (save as)
c (change)
d (delete)
{ } (page up, down)
/ (search)
:wq (save, quit)

:%s/findme/replaceto/gc (replace within file, multiple occurence per line, confirmation)

v: Visual Mode
Shift+v : Line Visual Mode
Ctrl+v , then Shift+i : Column-wise Insert

:set autoindent
:set cindent
:set scrolloff=1000

:bufdo %s/from/replace/ge | w (search and replace, to all buffers)

(From command line) ctags -R .
Ctrl + ] = go to definition
Ctrl + T = go back to caller
:set tags=(the topmost ctags file desired)

—-.vimrc—-

syntax on
"set autoindent
"set cindent
set smartindent
filetype plugin on

let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

"Set color scheme
set t_Co=256
colorscheme desert256
"colorscheme gardener

"Enable indent folding
set foldenable
set fdm=indent
set tags=../tags

Newbie Matlab Error

Long time no Matlab, got this error:
??? Error using ==> mpower
Matrix must be square.

The mathematical operators *, /, and ^ each should have a dot “.” in front of them. This is a MATLAB convention that ensures that when the function’s argument is a vector of positions.