My Co-Authors

Vaishali Shah
Ivan Bayross

My Publishers

Shroff Publishers

I work with

SEEinfobiz Pvt. Ltd.

Web Directories

Directory India
Linux Operation Commands PDF Print E-mail

Command

mkdir

Purpose

Make directories

Synopsis

mkdir [option] ... NAME ...


Description:

The mkdir creates directories with the specified names.


Options:

-m MODE

Set the mode of created directories to MODE.

-p

Make any missing parent directories for each argument.



Command

rmdir

Purpose

Remove empty directories

Synopsis

rmdir [option] ... DIRECTORY ...


Description:

The rmdir removes empty directories. If any DIRECTORY argument does not refer to an existing empty directory, it is an error.


Options:

-p

Remove any parent directories that become empty after an argument DIRECTORY is removed.



Command

cd

Purpose

Changes the working directory

Synopsis

cd dirName


Description:

Change the current working directory to dirName.


Command

ls

Purpose

List directory contents

Synopsis

ls [options] [names]


Description:

The ls command program lists information about files (of any type, including directories). Options and file arguments can be intermixed arbitrarily, as usual.


For non-option command-line arguments that are directories, by default ls lists the contents of directories.


Options:

-a

List all files in directories, including files that start with '.'.

-L

In a long listing, show file information (e.g., times and permissions) for the referents of symbolic links rather than for the symbolic links themselves.

-I

In addition to the name of each file, print the file type, permissions, number of hard links, owner name, group name, size in bytes, and timestamp (by default, the modification time).

-t

Sort by modification time (the 'mtime 1 in the inode), newest first.

-u

Sort by access time (the atime in the inode). If the long listing format is being used, print the last access time.

-C

List files in columns, sorted vertically. This is the default for 'Is' if standard output is a terminal. It is always the default for the 'dir' and 'd' programs. GNU 'Is' uses variable width columns to display as many files as possible in the fewest lines.



Command

cp

Purpose

Copy files and directories

Synopsis

cp [option]... SOURCE DEST

cp [option]... SOURCE... DIRECTORY


Description:

The cp command copies files (or, optionally, directories). The copy is completely independent of the original. You can either copy one file to another, or copy arbitrarily many files to a destination directory.


If the last argument names an existing directory, cp copies each SOURCE file into that directory (retaining the same name). 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 non-option arguments are given.


By default, cp does not copy directories (see -r below).


The cp command generally refuses to copy a file onto itself, with the following exception: if--force --backup is specified with SOURCE and DEST identical, and referring to a regular file, cp will make a backup file, either regular or numbered, as specified in the usual ways.

Options:

-a

Preserve as much as possible of the structure and attributes original files in the copy (but do not preserve directory structure). Equivalent to -dpR.

-b

Make a backup of each file that would otherwise be overwritten or removed.

-d

Copy symbolic links as symbolic links rather than copying the files that they point to, and preserve hard links between source files in the copies.

-f

Remove existing destination files.

-i

Prompt whether to overwrite existing regular destination files.

-l

Make hard links instead of copies of non-directories.

-p

Preserve the original files' owner, group, permissions, and timestamps.



Command

mv

Purpose

Move (rename) files

Synopsis

mv [option] SOURCE DEST


Description:

The mv command moves or renames files (or directories). If the last argument names an existing directory, mv moves each other given file into a file with the same name in that directory. Otherwise, if only two files are given, it renames the first as the second. It is an error if the last argument is not a directory and more than two files are given.


Options:

-i

Prompt whether to overwrite each existing destination file, regardless of its permissions. If the response does not begin with y or Y , the file is skipped.

-u

Do not move a non directory that has an existing destination with the same

or newer modification time.



Command

rm

Purpose

Remove files or directories

Synopsis

rm [option] ... [file] ...


Description:

The rm command removes each given FILE. By default, it does not remove directories.


Options:

-d

Remove directories with unlink instead of rmdir, and don't require a directory to be empty before trying to unlink it. Only works if you have appropriate privileges. Because unlinking a directory causes any files in the deleted directory to become unreferenced, it is wise to fsck the filesystem after doing this.

-I

Prompt whether to remove each file. If the response does not begin with 'y'

or 'Y', the file is skipped.

-r

Remove the contents of directories recursively.



Command

cat

Purpose

Concatenate and write files

Synopsis

cat [option] [file] ...


Description:

The cat command copies each FILE (means standard input), or standard input if none are given, to standard output.


Options:

-A

Show-all

-n

Number all output lines, starting with 1

-s

Replace multiple adjacent blank lines with a single blank line.

-T

Display <TAB> characters as ' ^l '.



Command

more

Purpose

File perusal filter for crt viewing

Synopsis

more [options] [files] ...


Description:

The more command is a filter for paging through text one screen length at a time.


Options:

-num

This option specifies an integer which is the screen size (in lines).

-l

more usually treats ^L (form feed) as a special character, and will pause after any line that contains a form feed. The -I option will prevent this behavior.

-p

Do not scroll. Instead, clear the whole screen and then display the text.

-c

Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.

-s

Squeeze multiple blank lines into one.



Command

less

Purpose

Opposite of more

Synopsis

less [options] [filename] ...


Description:

The less command is a program similar to more, but which allows backward movement in the file as well as forward movement.


Options:

-c

Causes full screen repaints to be painted from the top line down.

-e

Causes less to automatically exit the second time it reaches end-of-file. By default, the only way to exit less is via the q command.



Command

head

Purpose

Output the first part of files

Synopsis

head [option] ... [file] ...


Description:

The head command prints the first part (10 lines by default) of each FILE; it reads from standard input if no files are given.

If more than one FILE is specified, head prints a one-line header consisting of ==> FILE NAME <== before the output for each FILE.


Options:

-c BYTES

Print the first BYTES bytes, instead of initial lines.

-n N

Output the first N lines.



Command

tail

Purpose

Output the last part of files

Synopsis

tail [option] ... [file] ...


Description:

The tail command prints the last part (10 lines by default) of each FILE.

If more than one FILE is specified, tail prints a one-line header consisting of ==> FILE NAME <== before the output for each FILE.


Options:

-COUNT

This option is only recognized if it is specified first. COUNT is a decimal number optionally followed by a size letter ( b , k , m ) as in -c , or l to mean count by lines, or other option letters ( cfqv ).

-n N

Output the last N lines.



Command

tailf

Purpose

Follows the growth of a log file

Synopsis

diff file1 file2


Description:

The tailf command will print out the last 10 lines of a file and then wait for the file to grow, tailf is extremely useful for monitoring log files on a laptop when logging is infrequent and the user desires that the hard disk spin down to conserve battery life.



Command

diff

Purpose

Finds differences between two files

Synopsis

tailf


Description:

In the simplest case, diff compares the contents of the two files from-file and to file. A file name of - stands for text read from the standard input. As a special case, diff compares a copy of standard input to itself.


Options:

-a

Treat all files as text and compare them line by line, even if they do not seem to be text.

-b

Ignore changes in amount of white space.

-B

Ignore changes that just insert or delete blank lines.



Command

grep

Purpose

Search one or more files that match a regular expression.

Synopsis

grep [options] pat [files]


Description:

The GREP command searches the input files for lines containing a match to a given pattern list. When it finds a match in a line, it copies the line to standard output (by default), or does whatever other sort of output you have requested with options. GREP expects to do the matching on text. Since newline is also a separator for the list of patterns, there is no.way to match newline characters in a text.


Options:

-c

Suppress normal output; instead print a count of matching lines for

each input file.

-e PATTERN

Use PATTERN as the pattern; useful to protect patterns beginning with a'-'.

-f FILE

Obtain patterns from FILE, one per line.



Command

cut

Purpose

Remove sections from each line of files

Synopsis

cut [options] ... [files] ...


Description:

This manual page documents the GNU version of cut. The cut command prints sections of each line of each input file, or the standard input if no files are given. A filename of - means standard input. The sections to be printed are selected by the options.


Options:

-b

Output only these bytes

-c

Output only these characters

-d

Use DELIM instead of TAB for field delimiter



Command

touch

Purpose

Change file access and modification time

Synopsis

touch [OPTION] ... FILE ...


Description:

Utility for updating access/modification times of a file to current system time or other specified time, but also useful for creating a new file. The command touch zzz will create a new file of zero length, named zzz , assuming that zzz did not previously exist. Time-stamping empty files in this way is useful for storing date information, for example in keeping track of modification times on a project.


The touch command is equivalent to : >> newfile or >> newfile (for ordinary files).


Options:

-a

Change the access time only.

-c

Do not create files that do not exist.

- d

Use TIME instead of the current time.

-f

Ignored; for compatibility with BSD versions of touch.

-m

Change the modification time only.

-r FILE1

Use the times of the reference FILE instead of the current time.



Command

wc

Purpose

Print byte, word, and line counts

Synopsis

we [option] ... [file] ...


Description:

The we command counts the number of bytes, whitespace-separated words, and newlines in each given FILE, or standard input if none are given or for a FILE of ' - '.


The wc prints one line of counts for each file, and if the file was given as an argument, it prints the file name following the counts.


Options:

-c

Print only the byte counts

-w

Print only the word counts.

-l

Print only the newline counts.



Command

sort

Purpose

Sort text files

Synopsis

sort [option] ... [file] ...


Description:

The sort command sorts, merges, or compares all the lines from the given files, or standard input if none are given or for a FILE of ' - '. By default, sort writes the results to standard output.


The sort command has three modes of operation: sort (the default), merge, and check for sortedness.


The following options change the operation mode:

-c

Check whether the given files are already sorted: if they are not all sorted, print an error message and exit with a status of 1. Otherwise, exit successfully.

-m

Merge the given files by sorting them as a group. Each input file must always be individually sorted. It always works to sort instead of merge; merging is provided because it is faster, in the case where it works.


Options:

-b

Ignore leading blanks when finding sort keys in each line.

-d

Sort in "phone directory" order: ignore all characters except letters, digits and blanks when sorting.

-f

Fold lowercase characters into the equivalent uppercase characters when sorting so that, for example, 'b' and 'B' sort as equal.

-i

Ignore characters outside the printable ASCII range 040-0176 octal (inclusive) when sorting.

-r

Reverse .the result of comparison, so that lines with greater key values appear earlier in the output instead of later.



Command

which

Purpose

Shows the full path of (shell) commands.

Synopsis

which [programname]


Description:

It prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt.



Command

whatis

Purpose

Search the whatis database for complete words.

Synopsis

whatis [keyword]


Description:

The whatis command searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. Only complete word matches are displayed.


The whatis database is created using the command /usr/sbin/makewhatis.



Command

whereis

Purpose

Locate the binary, source, and manual page files for a command

Synopsis

whereis [filename]


Description:

Description whereis locates source/binary and manuals sections for specified files. The supplied names are first stripped of leading pathname components and any (single) trailing extension.


Command

mount

Purpose

Mounts a file system

Synopsis

mount [-hV]
mount -a [-fFnrsvw] [-t vfstype]
mount [-fnrsvw] [-0 options [,...]] device f dir
mount [-fnrsvw] [-t vfstype] [-0 options] device dir


Description:

All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at / These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree. Conversely, the umount(8) command will detach it again.


The standard form of the mount command, is mount -t type device dir This tells the kernel to attach the file system found on device (which is of type type) at the directory dir. The previous contents (if any) and owner and mode of dir become invisible, and as long as this file system remains mounted, the pathname dir refers to the root of the file system on device.

The file /etc/fstab, may contain lines describing what devices are usually mounted where, using which options. This file is used in three ways:


The command mount -a [-t type] (usually given in a bootscript) causes all file systems mentioned in fstab (of the proper type) to be mounted as indicated, except for those whose line contains the noauto keyword. Adding the -F option will make mount fork, so that the filesystems are mounted simultaneously.


When mounting a file system mentioned in fstab, it suffices to give only the device, or only the mount point.

Normally, only the superuser can mount file systems. However, when fstab contains the user option on a line, then anybody can mount the corresponding system.


Thus, given a line /dev/cdrom /cd iso9660 ro, user, noauto, unhide any user can mount the iso9660 file system found on his CDROM using the command.


mount /dev/cdrom or mount /cd


For more details, only the user that mounted a filesystem can unmount it again. If any user should be able to unmount, then use users instead of user in the fstab line.



Command

umount

Purpose

Un-mounts file systems

Synopsis

umount [-hV]
umount -a [-nrv] [-t v fstype]
umount [-nrv] device | dir [...]


Description:

The umount command detaches the file system(s) mentioned from the file hierarchy. A file system is specified either by giving the directory where it has been mounted, or by giving the special device on which it lives.



Command

find

Purpose

Finds groups of files

Synopsis

find [pathnames] [conditions]


Description:

The find command is an extremely useful command for finding particular groups of files, find descends the directory tree beginning at each pathname and locates the files that meet the specified conditions. The default pathname is the current directory.


Options:

-group gname

Find files belonging to group gname. gname can be a group name or group ID.

-newer file

Find files that have been modified more recently than file.

-print

Print the matching files and directories, using their full pathnames.

-name pattern

Find files whose names match pattern.

-mtime +n | -n j n

Find files that were last modified more than n, less than n, or exactly n days ago.

-user user

Find files belonging to user (name or ID)



Command

fdformat

Purpose

Low-level formats a floppy disk

Synopsis

fdformat [‑n] device


Description:

The fdformat command does a low level format on a floppy disk. The generic floppy devices, /dev/fd0 and /dev/fd1 , will fail to work with fdformat when a non-standard format is being used, or if the format has not been autodetected earlier.


Options:

-n

No verify. This option will disable the verification that is performed after the format.



Command

mke2fs

Purpose

Create a Linux second extended file system

Synopsis

mke2fs [-c / -/ filename] [-b block-size] [-f frag-ment-size] [-V] , device


Description:

The mke2fs command is used to create a Linux second extended file system on a device (usually a disk partition).


Options:

-b block-size

Specify the size of blocks in bytes. Valid block size vales are

1024, 2048 and 4096 bytes per block

-c

Check the device for bad blocks before creating the file system, using a fast read-only test.

-f fragment-size

Specify the size of fragments in bytes.

‑F

Force mke2fs to run, even if the specified device is not a block special device, or appears to be mounted.

‑l filename

Read the bad blocks list from filename.

Set the volume label for the filesystem.

-q

Quiet execution. Useful if mke2fs is run in a script.

-v

Verbose execution.



Command

mkbootdisk

Purpose

Creates a stand-alone boot floppy for the running system

Synopsis

mkbootdisk <kernel version number>


Description:

The mkbootdisk command creates a boot floppy appropriate for the running system. The created boot disk looks for the root filesystem on the device suggested by /etc/fstab. The only required argument is the kernel version put onto the boot floppy.



Command

init

Purpose

Process control initialization

Synopsis

- -


Description:

Init is the parent of all processes. Its primary role is to create processes from a script stored in the file /etc/inittab. This file usually has entries, which cause init to spawn gettys on each line that users can log in. It also controls autonomous processes required by any particular system. New entries can be added to this file at any time. However, init still waits for one of the above three conditions to occur. To provide for an instantaneous response.

+/-
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.
+/- Comments
Add New Search RSS

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
Generated in 0.398949861526 Seconds