OpenSource For You

Record whatever you do in the terminal

-

Have you ever felt that you should record HYHUything yRu GR in thH tHUPinDO in D fiOH? Then try out the following tip. There is a command named script which can be used with option –a to append thH RutSut tR D fiOH.

diven below is an example that will show how it worksW Mandriva~:$ script -a lfy 6FULSt VtDUtHG, fiOH LV OIy Mandriva~:$ uname -a Linux localhost.localdomai­n 2.6.33.5-desktop-2mnb #1 SMP Thu Jun 17 21:30:10 UTC 2010 i686 i686 i386 GNU/Linux Mandriva~:$ uname Linux Mandriva~:$ exit exit 6FULSt GRNH, fiOH LV OIy

+HUH, thH nDPH RI thH fiOH iV lfy. vou can verify it later by using the code given belowW Mandriva~:$ cat lfy Script started on Mon 16 May 2011 02:09:47 AM EDT Mandriva~:$ uname -a Linux localhost.localdomai­n 2.6.33.5-desktop-2mnb #1 SMP Thu Jun 17 21:30:10 UTC 2010 i686 i686 i386 GNU/Linux Mandriva~:$ uname Linux Mandriva~:$ exit exit

Script done on Mon 16 May 2011 02:10:32 AM EDT

—Sibi, psibi2000@gmail.com

8VH ‘-G’ Vwitch tR cRPSDUH twR fiOHV in V,M. ThiV cRPPDnG splits the VIM screen vertically and shows the difference­s.

vLP -G fiOH1 fiOH2 To load new files in seSarate windows: ,I yRu hDYH D fiOH nDPHG ‘fiUVt.txt’ ORDGHG DOUHDGy in V,M, thHn uVH ‘:VSOit VHcRnG.txt’ tR ORDG DnRthHU fiOH nDPHG ‘second.txt’ in a separate window—IM will split the screen hRUizRntDO­Oy DnG ORDG thH VHcRnG fiOH. YRu cDn uVH ‘:YVSOit’ to split the screen vertically. ‘CtrlHw’ can be used to switch between the windows. VI0 as a command: Normally, we use VIM as an editor; however, it can be used as a command. It allows the execution of VIM commands with switch ‘-c’, for example. Here is a command tR UHSODcH DOO ‘>’ chDUDctHUV tR ‘>>’ in D fiOH ),L(.T;T without opening VIM.

vim -c “:s/>/>>/g” -c “:wq” FILE.TXT To oSen a file in read-only mode: 8VH thH ‘-R’ Vwitch tR RSHn D fiOH in UHDG-RnOy PRGH; ODtHU Rn, ‘!’ cDn bH uVHG tR IRUcHIuOOy wUitH tR thH fiOH.

—satya Srakash, satya.comnet@gmail.com

 ??  ??

Newspapers in English

Newspapers from India