Friday, March 20, 2009

Bash Commands

Ctrl + xx Move between EOL and current cursor position

Ctrl-a Move to the start of the line.
Ctrl-e Move to the end of the line.

Ctrl-b Move back one character.
Ctrl-f Move forward one character.

Alt-b Move back one word.
Alt-f Move forward one word.

Alt-] x Where x is any character, moves the cursor forward to the next occurance of x.
Alt-Ctrl-] x Where x is any character, moves the cursor backwards to the previous occurance of x.

Ctrl-u Erase the current line.
Ctrl-k Delete from the cursor to the end of the line.
Ctrl-w Delete from the cursor to the start of the word.
Esc-Del Delete previous word (may not work, instead try Esc followed by Backspace)
Alt + d Delete word

Ctrl-y Pastes text from the clipboard.
Ctrl-l Clear the screen leaving the current line at the top of the screen.

Ctrl-x Ctrl-u Undo the last changes. Ctrl-_ does the same
Alt-r Undo all changes to the line.
Ctrl-d Delete from under the cursor
Ctrl-r Search the history backwards
Ctrl-R Search the history backwards with multi occurrence
Ctrl-xx Move between EOL and current cursor position
Ctrl-x @ Show possible hostname completions

Alt-< Move to the first line in the history
Alt-> Move to the last line in the history
Alt-? Show current completion list
Alt-* Insert all possible completions
Alt-/ Attempt to complete filename
Alt-. Yank last argument to previous command
Alt-back-space Delete backward from cursor

2T = TAB twice
/2T Entire directory structure including Hidden one
*2T Only Sub Dirs inside without Hidden one

Alt-n Search the history forwards non-incremental
Alt-p Search the history backwards non-incremental

Alt-t Move words around
Alt-u Make word uppercase
Alt-l Make word lowercase
Alt-c Capitalize the word

Monday, March 16, 2009

Rpm commands

rpm -Uvh packages(s).rpm install/upgrade package file(s)
rpm -e package remove package
rpm -qa '*spell*' show all packages whose names contain the word spell
rpm -q package show version of package installed
rpm -q -i package show all package metadata
rpm -q -i -p package.rpm show all package file's metadata
rpm -q -f /path/file what package does file belong
rpm -q -l package list where files were installed
rpm -q -l -p package.rpm list where files would be installed
rpm2cpio package.rpm | cpio -id extract package files to current directory
rpm -q --requires package list files/packages that package needs
rpm -q --whatrequires package list packages that need package (see also whatrequires)

Monday, March 2, 2009

Format USB Disk On Linux

Get the /dev mount point of the USB disk,
list file system using mkfs command, and then write desired filesystem command

let us select mkfs.vfat

then apply command
#sudo mkfs.vfat /dev/sda1
give label to USB disk using
#sudo e2label /dev/sda1 jaimin-usb-disk

Thursday, January 29, 2009

Tar Extract a Single File(s) From a Large Tarball

We have a directory named directory1
file listing of directory is like this
--------------------------------------------------------------
directory1/
directory1/directory2
directory1/directory2/directory3
directory1/directory2/directory3/directory4
directory1/directory2/directory3/directory4/file4.file
directory1/directory2/directory3/file3.file
directory1/directory2/directory3/extract.this.file
directory1/directory2/file2.file
directory1/directory2/extract.this.file.also
directory1/file1.file
--------------------------------------------------------------

tar -cvzf directory1.archive.tgz directory1/

now we have tgz file directory1.archive.tgz

now give following command

--------------------------------------------------------------
tar -xvf directory1.archive.tgz --wildcards --no-anchored directory1/directory2/directory3/extract.this.file directory1/directory2/extract.this.file.also
--------------------------------------------------------------

Now?
go ahead you have
directory1/directory2/directory3/extract.this.file
directory1/directory2/extract.this.file.also
to use. have fun

Saturday, December 13, 2008

mount remote windows directory using smbfs

mount -t smbfs //172.31.45.201/smb /mnt/smb -o username=administrator,password=

smbmount //128.88.146.172/downloads /work/jaimin/myVSS/ -o username=jaimin,password=

Mount iso cd image

mount -t iso9660 -o loop ./ddk-2.6.16.18.iso /mnt/iso

Add CD/DVD ISO image to openSUSE Repository

  1. add the ISO as a software repository

    zypper ar -c -t yast2 "iso:/?iso=/home/jaimin/su1100.001.iso" "openSuSE 11"

  2. Verify that the service has been successfully added

    zypper repos

  3. Now we can delete the DVD repository as an installation repository

    zypper rr 1

  4. Let's quickly enable automatic refresh (optional)

    zypper mr -r "openSuSE 11"

  5. Now we can finally test the ISO repository and install a package like nmap

    zypper in -y nmap