Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Thursday, October 13, 2011

Vncserver commands

To start vnc server  in different dimensions use

vncserver -geometry 1280x1024  
Default is 1024x768


# makes copy/paste work for realvnc
  vncconfig -nowin &

Tuesday, November 2, 2010

Command to put all Co files in a directory

cleartool lsco -cview -all -short | xargs -I {} cp {} /dest/path/


its very useful in case of transfer files from local vob to Remote vob


CO all files in a file

cat ~/newfile.txt | xargs cleartool co -nc

To populate file list which need to be co from remote view :

cleartool lsco -cview -all -short >>newfile.txt
---------------------------------------------------------------------------------------------------
Command to change name of a  Vob element .
 As expected Co dir first which contains that elemet


ct move src dest

Tuesday, September 28, 2010

Vi Adding at begining of Line

For Snmp MIB files to comment many lines is a challenge as we need to insert -- at each line

Command :
Global Insertion at begining each line ^ denotes begining of line
:%s!^!--!
Global Removal from begining of each line
:%s!^--! !

If you have line nos to change lets say from 209 to 461 both including
:209, 461 s!^!--!
:209, 461 s!^--! !

Sunday, October 25, 2009

Useful Commands redirecting console output

To make a file Zero size
cat /dev/null > filename.log

Directing Std out in file
command >& file_name

REdirecting Error to stdout
2>&1

Wednesday, August 12, 2009

Rpm command

Command to verify installed rpms with name
rpm --verify `rpm -qa | grep urRpmname `


To Extract RPM
rpm2cpio   nameofFile.rpm | cpio -ivd

Tuesday, August 11, 2009

How to Search and Replace stirng using sed

I had to Edit file /etc/sysconfig/ntpd to add option -x in NTPS for instant Sync
cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"

# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no

# Additional options for ntpdate
NTPDATE_OPTIONS=""

I used command
sed -i "s/OPTIONS=.*/OPTIONS=\"-x -g -u ntp:ntp -p \/var\/run\/ntpd.pid\"/" /etc/sysconfig/ntpd

but it was changing wherever OPTION is in Script i.e NTPDATE_OPTIONS was also getting changed
:s/old/new /1 dindnt work in sed

I searched and find out how to solve this
using ^ operator
This command ran fine
sed -i "s/^OPTIONS=.*/OPTIONS=\"-x -g -u ntp:ntp -p \/var\/run\/ntpd.pid\"/" /etc/sysconfig/ntpd

Thursday, October 4, 2007

Hot Keys for bash shell

Ctrl + l - Clears the Screen.
Ctrl + r - Does a search in previously given commands in shell.
Ctrl + u - Clears the typing before the hotkey.
Ctrl + a - Places cursor at the beginning of the command at shell.
Ctrl + e - Places cursor at the end of the command at shell.
Ctrl + f - Move forward by one Character
Ctrl + b - Move back by one Character
Ctrl + k - Clear from the current cursor position to the end of the line
Ctrl + w - Clear (word )from the current cursor position to Prwevious white space
Ctrl + d - Kills the shell.
Ctrl + z - Places the currently running process into background.
Ctrl + c - Kill the Process
---------------------------------
Disk Usage of file sizes under each directory in current Directory ?
du -k * | sort -nr (or) du -k . | sort -nr
-------------------------------------------
Display the all files recursively with path under current directory ?
- find . -depth -print
---------------------------------------
List the file by file Size
ls -lrt | sort -nr
-------------------------
Display the parent/child tree of a process ?
ptree Example: ptree 1267
-----------------------------------------------
Show the working directory of a process ?
pwdx Example: pwdx 1267
------------------------------------------------
Display the processes current open files ?
pfiles Example: pfiles 1267

Monday, August 13, 2007

Some VI commands we must know

To go to line
esc linno G            ---> esc 5 G

to go to last line     ---> G

to go to First line   ---> 1 + G

u               ----> undo
cntrl + r   ----> redo

:set nu              to show line no
:set nonu         hide line no
:synt off         Deactivate syntax
:synt on         activate syntax

SEARCH and REPLACE String in VI

First occurrence on current line :s/OLD/NEW

Globally (all) on current line :s/OLD/NEW/g

Between two lines #,#: :#,#s/OLD/NEW/g

Every occurrence in file: :%s/OLD/NEW/g

Working with multiple files

:e filename Edit a file in a new buffer
:bnext (or :bn) go to next buffer
:bprev (of :bp) go to previous buffer
:bd delete a buffer (close a file)
:sp filename Open a file in a new buffer and split window
ctrl+ws Split windows
ctrl+ww switch between windows
ctrl+wq Quit a window
ctrl+wv Split windows vertically


# Scroll forward a page with ---- ctrl-f
# Scroll back a page with ---- ctrl-b
# Scroll forward half a page with ---- ctrl-d
# Scroll back half a page with ---- ctrl-u
#move forward to the beginning of a word with w or W
#move forward to the end of a word with e or E
#move backward to the beginning of a word with b or B
-------------------------

Some Vim settings

set tabstop=4 "number of chars to be inserted when tab is used"
set shiftwidth=4 "To change the no. of space chars inserted for indent"
set softtabstop=4 "makes the spaces feel like real tabs"
set expandtab "convert the tabs to spaces"
we can put it in .vimrc

Vim Link
http://www.vim.org/tips/tip.php?tip_id=12

Monday, July 9, 2007

Some Commands

linux# lspci -v
list all pci buses and the devices connected to them

linux# lsusb
ist all USB buses and the devices connected to them
linux# fdisk -l
for partition
linux#demsg
dmesg - print or control the kernel ring buffer

Wednesday, June 27, 2007

FIle command n Type command

File command
performs three sets of tests, performed in this order: filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.

File system test : checks for "text" (the file contains only printing characters and a few common control characters and is probably safe to read on an ASCII terminal),

" executable" (the file contains the result of compiling a program in a form understandable to some UNIX kernel or another),
or "data" meaning anything else (data is usually `binary' or non-printable)


example
$file dirname
dirname:directory
$file a.out
a.out:ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU
$file examine.html
examine.html: HTML document text
$file view_this picture.gif
view_this: ASCII English text
picture.gif: GIF image data, version 89a, 88 x 31