9/23/10

Converting .gov

   

  The Cheese Webcam Booth application that comes pre-installed with Fedora 13 is a fun program that utilizes your webcam's capabilities in various ways.
Unfortunately, it saves video files in .gov extensions making it difficult for some programs to recognize. 

To convert your video files from Cheese Webcam Booth to .avi, as root, install mencoder.

#yum -y install mencoder

Then run the following command to convert the file to avi.

#mencoder -idx out.gov -ovc lavc -oac mp3lam -o output.avi





**For more in-depth information on mencoder refer to the man pages.



9/12/10

Fedora 13 Hangs After Install

   After installing Fedora 13 and restarting your PC, some may experience the computer to hang at a blank/black screen right after the Fedora boot logo restricting access to text mode or a command line. Briefly, this is caused by a bug that is associated with some Nvidia graphic cards.

    From experience, one method I've used to resolve Fedora 13 from hanging after a fresh install is to --> verify that only 1 video cable is plugged in the GPU(s). This applies to those who have a multiple monitor/GPU setup where you have 2 or more DVI,VGA,or HDMI cables connected to one or more GPUs.

    Once you have unplugged the extra video cables except for one, and have restarted the PC, you can now get passed the Fedora boot logo without freezing. You can also install the necessary graphic card drivers and your PC will boot correctly with multiple video cables plugged in.

9/2/10

Command of The Month - #chmod

USAGE:
#chmod 754 file_name.txt


    chmod is a command used to change the permissions of a flie(s). When using the ls -l command, permissions of a file are shown on the first column from the left. The first character in this column tells us what type of file it is. A dash for a normal file and "d" for directory. The rest describe a files permission. (fig 1)

fig 1:

-rw-------. 1 root root 1253 Jul 22 17:19 file1
-rwxr-xr-x. 1 root root  100 Sep  2 20:02 file2


r=read
w=write
x=execute


    After the first character, the next set of 3 positions represent the Users class. The following set of 3 represent the Group class and the last 3 set of characters represent the Others class.

fig 2:





     Class      Description
     ------       ---------------   
     user       owner of file
     group     users who are members of files group
     others    users who are not owners or members of the group


    To change permissions of each class, numbers are used to represent different types of permissions for the 3 different classes.

0 = no permissions
1 = execute only
2 = write only
3 = write and execute
4 = ready only
5 = read and execute
6 = read and write
7 = read, write, execute
  
    The example below gives full permissions (read, write, execute) to the User class, and only read and execute permissions to both Group and Others class.

#chmod 755 filename.txt

 


  
**For more in-depth information about chmod refer to the man pages.

Functions

What are functions?

-Functions are used to perform a repetitive task to reduce repetition within a shell script.

-Functions can be considered to be mini shell scripts that run within a shell script (think nesting).

-Arguments can be used in functions since they are essentially shell scripts themselves.


Example of a function:

#function.
see()
#Instructions to be performed when function is called.
echo "Here are users on $HOST"
echo
who -T | grep "+"
}

#calling the function in your script.
see

#end of example


-To run this function just type/call "see" anywhere in the script after your actual function and it will run.


8/20/10

Command of The Month - #top

USAGE: #top


-Displays CPU processes in real-time. It also displays the PID, command for that program, memory usage, active users... 





The following are some options that can be used with top.

-i    ignores any idle processes.

-p   monitors a process given it's PID.

-n   updates the display 'n' number of times then exits.
      usage: #top -n 5



**For more in-depth information about top refer to the man pages.

Chkconfig Tool

chkconfig provides a simple command-line tool for activating and deactivating services. It is used for managing the collection of symlinks in /etc/rc[0-6].d directories.

By simply typing chkconfig under root privileges you can see the list of services available indicating the init level the service is on for.

[root@localhost ~]# chkconfig

NetworkManager   0:off 1:off 2:on 3:on 4:on 5:on 6:off

abrtd                      0:off 1:off 2:off 3:on 4:off 5:on 6:off

acpid                      0:off 1:off 2:on 3:on 4:on 5:on 6:off

atd                          0:off 1:off 2:off 3:on 4:on 5:on 6:off


The following is an example disabling the bluetooth service on startup. This allows for computers like mine who don't have bluetooth the need for the PC to start the service.

#chkconfig bluetooth off
#chkconfig

bluetooth 0:off 1:off 2:off 3:off 4:off 5:off 6:off



**For more in-depth information using chkconfig refer to the man pages.

Using the Crontab utility

Cron is a scheduler for Unix and Linux OS' which can run commands or shell scripts automatically at a specific time.

Scheduling commands, shell scripts, or other programs to be ran automatically are contained in the file called:

/etc/crontab

This file contains jobs that are to be run automatically using a specific format. The cron utility is used to create, edit, and remove that file.

# Example of job definition:

# .---------------- minute (0 - 59)

# | .------------- hour (0 - 23)

# | | .---------- day of month (1 - 31)

# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...

# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

# | | | | |

# * * * * * command to be executed


The following is an example of a job scheduled in the crontab to automatically run a script every 5 hours during the week.

0   5   *   *   1-5   /home/documents/script

Or, check every minute for logins by user “Joe”

*   *   *   *   *    who | grep '^Joe'

Cron can also direct programs to be executed in directories for an hourly, daily, weekly, monthly basis. To do this, the crontab would have scheduling instructions to run commands contained in special subdirectories such as /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly, etc. This allows admins to just add programs to those directories. Making it even more easy to manage.