Monday, August 08, 2011

Procedure to mount ISO images under Linux

Link to source.

1) You must login as a root user, if not root user then switch to root user using following command:
$ su -

2) Create the directory i.e. mount point:
# mkdir -p /mnt/disk

3) Use mount command as follows to mount iso file called disk1.iso:
# mount -o loop disk1.iso /mnt/disk

4) Change directory to list files stored inside an ISO image:
# cd /mnt/disk
# ls -l

Setting date and time on Linux/Unix

date mmddhhmi

where:
mm = month
dd = day of month
hh = hour
mi = minute

Example for today date:
sudo date 08081530

Another way, set new data to 8 August 2011 15:30:00, type the following command as root user:
# date -s "8 AUG 2011 15:30:00"

OR
# date --set="8 AUG 2011 15:30:00"

You can also simplify format using following syntax:
# date +%Y%m%d -s "20110808"

Linux Set Time
To set time use the following syntax:
# date +%T -s "15:30:00"

Tuesday, May 24, 2011

Ubuntu Tip: Howto reduce PDF file size from command line

Link to the source.

If you want to reduce PDF file size using command line you can use ghostscript.Ghostscript is used for PostScript/PDF preview and printing. Usually as a back-end to a program such as ghostview, it can display PostScript and PDF documents in an X11 environment.

Furthermore, it can render PostScript and PDF files as graphics to be printed on non-PostScript printers. Supported printers include common dot-matrix, inkjet and laser models.

Package gsfonts contains a set of standard fonts for Ghostscript.

Use the following command syntax to reduce your pdf files

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Replace your file names output.pdf, input.pdf files with your file names.

This is only example you can check man gs command for more options.

For  greater file size reduction, change /ebook for /screen but the resolution might not be good enough.

If you want to install ghostscript use the following command

sudo apt-get install ghostscript

------------
Note: You can achieve great reduction in file size using the commands pdftops and then ps2pdf.

Also you can use pdf2ps and then ps2pdf.

Or using the following script from here, and a copy of it here. The usage is the following:
./shrinkpdf.sh  in.pdf  out.pdf
We can optionally specify an output resolution in DPI (default is 72 DPI):
./shrinkpdf.sh  in.pdf  out.pdf  90

--

Friday, April 08, 2011

How To Set Up Journaled Quota On Scientific Linux 6

As you already know, Scientific Linux 6 is a clon of RHEL 6, so this instructions should work for CentOS 6 too.

First do:
yum install quota

Also you have to edit the edit the /etc/fstab and add:
usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0

If you do not need to set quotas for groups then omit the grpjquota=aquota.group as I did, thenin my fstab I have this:

/dev/mapper/vg_aguila-lv_root   /   ext4   defaults,usrjquota=aquota.user,jqfmt=vfsv0   1  1
UUID=8768d821-e441-40fd-ac08-6ef7b6234d0f  /boot  ext4  defaults  1  2
/dev/mapper/vg_aguila-lv_swap  swap  swap  defaults  0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0


After that you need to use the following commands:
touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /

quotacheck -avugm
quotaon -avug

if you need to turn the quotas off then do:
 quotaoff /
or the equivalent
quotaon -f /

The quota system is ready to go, now we have to set the quotas for every user:
 edquota -u username

And we get:

Disk quotas for user username (uid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vg_aguila-lv_root         36        0          0         10        0        0


The system automatically uses the default editor.
If we want to set 5MB of quota for username then we edit the file to:

Disk quotas for user username (uid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vg_aguila-lv_root         36       5000          0         10        0        0




------
Related links:
Quotas on Debian Lenny
RHEL 6 Quotas
faqs.org

Thursday, February 03, 2011

How To Create An ISO Image Of Directory / Filesystem

To create CD ISO image of directories that contain long file name or non-8.3 format (particularly if you want to burn the CD image for use in Windows system), use the -J option switch that generates Joliet directory records in addition to regular iso9660 file names.

mkisofs   -o   MyDirectory.iso   -J   MyDirectory