Ubuntu


Home Blog Tech News $ Basic Commands Scripting Tips And Tricks Terms Explanation Help+Links


##

How to copy-past file(cp):
SYNOPSIS:
cp [options] source dest
cp [options] source... directory

Descriptions:
cp copies each other given file into a file with the same name in that directory. Otherwise, if only two files are given, it copies the first onto the second.It is an error if the last argument is not a directory and more than two files are given. By default, it does not copy directories
–a, —archive Preserve as much as possible of the structure and attributes of the original files in the copy.
The same as –dpR.
–b, —backup Make backups of files that are about to be overwritten or removed.
–d, —no-dereference Copy symbolic links as symbolic links rather than copying the files that they point to, and
preserve hard link relationships between source files in the copies.
–f, —force Remove existing destination files.
-i, —interactive Prompt whether to overwrite existing regular destination files.
–l, —link Make hard links instead of copies of nondirectories.
–P, —parents Form the name of each destination file by appending to the target directory a slash and the
specified name of the source file. The last argument given to cp must be the name of an
existing directory. For example, the command cp —parents a/b/c existing_dir copies the
file a/b/c to existing_dir/a/b/c, creating any missing intermediate directories.
–p, —preserve Preserve the original files’ owner, group, permissions, and timestamps.
-r     Copy directories recursively, copying all nondirectories as if they were regular files.
–s, —symbolic-link Make symbolic links instead of copies of nondirectories. All source filenames must be
absolute (starting with /) unless the destination files are in the current directory. This
option produces an error message on systems that do not support symbolic links.
–u, —update Do not copy a nondirectory that has an existing destination with the same or newer
modification time.
–v, —verbose Print the name of each file before copying it.
–x, —one-file-system Skip subdirectories that are on different filesystems from the one that the copy started on.
–R, —recursive Copy directories recursively.
—help  Print a usage message on standard output and exit successfully.
—version Print version information on standard output then exit successfully.
–S, —suffix backup-suffix The suffix used for making simple backup files can be set with the
SIMPLE_BACKUP_SUFFIX environment variable, which can be overridden by this option. If neither of    
those is given,the default is ~, as it is in emacs.
–V, —version-control The type of backups made can be set with the VERSION_CONTROL environment variable, 

which{numbered,existing,simple} can be overridden by this option. If VERSION_CONTROL is not set and  this  option is not given,the default backup type is existing. The value of the VERSION_CONTROL  environment variable and the argument to this option are like the GNU emacs version- control variable; they also recognize synonyms that are more descriptive. The valid values are (unique abbrevia-tions are accepted) the following:t or numbered Always make numbered backups
nil or existing Make numbered backups of files that already have them,
simple backups of the others
never or simple Always make simple backups

##
cat: (Concatenate files and print on the standard output) . SYNOPSIS:
cat [–benstuvAET] [—number] [—number-nonblank] [—squeeze-blank]
[—show-nonprinting] [—show-ends] [—show-tabs] [—show-all]
[—help] [—version] [file...]

Description:

at writes the contents of each given file, or the standard input if
none are given or when a file named – is given, to the standard output.

–b, —number-nonblank       Number all nonblank output lines, starting with 1.
–e                                             Equivalent to –vE.
–n, —number                         Number all output lines, starting with 1.
–s, —squeeze-blank             Replace multiple adjacent blank lines with a single blank line.
–t                                             Equivalent to –vT.
–u                                            Ignored; for UNIX compatibility
–v, —show-nonprinting      Display control characters except for LFD and TAB using ˆ notation and precede characters that
have the high bit set with M-.
–A, —show-all                      Equivalent to –vET.
–E, —show-ends                  Display a $ after the end of each line.
–T, —show-tabs                   Display tab characters as ˆI.
—help                                     Print a usage message and exit with a nonzero status.
—version                               Print version information on standard output then exit.

##

Change the access permission of files(chmod):SYNOPSIS:

chmod [–Rcfv] [—recursive] [—changes] [—silent] [—quiet] [—verbose] [—help]
[—version] mode file...


OPTIONS:

chmod changes the permissions of each given file according to mode,
which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the
new permissions.
The format of a symbolic mode is [ugoa...][[+-=][rwxXstugo...]...][,...]. Multiple symbolic operations can be given,
separated by commas.
A combination of the letters ugoa controls which users’ access to the file will be changed: the user who owns it (u), other users
in the file’s group (g), other users not in the file’s group (o), or all users (a). If none of these are given, the effect is as if a were
given, but bits that are set in the umask are not affected.
The operator + causes the permissions selected to be added to the existing permissions of each file; - causes them to be
removed; and = causes them to be the only permissions that the file has.
The letters rwxXstugo select the new permissions for the affected users: read (r), write (w), execute (or access for directories)
(x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on
execution (s), save program text on swap device (t), the permissions that the user who owns the file currently has for it (u),
the permissions that other users in the file’s group have for it (g), and the permissions that other users not in the file’s group
have for it (o).
A numeric mode is from one to four octal digits (0–7), derived by adding up the bits with values 4, 2, and 1. Any omitted
digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and save text image (1)
attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third
selects permissions for other users in the file’s group, with the same values; and the fourth for other users not in the file’s
group, with the same values.
chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a
problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line,
chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive
directory traversals.

–c, —changes Verbosely describe only files whose permissions actually change.
–f, —silent, —quiet Do not print error messages about files whose permissions cannot be changed.
–v, —verbose Verbosely describe changed permissions.
–R, —recursive Recursively change permissions of directories and their contents.
—help Print a usage message on standard output and exit successfully.
—version Print version information on standard output, then exit successfully.

##

Checksum and count the bytes in a file(cksum): SYNOPSIS:

cksum [—help] [—version] [file...]

DESCRIPTION:
This manual page documents the GNU version of cksum. cksum computes a cyclic redundancy check (CRC) for each named
file, or the standard input if none are given or when a file named – is given. It prints the CRC for each file along with the
number of bytes in the file, and the filename unless no arguments were given.
cksum is typically used to make sure that files transferred by unreliable means (such as netnews) have not been corrupted. This
is accomplished by comparing the cksum output for the received files with the cksum output for the original files. The CRC
algorithm is specified by the POSIX.2 standard. It is not compatible with the BSD or System V sum programs; it is more
robust.

—help          Print a usage message and exit with a nonzero status.
—version    Print version information on standard output then exit.

##
Show and set date and time(date):

SYNOPSIS:

date [ –u ][–c ][–n ][–d dsttype ] [ –t minutes-west ] [ –a [+|-]sss.fff ][+format ][
[yyyy]mmddhhmm[yy][.ss]]

DESCRIPTION:
Date without arguments writes the date and time to the standard output in the form:

Wed Mar 8 14:54:40 EST 1989
with EST replaced by the local time zone’s abbreviation (or by the abbreviation for the time zone specified in the TZ environ-
ment variable if set). The exact output format depends on the locale.
If a command-line argument starts with a plus sign (+), the rest of the argument is used as a format that controls what
appears in the output. In the format, when a percent sign (%) appears, it and the character after it are not output, but rather
identify part of the date or time to be output in a particular way (or identify a special character to output):

Argument             Sample output                                             Explanation
%a                         Wed Abbreviated                                      weekday name*
%A                        Wednesday Full                                            weekday name*
%b                         Mar                                                              Abbreviated month name*
%B                         March                                                         Full month name*
%c                          Wed Mar 08 14:54:40 1989                       Date and time*
%C                         19                                                                  Century
%d                         08                                                                  Day of month (always two digits)
%D                        03/08/89                                                        Month/day/year (eight characters)
%e                         8                                                                 Day of month (leading zero blanked)
%h                         Mar                                                                     Abbreviated month name*
%H                         14                                                                 24-hour-clock hour (two digits)
%I                         02                                                                 12-hour-clock hour (two digits)
%j                         067                                                             Julian day number (three digits)
%k                         2                                                             12-hour-clock hour (leading zero blanked)
%l                         14                                                                     24-hour-clock hour (leading zero blanked)
%m                         03                                                             Month number (two digits)
%M                         54                                                                 Minute (two digits)
%n                         nn                                                                     Newline character
%p                         PM                                                                 AM/PM designation
%r                         02:54:40 PM                                                                         Hour:minute:second AM/PM designation
%R                         14:54                                                                         Hour:minute
%S                         40                                                                             Second (two digits)
%t                         nt                                                                             Tab character
%T                         14:54:40                                                                         Hour:minute:second
%U                         10                                                                             Sunday-based week number (two digits)
%w                         3                                                                             Day number (one digit, Sunday is 0)
%W                         10                                                             Monday-based week number (two digits)
%x                         03/08/89                                                              Date*
%X                         14:54:40                                                             Time*
%y                         89                                                                         Last two digits of year
%Y                         1989                                                                     Year in full
%Z                         EST                                                                     Time zone abbreviation
%+                         Wed Mar 8 14:54:40 EST 1989                         Default output format

* The exact output depends on the locale.

If a character other than one of those shown in the preceding table appears after a percent sign in the format, that following
character is output. All other characters in the format are copied unchanged to the output; a newline character is always
added at the end of the output.
In Sunday-based week numbering, the first Sunday of the year begins week 1; days preceding it are part of week 0. In
Monday-based week numbering, the first Monday of the year begins week 1.
To set the date, use a command-line argument with one of the following forms:

1454                                 24-hour-clock hours (first two digits) and minutes
081454                             Month day (first two digits), hours, and minutes
03081454                         Month (two digits, January is 01), month day, hours, minutes
8903081454                     Year, month, month day, hours, minutes
0308145489                     Month, month day, hours, minutes, year (on System V-compatible systems)
030814541989                 Month, month day, hours, minutes, four-digit year
198903081454                 Four-digit year, month, month day, hours, minutes
If the century, year, month, or month day is not given, the current value is used. Any of the preceding forms may be
followed by a period and two digits that give the seconds part of the new time; if no seconds are given, zero is assumed.
These options are available
–u or –c                          Use GMT when setting and showing the date and time.
–n                                    Do not notify other networked systems of the time change.
–d dsttype                     Set the kernel-stored Daylight Saving Time type to the given value. (The kernel-stored DST type is
used mostly by “old” binaries.)
–t minutes-west             Set the kernel-stored “minutes west of GMT” value to the one given on the command line. (The
kernel-stored DST type is used mostly by “old” binaries.)
–a adjustment                Change the time forward (or backward) by the number of seconds (and fractions thereof) specified
in the adjustment argument. Either the seconds part or the fractions part of the argument (but not
both) may be omitted. On BSD-based systems, the adjustment is made by changing the rate at
which time advances; on System-V–based systems, the adjustment is made by changing the time.

FILES

/usr/lib/locale/L/LC                                           TIME Description of time locale L
/usr/local/etc/zoneinfo                                     Time zone information directory
/usr/local/etc/zoneinfo/localtime                     Local time zone file
/usr/local/etc/zoneinfo/posixrules                  Used with POSIX-style TZs
/usr/local/etc/zoneinfo/GMT                           For UTC leap seconds
If /usr/local/etc/zoneinfo/GMT is absent, UTC leap seconds are loaded from /usr/local/etc/zoneinfo/posixrules.

##

See/Summarize free disk space (df): SYNOPSIS

df [–aikPv] [–t fstype] [–x fstype] [—all] [—inodes] [—type=fstype]
[—exclude–type=fstype] [—kilobytes] [—portability] [—print–type]
[—help] [—version] [filename...]

DESCRIPTION
This manual page documents the GNU version of df. df displays the amount of disk space available on the filesystem
containing each filename argument. If no filename is given, the space available on all currently mounted filesystems is shown.
Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte
blocks are used.
If an argument is the absolute filename of a disk device node containing a mounted filesystem, df shows the space available
on that filesystem rather than on the filesystem containing the device node (which is always the root filesystem). This version
of df cannot show the space available on unmounted filesystems, because on most kinds of systems doing so requires very
nonportable, intimate knowledge of filesystem structures.
–a, —all                                                                 Include in the listing filesystems that have 0 blocks, which are omitted by default. Such
filesystems are typically special-purpose pseudo-filesystems, such as automounter entries. On
some systems, filesystems of type ignore or auto are also omitted by default and included in the
listing by this option.
-i, —inodes                                                                 List inode usage information instead of block usage. An inode (short for “index node”) is a
special kind of disk block that contains information about a file, such as its owner, permissions,
timestamps, and location on the disk.
–k, —kilobytes                                                             Print sizes in 1K blocks instead of 512-byte blocks. This overrides the environment variable
POSIXLY_CORRECT.
–P, —portability                                                         Use the POSIX output format. This is like the default format except that the information about
each filesystem is always printed on exactly one line; a mount device is never put on a line by
itself. This means that if the mount device name is more than 20 characters long (as for some
network mounts), the columns are misaligned.113
–T, —print–type                                                 Print a type string for each filesystem. Any such printed filesystem type name may be used as an
argument to either of the —type= or —exclude–type= options.
–t, —type=fstype                                                 Limit the listing to filesystems of type fstype. Multiple filesystem types can be shown by giving
multiple –t options. By default, all filesystem types are listed.
–x, —exclude–type=fstype                                 Limit the listing to filesystems not of type fstype. Multiple filesystem types can be eliminated by
giving multiple –x options. By default, all filesystem types are listed.
–v                                                                             Ignored; for compatibility with System V versions of df.
—help                                                                 Print a usage message on standard output and exit successfully.
—version                                                             Print version information on standard output then exit successfully.

##

See/Summarize disk usage(du): SYNOPSIS

du [–abcklsxDLS] [—all] [—total] [—count-links] [—summarize] [—bytes]
[—kilobytes] [—one-file-system] [—separate-dirs] [—dereference]
[—dereference-args] [—help] [—-version] [filename...]

DESCRIPTION
This manual page documents the GNU version of du. du displays the amount of disk space used by each argument and for
each subdirectory of directory arguments. The space is measured in 1K blocks by default, unless the environment variable
POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

–a, —all                                     Display counts for all files, not just directories.
–b, —bytes                             Print sizes in bytes.
–c, —total                                 Write a grand total of all of the arguments after all arguments have been processed. This can
be used to find out the disk usage of a directory, with some files excluded.
–k, —kilobytes                        Print sizes in kilobytes. This overrides the environment variable POSIXLY_CORRECT.
–l, —count-links                     Count the size of all files, even if they have appeared already in another hard link.
–s, —summarize                     Display only a total for each argument.
–x, —one-file-system             Skip directories that are on different filesystems from the one that the argument being
processed is on.
–D, —dereference-args         Dereference symbolic links that are command-line arguments. Does not affect other
symbolic links. This is helpful for finding out the disk usage of directories like /usr/tmp
where they are symbolic links.
–L, —dereference                     Dereference symbolic links (show the disk space used by the file or directory that the link
points to instead of the space used by the link).
–S, —separate-dirs                     Count the size of each directory separately, not including the sizes of subdirectories.
—help                                         Print a usage message on standard output and exit successfully.
—version                                 Print version information on standard output, then exit successfully.

 

BUGS
On BSD systems, du reports sizes that are half the correct values for files that are NFS-mounted from HP-UX systems. On
HP-UX systems, it reports sizes that are twice the correct values for files that are NFS-mounted from BSD systems. This is
due to a flaw in HP-UX; it also affects the HP-UX du program.

Page 1

© 2009 | Touhidul Islam.                                                                             © 2009 | Touhidul Islam.
You are staying here for: seconds!
 


....