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

Write Iso image to CD/DVD linux command

cp boot.iso /tmp
cd; eject

Find device name:

cdrecord -scanbus

Output:

Cdrecord-Clone 2.01a34 (i686-pc-linux-gnu)
Copyright (C) 1995-2004 Jrg Schilling
scsidev: 'ATA:'
devname: 'ATA'
scsibus: -1 target: -1 lun: -1
Warning: Using badly designed ATAPI via /dev/hd*
interface.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
scsibus1:
1,0,0 100) 'SONY' 'CD-Writer' '1.0g'
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1.7.0 107) *

In above example, my device name is 1,0,0. Now again use the cdrecord command to burn ISO image:

# cdrecord -v -dao dev=1,0,0 file.iso

You can also specify burning speed:

# cdrecord -v -dao dev=1,0,0 speed=8 file.iso

Replace 1,0,0 with your actual device name obtained using cdrecord -scanbus command

Bootable ISO Image(CD/DVD) linux command

Put CD into CDROM

Do not mount CD.

If cd was mouted automatically unmout it with umount command:

# umount /dev/cdrom

Create CD-ROM ISO image with dd command:

dd if=/dev/cdrom of=/tmp/cdimg.iso

Where,

*(input file) if=/dev/cdrom: Read from /dev/cdrom (raw format)
*(output file) of=/tmp/cdimg1.iso: write to FILE cdimg1.iso i.e. create an ISO image

Now you can use cdimg.iso for hard disk installation or as a backup copy of cd.

cscope

find . -iname '*.cpp' -o -iname '*.c' -o -iname '*.h'>cscope.files && cscope -b && cscope -d

find command linux

-atime n File was accessed n days ago
-mtime n File was modified n days ago
-size n File is n blocks big (a block is 512 bytes)
-type c Specifies file type: f=plain text, d=directory
-fstype typ Specifies file system type: 4.2 or nfs
-name nam The filename is nam
-user usr The file's owner is usr
-group grp The file's group owner is grp
-perm p The file's access mode is p (where p is an integer)

You can use + (plus) and - (minus) modifiers with the atime, mtime, and size criteria to increase their usefulness, for example,

-mtime +7 Matches files modified more than seven days ago
-atime -2 Matches files accessed less than two days ago
-size +100 Matches files larger than 100 blocks (50KB)



find . \! -iname *.cpp find file except cpp files

find . \( -iname \*.sh -a -iname \*.cpp \) find sh and cpp files

find /dir1 /dir2 \! -iname *.cpp feed search path this way

-exec cmd Execute command cmd on a file.
-ok cmd Prompt before executing the command cmd on a file.


find . -size +100M
find . -size -100M

find . \( -iname \*.cpp -a -size -1k \)

-mmin n
File's data was last modified n minutes ago.
find . -mtime 2
find . -mtime -2 files that are less than 2 days old
find . -mtime +2 files that are more than 2 days old


find . -mmin 2
find . -mmin -2 files that are less than 2 min old
find . -mmin +2 files that are more than 2 min old

-amin n
File was last accessed n minutes ago.

find . -atime +30 find files that have not been accessed for over 30 days

find . -type d list directories in present directory
find . -type f list directories in present regular file

find . -maxdepth 1 -size +100k find files size more than 100k in present directory


find files created after 1.sh
find . -cnewer 1.sh

find files modified after 1.sh
find . -newer 1.sh

find . -empty -maxdepth 1


Print me the way you want me, baby!
Changing the output information
If you want more than just the names of the files displayed, find's -printf action lets you have just about any type of information displayed. Looking at the man page there is a startling array of options.

These are used the most:
%p filename, including name(s) of directory the file is in
%m permissions of file, displayed in octal.
%f displays the filename, no directory names are included
%g name of the group the file belongs to.
%h display name of directory file is in, filename isn't included.
%u username of the owner of the file

find . -name l.sh -printf %AD\ %Ar\\n;
11/29/08 05:01:27 PM

find . -name l.sh -printf %AI\ %AM\ %AS\ %Ap\ %AD\\n;
09 41 25.0000000000 PM 11/29/08

find . -name 2.sh -printf %h\\n;
display directory only