UNIX and Linux Training Services SYS-ED Experience

Submit Linux and UNIX Questions

Home

Submit UNIX and Linux Questions Technology Driven IT Training UNIX- and Linux- variants

Submit UNIX Questions to Computer Education Techniques SYS-ED Advanced search
     

Interrelated Information Technology
MS Operating Systems and Networks Questions Web Design Questions
Web Server Questions Programming Language Questions

The SYS-ED knowledge base is a service for answering questions, inclusive of the research and validation of the accuracy of information in the public domain. Citation of source documentation and examples are used to provide answers to the questions. Utilization and reliance on the answers, information, or other materials received through this website is done at your own risk.

Q1

Our organization has recently updated to GRUB2. How can I ascertain where GRUB2 is installed?

A

GRUB2 incorporates a totally revised directory and file hierarchy. The menu.lst of GRUB legacy is no longer used.

In order to find out where GRUB2 is installed, the user can run these two commands:

Device: sudo grub-probe -t device /boot/grub

UUID: sudo grub-probe -t fs_uuid /boot/grub


Q2

How can a customized menu be created in GRUB2?

A

The user can create a custom file in which to place menu entries. This file will not be overwritten. By default, a custom file named 40_custom is available for use in the /etc/grub.d folder. The primary configuration file for changing menu display settings is grub and by default is located in the /etc/default folder.

Multiple files are used for configuring the menu:

 /etc/default/grub

 All the files in the /etc/grub.d/ directory.

The main directories and files used by GRUB2 include:

/boot/grub/grub.cfg

The grub.cfg file contains the GRUB2 menu information. Unlike the GRUB's menu.lst, the grub.cfg file is not designed to be edited.

Each section starts with "(### BEGIN)" and references the script in the /etc/grub.d directory from which the information has been generated.

The grub.cfg is updated by running the update-grub command as root. The update-grub command is a stub for sudo grub-mkconfig -o /boot/grub/grub.cfg. For standardization, the command update-grub will be employed, run as "root" with sudo.

The grub.cfg is automatically generated with kernel installations/removals, updates to some GRUB2 packages, when update-grub is executed, or when other operations would affect the boot process.

/etc/default/grub

This configuration file contains information formerly contained in the upper section of GRUB Legacy's menu.lst and items contained on the end of the kernel line. The entries in this file can be edited by a user with administrator root privileges and are incorporated into grub.cfg when it is updated.

/etc/grub.d/ The scripts in this directory are read during execution of the update-grub command and their instructions are incorporated into /boot/grub/grub.cfg.

The placement of the menu items in the grub.cfg menu is determined by the order in which the files in this directory are run. Files with a leading numeral are executed first, beginning with the lowest number. If files with alphabetic names exist, they are run after the numerically-named files.

Custom menu entries can be added to the 40_custom file or in a newly created file. Based on its name, 40_custom entries by default appear at the bottom of the menu. Only executable files generate output to grub.cfg during execution of update-grub.

By default the files in the /etc/grub.d folder are executable.


Q3 What are the differences between GRUB and GRUB2?

A

GRUB2 incorporates a revised directory and file hierarchy. The menu.lst of GRUB legacy is no longer used. Automated searches for other operating systems, such as MS Windows, are accomplished whenever update-grub is executed. Operating systems found will be placed in the GRUB2 menu. Changes made in the configuration files will not take effect until the update-grub command is executed.

The GRUB2's default menu will look similar to GRUB; however, there are a number of differences:

  • On a new installation of Ubuntu 9.10 or later with no other installed operating systems, GRUB2 will boot directly to the login prompt or Desktop. No menu will be displayed. There is no "/find boot/grub/stage1" at the grub prompt. Stage 1.5 has been eliminated. The main GRUB2 configuration file, normally located in the /boot/grub folder, is grub.cfg. It is the product of various scripts and should not normally be edited directly. The grub.cfg is overwritten by certain GRUB2 package updates, whenever a kernel is added or removed, or when the user runs update-grub. The menu list of available Linux kernels is automatically generated by running update-grub.
  • Partition numbering has changed. The first partition is now 1 rather than 0. The first device/drive remains hd0 by default. These designations can be altered in the device.map file in the /boot/grub folder.
  • In early versions of GRUB2, the file is "read-only". Later versions removed the "read-only" attribute although as a system file it is still owned by "root". The user also will see a multitude of *.mod files in the /boot/grub directory. These files reflect the modular nature of GRUB2 and are loaded during boot by GRUB2 bootloader as required.

Q

How can man pages be formatted without the man or gruff utilities?

A

The man2html program translates groff text to HTML for viewing with a web browser. The man2html program and other similar programs can be downloaded from the web. There are a number of locations that one can download man2html, the developers site is http://dcssrv1.oit.uci.edu/indiv/ehood/man2html.html.

The unformatted manual pages typically are stored in the subdirectories of /usr/man, /usr/local/man; there can be other locations.

The nroff and less commands can be used to review text. These programs have MSDOS versions with an implementation of the man macro package available as well.

Example:

$ nroff -man /usr/man/man1/ls.1 less


Q Is it possible to make a 1:1 copy of a data CD?

A

Yes a 1:1 copy can be made of a data CD. However, any errors that occur while reading the original will result in a defective copy.

Example 1:

CD-writer and a separate CD-ROM drive.

Issue the command:

cdrecord -v dev=0,6,0 speed=2 -isosize /dev/scd0

The data stream is read from the CD-ROM drive attached as /dev/scd0 and written directly to the CD-writer.

Example 2:

CD-writer only.

First a read out has to be performed from the CD-ROM.

Issue the command:

dd if=/dev/scd0 of=cdimage

The command reads the content of the CD-ROM from the device /dev/scd0 and writes it into the file "cdimage". The content of this file are equivalent to what mkisofs produces.

The newest versions cdrecord, includes a "readcd" tool in misc/. It will provide the same result as dd, but reads sectors on the CD-ROM multiple times in case of errors.

With an audio CD, cdrdao or cdda2wav will have to be used.


Q

How can real time statistics for a Linux system be generated?
A

The dstat man command provides realtime monitoring with the Linux operating system. A partial list of options includes: output system usage, memory usage, load times, network information for NFS, VMWare, CPU, sendmail, MySQL and other software usage.

The dstat command is a replacement which addresses the limitations associated with vmstat, iostat, and ifstat.

dstat provides the capability to:

  • Review system resources and compare disk usage in combination with interrupts from the IDE controller or compare the network bandwidth numbers directly with the disk throughput in the same interval.
  • Aggregate block device throughput for a certain diskset or network bandwidth for a group of interfaces.
  • Allow data to be directly written to a CSV file and then be imported and used by OpenOffice, Gnumeric or Excel to create graphs.

Q

How is logging turned off in bash?

A

In order to have activity in the .bash_history file excluded from logging, append a space character prior to the command.

Example:

cat /etc/passwd

The space bar is invoked prior to typing cat /etc/passwd .

Q

How can a program be run at a specific time?

A

The at command is used for executing a task at a specific time.

Example:

Perform these steps:

1. Type:

At 1250

A command prompt will appear where the command to be executed can be typed.

2. Type mplayer mymovie.avi .

3. Invoke Enter.

4. Then press Ctrl+D to exit the command-line. The EOT character (Ctrl+D) in UNIX is different from the Control-Z in DOS. The DOS Control-Z byte is actually sent or placed in files to indicate where the text ends. In contrast, the Control-D causes the UNIX terminal driver to signal the EOF condition, which is not a character, while the byte has no special meaning if actually read or written from a file or terminal.

The job will run in the background and execute the command at the time requested.

5. In order to view a list of scheduled commands use:

at -l

6. In order to remove a task use:

atrm 1

where 1 is the job ID given by at -l.


Q Several applications perform extremely sluggishly when running simultaneously on the system. It is possible to ascertain whether an application is consuming excessive CPU resources?

A

Yes, this is done with the ps command.

Example:

ps -eo pcpu,pid,args | sort -k 1 -r |head -10

This will display a list of ten processes; the most cpu intensive application will be first on the list.


Q

How can CPU usage of an application be controlled in Linux?

A

This is done by installing cpulimit; it can be used to restrict the CPU utilization of an application either by name or process ID:

Example:

By application name

cpulimit -e firefox -l 30

This will limit Firefox from utilizing beyond a 30% CPU consumption.

Example:

By process number

cpulimit -p 3493 -l 40

This will limit process number 3493 to 40% CPU consumption.

cpulimit is a simple program which will limit the cpu usage of a process expressed in percentage, not in cpu time. This is useful to control batch jobs, in order to ensure that they do not consume excessive much cpu. It does not act on the nice value or other scheduling priorities, but on the real cpu usage. It also is able to itself to the overall system load, dynamically and quickly. It is available for downloaded from SourceForge.Net


Q

How can directories be listed from the command-line?

A

From a Terminal session use the ls –d * /.   It will list the directories of the current folder.

Q

I am a new webmaster. What is a straightforward way to back up a website?

A

The rsync tool can be used to back up a directory on a computer and copy only the changed files to the backup computer. This is known as an incremental backup. An account will be required on the remote computer that the directories and files are being backed up from.

Example:

rsync -vare ssh dave@192.168.0.2:/home/dave/mainsite/* /home/dave/backup/

All the files in /home/dave/ mainsite / on 192.168.0.2 are being copied to /home/dave/backup on the current machine.


Q

How can battery power be conserved on a laptop computer running the Linux operating system?

A

In addition to optimizing input/output performance on a hard drive, the hdparm command can be used to extend the battery life on a laptop.

Example:

hdparm -y /dev/hdb

This command will cause the drive to switch to standby mode.

Example:

hdparm -Y /dev/hdb

This command will switch to Sleep mode and set the Automatic spindown timeout.

Example:

hdparm -S 36 /dev/hdb

This command includes a numeric variable, representing units of blocks equal to seconds. A value of 36 x 5= 180 seconds = three minutes.

hdparm is a command-line utility for the Linux and Windows operating systems to set and view ATA hard disk hardware parameters. It can set parameters such as drive caches, sleep mode, power management, acoustic management, and DMA settings. It can be downloaded from SourceForge.Net


Q

We are evaluating whether to utilize an open source UNIX or Linux operating system for our WebLogic Server and Oracle database? Are there any limitations in the installation and boot partition?

A

In 2009, Oracle Corporation acquired Sun Microsystems hardware and open source software: Solaris operating system, MySQL database, and Java programming language.

Our recommendation would be to use Solaris. Starting with the Solaris 10 release, it is now possible to install and boot the Solaris OS from a disk that is up to 2 terabytes in size. The VTOC label can be used on a disk of any size; however, the addressable space by the VTOC is limited to 2 terabytes. This feature enables disks that are larger than 2 terabytes to be used as boot drive. It removes the limitations of earlier releases of Solaris where it was not possible to install and boot the drive from a disk that was greater than 1 terabyte in size.


Q

What is the difference between Ubuntu and Kubuntu, Shubuntu, and Edubuntu?
A Ubuntu is an open source Linux operating system; it is available free of charge. Ubuntu is maintained and distributed by Canonical Ltd. Ubuntu uses the GNOME desktop environment. Kubuntu, Shubuntu, and Eduntu are subprojects of Ubuntu Linux.
  • The Kubuntu Linux operating system is configured for use in preschool and elementary school environments.
  • The Shubuntu, also known as Xbuntu, Linux operating system is configured with the Xfce desktop. Xfce runs efficiently on older machines with minimal disk space; it also is intended for preschool and elementary school environments.
  • The Edubuntu Linux operating system is configured for older children than Kubuntu or Shubuntu. It includes tools which facilitates the set up of learning modules in a classroom environment.

Q

What is new with ZFS and why is it considered an important component of UNIX-variant operating systems?
A ZFS is a significant enhancement to file system design and is already in use on Linux, Mac OS X, and FreeBSD systems. ZFS file systems are built on top of the concept of pools or "zpools". Instead of utilizing a volume manager on top of multiple drives, ZFS joins devices into storage pools - large data stores from which file systems can be built. This serves to greatly reduce the complexity and administrative overhead. ZFS file systems are not constrained by initial partitioning decisions. File systems can be added to as needed and new devices can be added at any time. This serves to facilitate the enlargement of the space available to all file systems. As a 128 bit file system, it can store 18 billion times more data than current 64-bit file systems. The maximum size of a single file has been increased by a factor of 16 times 2 as compared to the maximum size of a file in a 64 bit file system. ZFS addresses many of the issues associated with file system corruption and the problems associated with freeing free blocks crashes.

The zpool and zfs commands are used to work with ZFS.

Example 1:

This command creates a storage pool on a single disk drive and a file system named "zpool". The file system is automatically mounted as /sysed.

zpool create sysed c1t0d0

Additional file systems can then be created within this file system.

Example 2:

This command creates a pool using two disks and stripes data across the drives. The file system and mount point are /sysed.

zpool create sysed c1t0d0 c1t1d0

Example 3:

This command creates a mirror instead of striping.
zpool create sysed mirror c1t0d0 c1t1d0

Q

What is the difference between the various ZIP formats: ZIP, GZIP, and PKZIP?

A

ZIP is an archive file format, popularized on PCs, that contains multiple compressed files.

GZIP comes from a GNU project. It is a one file subset of the ZIP format. It is not possible to place a whole directory into a GZIP archive, just a single file. It's intended for compressing a tarball of many files.

PKZIP is a commercially available program that creates zip files.

All three use the deflate compression format, which is based on the LZ77 algorithm. This compression is also used by the ZLIB library and the PNG graphics file format PNG - (which uses ZLIB).


Q

Our company uses multiple variants of UNIX and accordingly I will be required to write scripts that will work in different Shells. Will SYS-ED UNIX courses be able to accommodate my needs?

A

There are two main class of shells:

  1. The first class are the shells derived from the Bourne shell which includes sh, ksh, bash, and zsh.
  2. The second class are those shells derived from C shell and include csh and tcsh.

There is also a rc which most people consider to be in a class by itself.

We demonstrate and teach how to write scripts that will work for the shells both from the Bourne shell category and the C shell category.


Q

I work for a government municipality in a PC Windows environment. Will it be difficult to learn UNIX?

A

Your previous experience with non-UNIX operating systems will serve as a good foundation for learning UNIX. Administering a UNIX system is not for novices. The UNIX operating system is more "detail oriented" than Microsoft DOS/Windows. However, there is a commonality between DOS and UNIX commands.

DOS Command

UNIX Equivalent

help man
cls clear
dir ls –l
dir/w ls
more < filename more filename
cd directory cd directory
del filename rm filename
deltree directory rm -r directory
copy file1 file2 cp file1 file2
xcopy dir1 dir2 cp -r dir1 dir2
attrib +-attribute file chmod mode file
mkdir directory mkdir directory
find "string" file grep "string" file

Q

I want to make sure that the version of UNIX used in class matches the version that I use at work.

A

The version can be ascertained by using the uname command. It is standard policy for SYS-ED to use the newest version of an operating system, and in the case of UNIX, the newest version of that variant. Upon request we will set up operating systems specific to what you utilize back on the job.


Q

I have an immediate need to learn how to set access privileges for my files. Which UNIX course should I taken in order to master the UNIX ile system and become a network administrator?

A

The UNIX file access attributes are different from their DOS counterparts. In UNIX, the read, write, and execute privileges can be set according to who the user is. The privileges are set using the chmod command:

chmod mode file

Our recommendation would be to take the UNIX: Fundamentals - Level 1 course.


Q

What is Linux?

A

Linux is a variant of the UNIX operating system. Every Linux system is based on the Linux kernel. The kernel manages computer hardware, performs multi-tasking and other essential things. These low-level functions are used by other programs. More commonly, "Linux" refers to the Linux Operating System.


Q

I will be coding and maintaining AIX on a z/OS system. Does SYS-ED offer AIX courses?

A

Yes, we offer AIX courses, but only on a private basis.


Q

We are interested in learning Solaris. Our company is using Solaris 2.x, 9, and Solaris 10. Which version would be best for me to learn?

A

There are differences between the different versions of the Solaris Operating System. However, there would be minimal impact on a Solaris fundamentals course.

The core content of a Solaris Fundamentals course would remain:

  • navigating the environment.
  • accessing directories and files.
  • file manipulation
  • editing
  • shell
  • CDE
  • configuration (basic).
However, it is universally accepted that, all things being equal, the newest version of an operating system is the best one to learn.

Q

In the early 1980’s I worked for an organization which used UNIX as its primary operating system. In my current position (with a different organization), I am now involved in evaluating Solaris as one of our mainstay operating systems. Does SYS-ED train on Solaris and how do you address the differences among the versions?

A

You are not alone, for many IT professionals, the future is indeed to a large degree going back to the past! Yes, we do train on Solaris and all our courses address and demonstrate the changes in commands and the discontinued and new features.

This is a concise summary:

Changes in Commands

These commands have changed:

reboot, pfiles, coreadm, psrinfo, mount, ioctl, modinfo, and gethostbyname.

Removal of Features

A number of features have been removed including Netscape, admintool, /var/adm/passwd, PC fileviewer, and others.

Enhancements to New Features

Several changes were made to sendmail and NFS; mostly for administrators.

New Features

The new features of Solaris will be listed/discussed and available for demonstration on the instructor’s machine.

  • Solaris Dynamic Tracing (DTrace)
  • Solaris Containers
  • Predictive Self Healing
  • Solaris Secure Execution

Schedule