You are on page 1of 18

chmod a+r file read is added for all

chmod a-x file execute permission is removed for all


chmod a+rw file change the permissions of the file file to read and write for all.
chmod +rwx file
On some UNIX platforms such as BSD, this will restore the
permission of the file file to default: -rwxr-xr-x.
chmod u=rw,go= file
read and write is set for the owner, all permissions are cleared for the
group and others
chmod -R u+w,go-w change the permissions of the directory docs and all its contents to add
docs write access for the user, and deny write access for everybody else.
chmod file removes all privileges for all
chmod 777 file
change the permissions of the file file to read, write, and execute for
all.
chmod 664 file
sets read and write and no execution access for the owner and group,
and read, no write, no execute for all others.
chmod 0755 file
equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies
no special modes.
chmod 4755 file
the 4 specifies set user ID and the rest is equivalent to u=rwx
(4+2+1),go=rx (4+1 & 4+1).
chmod -R u+rwX,g- set a directory tree to rwx for owner directories, rw for owner files, ---
rwx,o-rwx directory for group and others.
chmod -R a-x+X remove the execute permission on all files in a directory tree, while
directory allowing for directory browsing.
The chmod command (abbreviated from change mode) is a Unix command that lets a programmer tell
the system how much (or little) access it should permit to a file. [1] It changes the file system modes of
files and directories. The modes include permissions and special modes. It is also a C language function
in Unix and Unix-like environments

Chown:

The chown command (abbreviation for change owner) is used on Unix-like systems to change
the owner of a file. In most implementations, it can only be executed by the superuser.
Unprivileged (regular) users who wish to change the group of a file that they own may use
chgrp.

These examples illustrate typical syntax and use. Because chown modifies permissions, it usually
requires root privilege to run.

# chown root /var/run/httpd.pid


 Change the owner of /var/run/httpd.pid to 'root' (the standard name for the
Superuser).

# chown rob:developers strace.log

 Change the owner of strace.log to 'rob' and the group identifier to 'developers'.

# chown nobody:nogroup /tmp /var/tmp

 Change the owner of /tmp and /var/tmp to ‘nobody’ (not a good idea)
 Change the group of /tmp and /var/tmp to ‘nogroup’

# chown :512 /home

 Change the group identifier of /home to 512 (regardless of whether a group name is
associated with the identifier 512 or not).

# chown -R us base

 Change the ownership of base to the user us and make it recursive (-R)

Chgrp:

The chgrp (from change group) command is used by unprivileged users on Unix-like systems to change
the group associated with a computer file. Unlike the chown command, chgrp allows regular users to
change groups, but only to one of which they are a member

The general syntax of the chgrp command is:

chgrp ''group'' ''target1'' [''target2'' ..]

 The group parameter indicates the new group with which the targets should be
associated. It may either be a symbolic name or an identifier.
 The target1 parameter indicates the files or directories for which the change should be
made.
 The target2 parameter indicates optional additional files or directories for which the
change should be made.

[edit] Usage example


$ ls -l ttt
-rw-r--r-- 1 gbeeker staff 545 Nov 04 2004 ttt
$ chgrp system ttt
$ ls -l ttt
-rw-r--r-- 1 gbeeker system 545 Nov 04 2004 ttt
Cksum:

cksum is a command in Unix-like operating systems that generates a checksum value for a file
or stream of data. The cksum command reads the file or files specified as arguments, or standard
input if no arguments are provided, and calculates a checksum value, cyclic redundancy check
(CRC) and the byte count. The checksum, number of bytes, and file name are written to standard
output.

The cksum command can be used to verify the equality of two files on different computers, such
as a copy made over noisy transmission lines.[1] (If the files are on the same computer, equality
can be verified with the cmp command.) The comparison made by the cksum command is not
cryptographically secure. However, it is unlikely that an accidentally damaged file will produce
the same checksum as the original file.

Syntax
cksum [ File ... ]

[edit] Usage example


$ cksum test.txt
4038471504 75 test.txt
$

"4038471504" represents the checksum value. "75" represents the file size of test.txt.

Cmp:

cmp is a command line utility for computer systems that use Unix or a Unix-like operating
system. It compares two files of any type and writes the results to the standard output. By
default, cmp is silent if the files are the same; if they differ, the byte and line number at which
the first difference occurred is reported.

cmp may be qualified by the use of command-line switches. The switches supported by the GNU
version of cmp are:
-b, --print-bytes 
Print differing bytes.
-i SKIP, --ignore-initial=SKIP 
Skip the first SKIP bytes of input.
-i SKIP1:SKIP2, --ignore-initial=SKIP1:SKIP2 
Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2.
-l, --verbose 
Output byte numbers and values of all differing bytes.
-n LIMIT, --bytes=LIMIT 
Compare at most LIMIT bytes.
-s, --quiet, --silent 
Output nothing; yield exit status only.
-v, --version 
Output version info.
--help 
Outputs a help file.

[edit] Return values


 0 - files are identical
 1 - files differ
 2 - inaccessible or missing argument

Usage
To copy a file to another file

cp [-f] [-H] [-i] [-p][--] SourceFile TargetFile

To copy a file to a directory

cp [-f] [-H] [-i] [-p] [-r | -R] [--] SourceFile ... TargetDirectory

To copy a directory to a directory (-r or -R must be used)

cp [-f] [-H] [-i] [-p] [--] { -r | -R } SourceDirectory ... TargetDirectory

[edit] Flags
-f (force) – specifies removal of the target file if it cannot be opened for write operations. The
removal precedes any copying performed by the cp command.

-H – makes the cp command follow symbolic links, that is, to copy files to which symbolic links
point. For example:
cp -H s_4_1.fastq ../../run_110419a/lane4

where ls -l

s_4_1.fastq -> ../../Illumina_export_files/s_4_1.fastq is a symbolic link to a multiple gigabyte


file.

cp -H copied the whole bloody file.

cp -P will just copy the symbolic link.

-i (interactive) – prompts you with the name of a file to be overwritten. This occurs if the
TargetDirectory or TargetFile parameter contains a file with the same name as a file specified in
the SourceFile or SourceDirectory parameter. If you enter y or the locale's equivalent of y, the cp
command continues. Any other answer prevents the cp command from overwriting the file.

-p (preserve) – duplicates the following characteristics of each SourceFile/SourceDirectory in the


corresponding TargetFile and/or TargetDirectory:

 The time of the last data modification and the time of the last access.
 The user ID and group ID (only if it has permissions to do this)
 The file permission bits and the SUID and SGID bits.

-R or -r (recursive) – copy directories (recursively copying all the contents)

[edit] Examples
To make a copy of a file in the current directory, enter:

cp prog.c prog.bak

This copies prog.c to prog.bak. If the prog.bak file does not already exist, the cp command
creates it. If it does exist, the cp command replaces its contents with the contents of the prog.c
file.

To copy a file in your current directory into another directory, enter:

cp jones /home/nick/clients

This copies the jones file to /home/nick/clients/jones.

To copy a file to a new file and preserve the modification date, time, and access control list
associated with the source file, enter:

cp -p smith smith.jr
This copies the smith file to the smith.jr file. Instead of creating the file with the current date and
time stamp, the system gives the smith.jr file the same date and time as the smith file. The
smith.jr file also inherits the smith file's access control protection.

To copy all the files in a directory to a new directory, enter:

cp /home/janet/clients/* /home/nick/customers

This copies only the files in the clients directory to the customers directory.

To copy a directory, including all its files and subdirectories, to another directory, enter:

cp -R /home/nick/clients /home/nick/customers

This copies the clients directory, including all its files, subdirectories, and the files in those
subdirectories, to the customers/clients directory. Be careful about including a trailing slash in
the source directory, however. If you run cp -R /home/nick/clients/
/home/nick/customers on a GNU-based system, it does the same thing as without the slash;
however, if you run the same thing on a BSD-based system, it will copy all the contents of the
"clients" directory over, instead of the "clients" directory itself.

To copy a specific set of files to another directory, enter:

cp jones lewis smith /home/nick/clients

This copies the jones, lewis, and smith files in your current working directory to the
/home/nick/clients directory.

To use pattern-matching characters to copy files, enter:

cp programs/*.c .

This copies the files in the programs directory that end with .c to the current directory, signified
by the single . (dot). You must type a space between the c and the final dot.

Copying a file to an existing file is done by opening the existing file in update mode which
requires write access and results in the target file retaining the permissions it had originally.

Dd:

Example use of dd command to create an ISO disk image from a CD-ROM:

dd if=/dev/cdrom of=/home/sam/myCD.iso bs=2048 conv=sync

Note that an attempt to copy the entire disk image using cp may omit the final block if it is an
unexpected length[citation needed]; dd will always complete the copy if possible.
Using dd to wipe an entire disk with random data:

dd if=/dev/urandom of=/dev/hda

Using dd to duplicate one hard disk partition to another hard disk:

dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=noerror

Using dd to clone a hard disk to another hard disk:

dd if=/dev/ad0 of=/dev/ad1 bs=1M conv=noerror

where ad0 is the source hard disk and ad1 is the destination hard disk in FreeBSD, where the
hard disk devices are named ad<no>. The target and destination disks should have the same size.

The noerror conversion option means to keep going if there is an error (though a better tool for
this would be ddrescue).

Duplicate a disk partition as a disk image file on a remote machine over a secure ssh connection:

dd if=/dev/sdb2 | ssh user@host "dd of=/home/user/partition.image"

Overwrite the first 512 bytes of a file with null bytes:

dd if=/dev/zero of=path/to/file bs=512 count=1 conv=notrunc

The notrunc conversion option means do not truncate the output file — that is, if the output file
already exists, just replace the specified bytes and leave the rest of the output file alone. Without
this option, dd would create an output file 512 bytes long.

To duplicate a disk partition as a disk image file on a different partition:

dd if=/dev/sdb2 of=/home/sam/partition.image bs=4096 conv=noerror

Create a 1 GiB file containing only zeros (bs=blocksize, count=number of blocks):

dd if=/dev/zero of=file1G.tmp bs=1M count=1024

To zero out a drive:

dd if=/dev/zero of=/dev/sda

To make sure that the drive is really zeroed out:

dd if=/dev/sda | hexdump -C | head

The output of this command will resemble the following if the drive is blank:
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
*
201f78000
16841664+0 records in
16841664+0 records out
8622931968 bytes (8.6 GB) copied, 1247.05 s, 6.9 MB/s

If the drive is blank, one line of blank bytes will be printed, followed by a '*' signifying repeated
blank lines, followed by a line indicating the address of the line which ends the repetition,
followed by the statistics which are printed after the output. The numbers in the statistics above
are illustrative. If the drive is not entirely blank, there will be more than one line of data output.

To duplicate the first 2 sectors of the floppy:

dd if=/dev/fd0 of=/home/sam/MBRboot.image bs=512 count=2

To create an image of the entire master boot record (including the partition table):

dd if=/dev/sda of=/home/sam/MBR.image bs=512 count=1

To create an image of only the boot code of the master boot record (without the partition table):

dd if=/dev/sda of=/home/sam/MBR_boot.image bs=446 count=1

To make drive benchmark test and analyze read and write performance:

dd if=/dev/zero bs=1024 count=1000000 of=/home/sam/1Gb.file


dd if=/home/sam/1Gb.file bs=64k | dd of=/dev/null

To make a file of 100 random bytes:

dd if=/dev/urandom of=/home/sam/myrandom bs=100 count=1

To convert a file to uppercase:

dd if=filename of=filename conv=ucase

To search the system memory:

dd if=/dev/mem | hexdump -C | grep 'some-string-of-words-in-the-file-you-


forgot-to-save-before-you-hit-the-close-button'

Image a partition to another machine:

On source machine:
dd if=/dev/hda bs=16065b | netcat < targethost-IP > 1234
On target machine:
netcat -l -p 1234 | dd of=/dev/hdc bs=16065b
Sending a SIGINFO signal (or a USR1 signal on Linux) to a running `dd' process makes it print
I/O statistics to standard error and then resume copying:

$ dd if=/dev/zero of=/dev/null& pid=$!


$ kill -USR1 $pid
18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB)
copied,
34.6279 seconds, 271 MB/s

Create a 1 GiB sparse file or resize an existing file to 1 GiB without overwriting:

dd if=/dev/zero of=mytestfile.out bs=1 count=0 seek=1G

Some implementations understand x as a multiplication operator in the block size and count
parameters:

dd bs=2x80x18b if=/dev/fd0 of=/tmp/floppy.image

where the "b" suffix indicates that the units are 512-byte blocks. Unix block devices use this as
their allocation unit by default.

For the value of bs field, following decimal number can be suffixed:

w means 2
b means 512
k means 1024
M specifies multiplication by 1024*1024
G specifies multiplication by 1024*1024*1024

Hence bs=2*80*18b means, 2*80*18*512=1474560 which is the exact size of 1440 KiB floppy
disk

To mount that image: mount -o loop floppy.image /mntpoint

[edit] Output messages


The GNU variant of dd as supplied with Linux does not describe the format of the messages
displayed on stdout on completion, however these are described by other implementations e.g.
that with BSD.

Each of the "Records in" and "Records out" lines shows the number of complete blocks
transferred + the number of partial blocks, e.g. because the physical medium ended before a
complete block was read.

[edit] ATA Disks over 128 GiB


Seagate documentation warns, "Certain disc utilities, such as DD, which depend on low-level
disc access may not support 48-bit LBAs until they are updated."[5] 48-bit LBA is required for
ATA harddrives over 128 GiB in size. However, in Linux, dd uses the kernel to read or write to
raw device files.[6] Support for 48-bit LBA has been present since version 2.4.23 of the kernel.[7][8]

[edit] Recovery-oriented variants of dd


Open Source unix-based programs for rescue include dd_rescue and dd_rhelp, which work
together, savehd7, or GNU ddrescue.

Antonio Diaz Diaz (the developer of GNU ddrescue) compares[9] the variants of dd for the task of
rescuing:

The standard utility dd does a linear read of the drive, so it can take a long time or even fry the
drive without rescuing anything if the errors are at the beginning of the drive. Kurt Garloff's
dd_rescue does basically the same thing as dd, only more efficiently. LAB Valentin's dd_rhelp
is a complex shell script that runs Garloff's dd_rescue many times, trying to be strategic about
copying the drive, but it is very inefficient.

 dd_rhelp first extracts all the readable data, and saves it to a file, inserting zeros where
bytes cannot be read. Then it tries to re-read the invalid data and update this file.
 GNU ddrescue can be used to copy data directly to a new disk if needed, just like Linux
dd.

dd_rhelp or GNU ddrescue will yield a complete disk image, faster but possibly with some
errors. GNU ddrescue is generally much faster, as it is written entirely in C++, whereas dd_rhelp
is a shell script acting as a frontend to dd_rescue. Both dd_rhelp and GNU ddrescue aim to copy
data fast where there are no errors, then copy in smaller blocks and with retries where there are
errors. GNU ddrescue is easy to use with default options, and can easily be downloaded and
compiled on Linux-based Live CDs such as Knoppix, and can be used with SystemRescueCD.

GNU ddrescue example [10]

# first, grab most of the error-free areas in a hurry:


ddrescue -n /dev/old_disk /dev/new_disk rescued.log
# then try to recover as much of the dicey areas as possible:
ddrescue -r 1 /dev/old_disk /dev/new_disk rescued.log

Savehd7 saves the harddisk partition in several phases [11]. Therefore it is not necessary to call
savehd7 with different parameters. Savehd7 works interactively in text mode and shows the
progress while it works. E.g.:

Processing - Press any key to pause (may take some time to react)
progress: okay: bad blks: fixed: bad bytes:
copy 2.6568% 2.6568% 0.0000% 0.0000% 0
There are large differences in how disk errors are processed by various kernels. Operating
systems such as FreeBSD, NetBSD, OpenBSD, Solaris, as well as different Linux kernels (i.e.
hda vs. sda (<2.6.20)) behave differently. Also, Linux lacks "raw" disk devices like *BSD has,
which makes it less desirable for low-level data recovery. Non-raw devices read larger blocks
than requested, obscuring the actual location where the error occurred. You may wish to use
"dmesg |tail -n8" to see the error messages on the console.

Du:

du (abbreviated from disk usage) is a standard Unix program used to estimate the file space
usage—space used under a particular directory or files on a file system.

Usage
du takes a single argument, specifying a pathname for du to work; if it is not specified, the
current directory is used. The SUS mandates for du the following options:

-a,display an entry for each file (and not directory) contained in the current directory
-H,calculate disk usage for link references specified on the command line
-k,show sizes as multiples of 1024 bytes, not 512-byte
-L,calculate disk usage for link references anywhere
-s,report only the sum of the usage in the current directory, not for each file
-x,only traverse files and directories on the device on which the pathname argument is
specified.

Other Unix and Unix-like operating systems may add extra options. For example, BSD and GNU
du specify a -h option, displaying disk usage in a format easier to read by the user, adding units
with the appropriate SI prefix (e.g. 10 MB).

[edit] Examples
Sum of directories in kilobytes:

$ du -sk *
152304 directoryOne
1856548 directoryTwo

Sum of directories in human-readable format (Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and
Petabyte):

$ du -sh *
149M directoryOne
1.8G directoryTwo

disk usage of all subdirectories and files including hidden files within the current directory
(sorted by filesize) :
$ du -sk .[!.]* *| sort -n

disk usage of all subdirectories and files including hidden files within the current directory
(sorted by reverse filesize) :

$ du -sk .[!.]* *| sort -nr

The weight of directories:

$ du -d 1 -c -h

Df:

df (abbreviation for disk free) is a standard Unix computer program used to display the amount
of available disk space for filesystems on which the invoking user has appropriate read access.
df is usually implemented by reading the mtab file or using statfs.

Usage
The Single UNIX Specification specifications for df are:

df [-k] [-P|-t] [-del] [file...]


-k
Use 1024-byte units, instead of the default 512-byte units, when writing space figures.
-P
Use a standard, portable, output format
-t
If XSI compliant, show allocated space as well[dubious – discuss]
-h
Display in Kb, Mb, or Gb
file
Write the amount of free space of the file system containing the specified file

Example
$ df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 32768 16016 52% 2271 14% /
/dev/hd2 4587520 1889420 59% 37791 4% /usr
/dev/hd9var 65536 12032 82% 518 4% /var
/dev/hd3 819200 637832 23% 1829 1% /tmp
/dev/hd1 524288 395848 25% 421 1% /home
/proc - - - - - /proc
/dev/hd10opt 65536 26004 61% 654 4% /opt

File: file is a standard Unix program for recognizing the type of data contained in a computer
file.
Usage
The SUS mandates the following options:

-M file, specify a file specially formatted containing position-sensitive tests; default


position-sensitive tests and context-sensitive tests will not be performed
-m file, as for -M, but default tests will be performed after the tests contained in file.
-d, perform default position-sensitive and context-sensitive tests to the given file; this is
the default behaviour unless -M or -m is specified
-h, identify symbolic links that point to an existing file or directory as such, rather than
following the link and reporting on the file to which it points
-i, do not classify the file further than to identify it as either: nonexistent, a block special
file, a character special file, a directory, a FIFO, a socket, a symbolic link, or a regular
file

Other Unix and Unix-like operating systems may add extra options than these.

[edit] Examples
# file file.c
file.c: C program text
# file program
program: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically
linked
(uses shared libs), stripped
# file /dev/wd0a
/dev/wd0a: block special (0/0)
# file -s /dev/hda1
/dev/hda1: Linux/i386 ext2 filesystem
# file -s /dev/hda5
/dev/hda5: Linux/i386 swap file
# file compressed.gz
compressed.gz: gzip compressed data, deflated, original filename,
`compressed', last
modified: Thu Jan 26 14:08:23 2006, os: Unix
# file data.ppm
data.ppm: Netpbm PPM "rawbits" image data

fsck: The system utility fsck (for "file system check") is a tool for checking the consistency of a
file system in Unix and Unix-like operating systems such as GNU/Linux.

The Microsoft equivalent programs are CHKDSK and SCANDISK

Example
The following example checks the file system on the first partition of the second hard disk on a
Linux system:
fsck /dev/sdb1

fuser: fuser is a UNIX command used to show which processes are using a specified file, file
system, or socket. For example:

# fuser -m -u /mnt/usb1
/mnt/usb1: 1347c(root) 1348c(guido) 1349c(guido)

fuser displays the PIDs of processes using the specified files or file systems. In the default
display mode, each file name is followed by a letter denoting the type of access:


current directory.

executable being run.

open file.

open file for writing.

root directory.

mmap'ed file or shared library

fuser returns a non-zero code if none of the files are accessed or in case of a fatal error. If at least
one access has succeeded, fuser returns zero. The output of "fuser" may be useful in diagnosing
"resource busy" messages arising when attempting to unmount filesystems.

[edit] Options
-k 
kills all process accessing a file. For example fuser -k /path/to/your/filename kills
all processes accessing this directory without confirmation. Use -i for confirmation
-i 
interactive mode. Prompt before killing process
-v 
verbose.
-u 
append username
-a 
display all files
-m 
name specifies a file on a mounted file system or a block device that is mounted. All
processes accessing files on that file system are listed. If a directory file is specified, it is
automatically changed to name/. to use any file system that might be mounted on that
directory.

Also note that -k sends a SIGKILL to all process. Use the -signal to send a different signal. For a
list of signals supported by the fuser run 'fuser -l'

ln: ln is a standard Unix command used to create links (link) to files.

Usage
The SUS mandates for ln two options: -f will force removal of existing files to allow the link to
be created; and -s will create symbolic links. Therefore, ln with no options creates a hard link,
ln -f forces a hard link, ln -s creates a symbolic link, and ln -fs forces a symbolic link. In
order to link to a folder (vs. a file), use the -n option so that the symbolic link is not
dereferenced: ln -sfn source/folder linked/folder/name.

Other Unix and Unix-like operating systems may add extra options. GNU ln adds options such
as -b to back up files before creating links, -v to print out the name of each file before links are
created, and others. BSD ln adds -h, preventing ln from descending into targets whose symlinks
point to directories

ln file_name link_name

would have the effect of creating a hard link called link_name that points to the same data as the
existing file file_name.

[edit] Symbolic link creation and deletion

The following shows the creation of a symbolic link slink.txt:

$ ln -s data.txt slink.txt

$ ls -li

969768 -rw-r--r-- 1 alex alex 10 Dec 9 09:11 data.txt

969817 lrwxrwxrwx 1 alex alex 8 Dec 9 09:11 slink.txt -> data.txt

The symbolic (soft) link is stored in a different inode than the text file (969817). The information
stored in data.txt is accessible through the slink.txt:

$ file slink.txt

slink.txt: symbolic link to `data.txt'

$ cat slink.txt

some data
If we delete the text file data.txt, slink.txt becomes a broken link and our data is lost.

$ rm data.txt

$ ls -li

969817 lrwxrwxrwx 1 alex alex 8 Dec 9 09:11 slink.txt -> data.txt

$ file slink.txt

slink.txt: broken symbolic link to `data.txt'

$ cat slink.txt

cat: slink.txt: No such file or directory

[edit] Hard link

If hlink.txt was a hard link, our data would still be accessible through hlink.txt. Also, if you
delete the original file, the hard-linked copy would still be there:

$ ln data.txt hlink.txt

$ ls -li

104690 -rw-r--r-- 2 sc69876 support 10 Aug 29 18:13 data.txt

104690 -rw-r--r-- 2 sc69876 support 10 Aug 29 18:13 hlink.txt

$ rm data.txt

$ ls -li

104690 -rw-r--r-- 1 sc69876 support 10 Aug 29 18:13 hlink.txt

$ cat hlink.txt

some data

ls: ls is a command to list files in Unix and Unix-like operating systems


 -l long format, displaying Unix file types, permissions, number of hard links, owner,
group, size, date, and filename
 -F appends a character revealing the nature of a file, for example, * for an executable, or
/ for a directory. Regular files have no suffix.
 -a lists all files in the given directory, including those whose names start with "." (which
are hidden files in Unix). By default, these files are excluded from the list.
 -R recursively lists subdirectories. The command ls -R / would therefore list all files.
 -d shows information about a symbolic link or directory, rather than about the link's
target or listing the contents of a directory.
 -t sort the list of files by modification time.
 -h print sizes in human readable format

Sample usage
The following example demonstrates the output of the ls command given two different
arguments:

$ pwd
/home/fred
$ ls -l
rwrx--rx-x 1 fred editors 3011 design
drwxr--r-- 1 fred editors 4096 drafts
-rw-r--r-- 1 fred editors 30405 edition-32
-r-xr-xr-x 1 fred fred 8460 edit
$ ls -F
drafts/
edition-32
edit*

In this example, the user fred has a directory named drafts, a regular file called edition-32,
and an executable named edit in his home directory. ls uses unix file permission notation to
indicate which users or groups are allowed to access each file or directory.

This means, in short, that the first column lists permissions for: user (u), owning group (g), and
others (o)

drwxr--r-- 1 fred editors 4096 Mar 1 2007 drafts

http://en.wikipedia.org/wiki/

Cp: cp is a UNIX command used to copy a file. Files can be copied either to the same directory or to a
completely different directory, possibly on a different file system or hard disk drive. If the file is copied
to the same directory, the new file must have a different name to the original; in all other cases, the new
file may have the same or a different name. The original file remains unchanged

You might also like