If you like to create a file with zero length, use this command:
A file with length 0 gets created. Use the same trick to set the modification date and time of the file to the current values.
This is also an easy trick to see which files have changed during your work:
This will print all files in the current directory tree which have changed.
Your filenames have mixed caption. Change them all to lowercase with this script:
#!/bin/sh
for i in $@ ;
do
export j=`echo $i | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
[[ $i != $j ]] && mv $i $j ;
done
# EOF
This script renames all files to lowercase only. If a file already exists with only lowercase letters, the original file won’t renamed.
As it’s used to be, there is another way to do this (thanks to Patrick Meier) using the tr command:
You have a bunch of files with the same extension, but you like to rename all files to another extension. Here is a solution:
This command renames the extensions of all files ending with .mpg
to .mpeg
If you are looking for a file and you don’t know in which RPM file it is, you may use the following command:
Replace “pattern” with the term you’re looking for. Note: grep uses regular expression.
Configure SD card for 255/63/? using sfdisk:
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
The command in general:
Assuming you have a CD-ROM or a DVD-ROM on the SCSI bus /dev/scd0
, the command to create the image file:
You may now write this image to another CD (or DVD):
Parameters may vary, depending on your CD-RW/DVD-RW and bus system.
The sequence to create an image works for many other devices as well (floppy disc, etc.).
Often you have a floppy disk image (a boot disk from a Linux distribution for example) and you like to write it onto a floppy disk. Many distributions provide DOS tools to do this. We like to do this with Linux instead. All you need is the image file and the dd utility:
This command assumes that the floppy disk is the device /dev/fd0
and it is a 3.5" floppy disk drive with a capacity of 1.44MB (or 1440kB).
Just use this command (this expects a SCSI CD rewriter on ID 4, LUN 0, which is able to rewrite at speed 16x.):
This is a second method which does not use the loopback device. It just creates the CD image of a prepared directory tree of data.
This expects a SCSI CD writer on ID 4, LUN 0, which is able to write at speed 16x. The option -data
interprets the image as data. Use -audio
to write an audio CD.
Unmount the fresh burnt CD (/mnt/cdrw
or whatever you have as default mount point for the drive):