Skip to main content

Posts

Showing posts from 2012

Linux - show few lines in a file

# Using head - Print few lines (5 lines) from the top of a file head -n 5 file.txt # Using tail -  Print few lines (5 lines) from the bottom of a file tail -n 5 file.txt # Using sed # show from line 12 to line 23 sed -n '12,23 p' archivo.txt # or just one (line 15) sed -n 15p archivo.txt

Linux - Bash - .Xdefaults - To have customized xterm window

Open a file in your root folder named .Xdefaults Add the following code in the file. XTerm*Background:   black XTerm*Foreground:   linen XTerm*font:  9x15 XTerm*saveLines:    1000 XTerm*HiForeColor: white XTerm*HiBackColor: #c06077 XTerm*geometry: 150x40+10+10 XTerm*font:             -*-courier 10 pitch-medium-r-*-*-14-*-*-*-*-*-iso8859-* To select the code for any required font, run the command  xfontsel -print This opens a GUI where you can select the required font, whose code would be displayed while it is selected and at the time when you exit the application.  Add this code in the .Xdefaults file.

Linux - vim - Useful vimrc

"set line numbers " set number noremap :n noremap :N set autoindent set cindent set smartindent set formatoptions=tcroqn " see help set incsearch set ignorecase set smartcase nnoremap :set invpaste paste? set pastetoggle= set showmode " Xml Alignment map :1,$!xmllint --format - "background "set bg=dark set bg=light "Auto close braces... "inoremap {      {} "inoremap {  { } O "inoremap {{     { "inoremap {}     {} "to map any key to do a repeated action map %s/LOG_DEBUG/LOG_INFO/g "nmap :tabnext nmap :tabprev nmap :tabnext "highlight OverLength ctermbg=darkred ctermfg=white guibg=#FFD9D9 guifg=#FFFFFF "match OverLength /\%81v.*/ "control number of spaces for a tab set tabstop=4 " makes the spaces feel like real tabs set softtabstop=4 "change the number of space characters for indentation set shiftwidth=4 "put spaces instead of tabs ...

Vim Cheat Sheet

This is a small collection of tips and tricks I have collected for the vim text editor. This is by no means complete or a tutorial on how to use vim. Just a set of commands I don’t want to forget, but don’t use often enough to burn into memory, yet. See the resources section below for a more complete introduction and a set of in-depth tutorials. Navigation Marks ma" --> mark spot label it a 'a     --> jump to spot marked by label a Copy and Paste Registers Vim has a clipboard history stored in registers, you can also use these registers to cut and paste items to. "ad " cut something to register a "ap " paste something from register a :reg " list registers Deleting Lines :g/regexp/d " delete all lines that match regexp :v/regexp/d " delete all lines that do NOT regexp :15,20d " delete lines 10-20 Buffer Management :ls " matching list buffers :b [nu...

Linux - Xterm window color

Change the configuration in ~/.Xdefaults XTerm*Background:   black XTerm*Foreground:   linen XTerm*font:  9x15 XTerm*saveLines:    1000 XTerm*HiForeColor: white XTerm*HiBackColor: #c06077 #XTerm*geometry: +50+100 XTerm*geometry: 173x52+10+10 xterm*font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-*