ONE COMMAND A DAY

29.04.2009

10> yum command.

SUMMERY:

yum-yellowdog updater modified. yum is an interactive, automated update program which can be used for maintaining systems using rpm.

SYNTAX:

install
Is used to install the latest version of a package or group of packages while ensuring that all dependencies are satisfied. If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed.
update
If run without any packages, update will update every currently installed package. If one or more packages are specified, Yum will only update the listed packages. While updating packages, yum will ensure that all dependencies are satisfied. If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed.If the –obsoletes flag is present yum will include package obsoletes in its calculations – this makes it better for distro-version changes, for example: upgrading from somelinux 8.0 to somelinux 9.

check-update
Implemented so you could know if your machine had any updates that needed to be applied without running it interactively. Returns exit value of 100 if there are packages available for an update. Also returns a list of the pkgs to be updated in list format. Returns 0 and no packages are available for update.
upgrade
Is the same as the update command with the –obsoletes flag set. See update for more details.
remove or erase
Are used to remove the specified packages from the system as well as removing any packages which depend on the package being removed.
list
Is used to list various information about available packages; more complete details are available in the List Options section below.
provides or whatprovides
Is used to find out which package provides some feature or file. Just use a specific name or a file-glob-syntax wildcards to list the packages available or installed that provide that feature or file.
search
Is used to find any packages matching a string in the description, summary, packager and package name fields of an rpm. Useful for finding a package you do not know by name but know by some word related to it.
info
Is used to list a description and summary information about available packages; takes the same arguments as in the List Options section below.
clean
Is used to clean up various things which accumulate in the yum cache directory over time. More complete details can be found in the Clean Options section below.
shell
Is used to enter the ‘yum shell’, when a filename is specified the contents of that file is executed in yum shell mode. See yum-shell(8) for more info
resolvedep
Is used to list packages providing the specified dependencies, at most one package is listed per dependency.
localinstall
Is used to install a set of local rpm files. If required the enabled repositories will be used to resolve dependencies.
localupdate
Is used to update the system by specifying local rpm files. Only the specified rpm files of which an older version is already installed will be installed, the remaining specified packages will be ignored. If required the enabled repositories will be used to resolve dependencies.
deplist
Produces a list of all dependencies and what packages provide those dependencies for the given packages.

General Options

Most command line options can be set using the configuration file as
well and the descriptions indicate the necessary configuration option to set.
-h, –help
Help; display a help message and then quit.
-y
Assume yes; assume that the answer to any question which would be asked is yes.
Configuration Option: assume-yes
-c [config file]
Specifies the config file location – can take http, ftp urls and local file paths.
-d [number]
Sets the debugging level to [number] – turns up or down the amount of things that are printed. Practical range: 0 – 10
Configuration Option: debuglevel
-e [number]
Sets the error level to [number] Practical range 0 – 10. 0 means print only critical errors about which you must be told. 1 means print all errors, even ones that are not overly important. 1+ means print more errors (if any) -e 0 is good for cron jobs.
Configuration Option: errorlevel
-R [time in minutes]
Sets the maximum amount of time yum will wait before performing a command – it randomizes over the time.
-C
Tells yum to run entirely from cache – does not download or update any headers unless it has to to perform the requested action.
–version
Reports the yum version number and exits.
–installroot=root
Specifies an alternative installroot, relative to which all packages will be installed.
Configuration Option: installroot
–enablerepo=repoidglob
Enables specific repositories by id or glob that have been disabled in the configuration file using the enabled=0 option.
Configuration Option: enabled
–disablerepo=repoidglob
Disables specific repositories by id or glob.
Configuration Option: enabled
–obsoletes
This option only has affect for an update, it enables yum‘s obsoletes processing logic. For more information see the update command above.
Configuration Option: obsoletes
–exclude=package
Exclude a specific package by name or glob from updates on all repositories.
Configuration Option: exclude
–noplugins
Run with all plugins disabled.
Configuration Option: plugins

List Options

The following are the ways which you can invoke yum in list mode. Note that all list commands include information on the version of the package.

yum list [all | glob_exp1] [glob_exp2] […]
List all available and installed packages.
yum list available [glob_exp1] […]
List all packages in the yum repositories available to be installed.
yum list updates [glob_exp1] […]
List all packages with updates available in the yum repositories.
yum list installed [glob_exp1] […]
List the packages specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.
yum list extras [glob_exp1] […]
List the packages installed on the system that are not available in any yum repository listed in the config file.
yum list obsoletes [glob_exp1] […]
List the packages installed on the system that are obsoleted by packages in any yum repository listed in the config file.
yum list recent
List packages recently added into the repositories.
Specifying package names
All the list options mentioned above take file-glob-syntax wildcards or package names as arguments, for example yum list available ‘foo*’ will list all available packages that match ‘foo*’. (The single quotes will keep your shell from expanding the globs.)

Clean Options

The following are the ways which you can invoke yum in clean
mode. Note that “all files” in the commands below means “all files in currently enabled repositories”. If you want to also clean any (temporarily) disabled repositories you need to use –enablerepo=’*’ option.
yum clean packages
Eliminate any cached packages from the system. Note that packages are not automatically deleted after they are downloaded.
yum clean headers
Eliminate all of the header files which yum uses for dependency resolution.
yum clean metadata
Eliminate all of the files which yum uses to determine the remote availability of packages. Using this option will force yum to download all the metadata the next time it is run.
yum clean dbcache
Eliminate the sqlite cache used for faster access to metadata. Using this option will force yum to recreate the cache the next time it is run.
yum clean all
Runs yum clean packages and yum clean headers as above.

EXAMPLES:

yum install packagename——–>       yum install openarena
yum whatprovides filename
yum remove appname
yum update.


ONE COMMAND A DAY

28.04.2009

9>rm command.

SUMMERY:
rm linux command is used to remove/delete the file from the directory.

SYNTAX:
The Syntax is
rm [options..] [file | directory]

OPTIONS:

-f     Remove all files in a directory without prompting the user.
-i     Interactive. With this option, rm prompts for confirmation before removing any files.
-r (or) -R     Recursively remove directories and subdirectories in the argument list. The directory will be emptied of files and removed. The user is normally prompted for removal of any write-protected files which the directory contains.

EXAMPLES:
1. To Remove / Delete a file:

rm file1.txt

Here rm command will remove/delete the file file1.txt.
2. To delete a directory tree:

rm -ir tmp

This rm command recursively removes the contents of all subdirectories of the tmp directory, prompting you regarding the removal of each file, and then removes the tmp directory itself.
3. To remove more files at once

rm file1.txt file2.txt

rm command removes file1.txt and file2.txt files at the same time.

ONE COMMAND A DAY

27.04.2009

8> mv command.

SUMMERY:

The Linux command ‘mv‘ can be use to rename files or to rename directory in Linux system. The ‘mv‘ command also can be use to moving the files or to moving directory to different directory. The ‘mv‘ command can be interpret as copying and then deleting the files or directory but this is done in much faster paste than manually copying and then deleting the files or folder.

SYNTAX:

mv [-f] [-i] oldname newname

-f mv will move the file(s) without prompting even if it is writing over an existing target. Note that this is the default if the standard input is not a terminal.
-i Prompts before overwriting another file.
oldname The oldname of the file renaming.
newname The newname of the file renaming.
filename The name of the file you want to move directory – The directory of were you want the file to go.

Examples

mv myfile.txt newdirectory/ – moves the file myfile.txt to the directory newdirectory.

mv myfile.txt ../ – moves the file myfile.txt back one directory (if available).

ONE COMMAND A DAY

25.04.2009

7>ln command.

SUMMERY

This command is used to create links to a files.Make links between files.

SYNTAX:

ln [-f] [-n] [-s] existingfile newname

-f Link files without questioning the user, even if the mode of target forbids writing. This is the default if the standard input is not a terminal.
-n Does not overwrite existing files.
-s Makes it so that it does not create a symbolic link existingfile – The file that you want to create a new link.
existingfile Specifies file(s) that you want to create a link to.
newname The new name of the file.
directory The directory were you want the new link.

EXAMPLES:

ln -s file1 file2

Creates a symbolic link to file1 with the name of the file2.


ONE COMMAND A DAY

24.04.2009

6>cat command

SUMMERY:

This command allows you to look,modify,or combine a file.It can be used to concatenate multiple files together and print result on screen.

SYNTAX:

cat filename[-n] [-b] [-u] [-s]

-n Precede each line output with its line number.
-b Number the lines, as -n, but omit the line numbers from blank lines.
-u The output is not buffered. (The default is buffered output.)
-s cat is silent about non-existent files.

– – help                             displays the help manual.

EXAMPLES:

cat file1.txt file2.txt > file3.txt – Reads file1.txt and file2.txt and combines those files to make file3.txt.

RELATED COMMAND:

tac command

This command concatenates or combines the files in reverse order.

(SOURCE for above tac command: LFY APRIL SUBSCRIPTION)

ONE COMMAND A DAY.

23.04.2009

5>find command.

SUMMERY:

Finds one or more files assuming that you know their approximate filenames.find – search for files in a directory hierarchy.

SYNTAX:

find path expressions

path A path name of a starting point in the directory hierarchy.
-atime n True if the file was accessed n days ago. The access time of directories in path is changed by find itself.
-cpio device Always true; write the current file on device in cpio format (5120-byte records).
-ctime n True if the file’s status was changed n days ago.
-depth Always true; causes descent of the directory hierarchy to be done so that all entries in a directory are acted on before the directory itself. This can be useful when find is used with cpio to transfer files that are contain edin directories without write permission.
-exec command True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped semicolon. A command argument {} is replaced by the current path name.
-follow Always true; causes symbolic links to be followed. When following symbolic links, find keeps track of the directories visited so that it can detect infinite loops; for example, such a loop would occur if a symbolic link pointed to an ancestor. This expression should not be used with the -type l expression.
-fstype type True if the filesystem to which the file belongs is of type type .
-group gname True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is taken as a group ID.
-inum n True if the file has inode number n.
-links True if the file has n links.
-local True if the file system type is not a remote file system type as defined in the /etc/dfs/fstypes file. nfsis used as the default remote filesystem type if the/etc/dfs/fstypes file is not present.
-ls Always true; prints current path name together
with its associated statistics. These include
(respectively):>inode number

>size in kilobytes (1024 bytes)

>protection mode

>number of hard links

>user

>group

>size in bytes

>modification time.

    If the file is a special file the size field will instead contain the major and minor device numbers.

    If the file is a symbolic link the pathname of the linked-to file is printed preceded by `->’. The format is identical to that of ls -gilds ls Note: Formatting is done internally, without executing the ls program.

    -mount Always true; restricts the search to the file system containing the directory specified. Does not list mount points to other file systems.
    -mtime n True if the file’s data was modified n days ago.
    -name pattern True if pattern matches the current file name.  Normal shell file name generation characters (see sh) may be used. A backslash (\) is used as an escape character within the pattern. The pattern should be escaped or quoted when find is invoked from the shell.
    -ncpio device Always true; write the current file on device in cpio -c format (5120 byte records).
    -newer file True if the current file has been modified more recently than the argument file.
    -nogroup True if the file belongs to a group not in the /etc/group file.
    -nouser True if the file belongs to a user not in the /etc/passwd file.
    -ok command Like -exec except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y.
    -perm [-]mode The mode argument is used to represent file mode bits. It will be identical in format to the <symbolicmode> operand described in chmod, and will be interpreted as follows. To start, a template will be assumed with all file mode bits cleared. An op symbol of:

    + will set the appropriate mode bits in the template;
    will clear the appropriate bits;
    = will set the appropriate mode bits, without regard to the contents of process’ file mode creation mask.

    The op symbol of – cannot be the first character of mode; this avoids ambiguity with the optional leading hyphen. Since the initial mode is all bits off, there are not any symbolic modes that need to use – as the first character.

    If the hyphen is omitted, the primary will evaluate as true when the file permission bits exactly match the value of the resulting template.

    Otherwise, if mode is prefixed by a hyphen, the primary will evaluate as true if at least all the bits in the resulting template are set in the file permission bits.

    -perm [-]onum True if the file permission flags exactly match the octal number onum see chmod). If onum is prefixed by a minus sign (-), only the bits that are set in onum are compared with the file permission flags, and the expression evaluates true if they match.
    -print Always true; causes the current path name to be printed.
    -prune Always yields true. Do not examine any directories or files in the directory structure below the pattern just matched. If -depth is specified, -prune will have no effect.
    -size n[c] True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in
    bytes.
    -type c True if the type of the file is c, where c is b, c, d, D, f, l, p, or s for block special file, character special file, directory, door, plain file, symbolic link, fifo (named pipe), or socket, respectively.
    -user uname True if the file belongs to the user uname . If uname is numeric and does not appear as a login name in the /etc/passwd file, it is taken as a user ID.
    -xdev Same as the -mount primary.

    When using find to determine files modified within a range of time, one must use the ?time argument before the -print argument; otherwise, find will give all files.

    EXAMPLES:

    find -name ‘mypage.htm’

    In the above command the system would search for any file named mypage.htm in the current directory and any subdirectory.

    find -name ‘*’ -size +1000k

    In the above example the system would search for any file that is larger then 1000k.

    ONE COMMAND A DAY

    22.04.2009

    3>who command.

    SUMMERY:


    The who command displays information about all users currently on the system. The following information is displayed: login name, tty, date and time of login. Typing who am i or who am I displays your login name, tty, date and time you logged in. If the user is logged in from a remote machine, then the host name of that machine is displayed as well.

    The who command can also display the elapsed time since line activity occurred, logins, logoffs, restarts, and changes to the system clock, as well as other processes generated by the initialization process.

    SYNTAX:

    -a Process /var/adm/utmp or the named file with -b, -d, -l, -p, -r, -t, -T, and -u options turned on.
    -b Indicate the time and date of the last reboot.
    -d Display all processes that have expired and not been respawned by init . The exit field appears for dead processes and contains the termination and exit values (as returned by wait), of the dead process. This can be useful in determining why a process terminated.
    -H Output column headings above the regular output.
    -l List only those lines on which the system is waiting for someone to login. The name field is LOGIN in such cases. Other fields are the same as for user entries except that the state field does not exist.
    -m Output only information about the current terminal.
    -n x Take a numeric argument, x, which specifies the number of users to display per line. x must be at least 1. The -n option may only be used with -q.

    man who always helps..