Basic Linux Commands

April 3, 2010
These list of Linux commands will help you when you are working with the Terminal


  • alias:         Allows you to set aliases and view the current aliases.
  • awk:          Search for a pattern within a file
  • alien:         Converts .tgz and rpm's to .deb format.
  • banner:       Prints characters as a poster.
  • badblocks:  Searches a device for bad blocks.
  • biff:             Turns mail notification on and off.
  • bg:             Move a job running in the foreground to the background.
  • bzip2:         Used to compress and decompress files. Similar to gzip
  • cardctl:      Used to control PCMCIA cards.
  • cfdisk:        Used to partition a hard disk.
  • cp:             Copy
  • chattr:        Changes the attributes of a file or folder.
  • chroot:       Change the root directory for a command.
  • chmod:       Used to change permissions on a directory or file.
  • chown:       Used to change the owner of a file or directory.
  • chgrp:         Used to change the group a file belongs to.
  • clear:         Clears the screen
  • cpio:          Copies file.
  • cat:            Displays the content of a file
  • chpasswd:  Used to change a large number of passwords at once.
  • cd:             Changes directories.
  • chage:        Sets password aging parameters.
  • cal:             Displays a calendar.
  • cron:           Used to execute commands at a certain time.
  • crontab:       Allows you to view or edit the current cron jobs.
  • dselect:       A graphical front end for dpkg.
  • dpkg:          Installs packages on debain distro's.
  • date:           Prints current date to the screen
  • du:              Lists disk usage in a directory.
  • df:               Reports disk usage information. df -h
  • dmesg:        Used to view the kernel boot file.
  • dump:          Used for backing up.
  • edquota:       Sets quotas for specific users.
  • env:              Lists current environment variables.
  • fdisk:         Used to create/edit/delete partitions.
  • fsck:          Checks a file system for consistency.
  • fg:              Used to send jobs to the background.
  • fuser:         Checks to see what processes and users have open files.
  • find:           Searches for a file.
  • free:           Will show total memory, used memory, and free memory.
  • gcc:               Used to compile C, Assembler, and Preprocessed C source.
  • gpasswd:       Used to set a password for a group.
  • grep:              Used to search through a file for a specified pattern.
  • getty:             Set terminal type, modes, speed, and line discipline
  • groupadd:       Create new group account.
  • groupdel:        Deletes a group.
  • groupmod:      Used to modify a group.
  • groups:          Shows what groups a user is part of.
  • gunzip:          Uncompress files compressed by gzip.
  • head:         Displays the first 10 lines of a file to the screen.
  • hdparm:     Gets disk information.
  • history:      Lists recently executed commands.
  • host:          Used to get DNS info.
  • htpasswd:  Allows you to set usernames and passwords for your websever.
  • id:            Display information about yourself or another user.
  • insmod:    Installs modules.
  • init:          Used to change run levels.
  • isapnp:     Sets up ISA cards.
  • icmpinfo:   Intercept and interpret ICMP packets
  • jobs:       Used to show jobs running in the background.
  • join:        Join lines of two sorted.
  • kill:           Used to kill a process.
  • killall:        Kill processes by command name.
  • kernelcfg:  A graphical application configures Linux.
  • klogd:       Control which kernel messages.
  • linuxconf:    A command line GUI which lets you configure your linux
  • lpc:            Used to control a line printer.
  • lpq:            View the print spool queue.
  • lpr:             Send files to the printer spool queue.
  • ls:              Displays a directories contents.
  • ln:              Used to create hard and symbolic links.
  • less:          Display the contents of a file
  • locate:       Search for a file or directory.
  • ldd:            Shows what shared libraries a program is dependent on.
  • ldconfig:     Used to configure/view shared libraries.
  • last:           Lists logins and reboots.
  • lastlog:       Print the last login times for system accounts.
  • lsmod:        Lists loaded modules.
  • lsattr:         Lists the attributes for a file or folder.
  • logrotate:    Used to manipulate log files.
  • mount:      Used by itself, reports the currently mounted files.
  • modinfo:    Give info about the module.
  • modprobe: Queries modules.
  • man:         Displays the Man page for a given command.
  • mesg:       Used to allow/not allow 'write'.
  • manpath:   Attempts to determine the path to a man page.
  • mail:         Used to send and receive mail.
  • mkdir:       Make directory
  • mke2fs:     Used to format a partition with the Ext2 file system.
  • mv:           Move/Rename
  • merge:      Merge multiple files together.
  • more:        Lets you page through text one screen full at a time.
  • minicom:   Great utility for troublshooting a modem.
  • mkbootdisk: Used to make a boot disk.
  • ntsysv:     Used to select what services should automatically start.
  • nice:        Used to set process priorities.
  • nslookup: Used to get DNS info from name servers.
  • netstat:    Shows active sockets.
  • ps:             Displays current processes.
  • ping:           Used to test connectivity between two hosts.
  • pwd:           Present Working Directory
  • pwconv:       Used to set up the /etc/shadow file.
  • pnpdump:    Determines settings for existing ISA cards.
  • quota:      Allows users to view their own disk quotas.
  • quotaon:   Turns on disk quotas for the system.
  • quotaoff:   Turns off disk quotas for the system.
  • repquota: Provides reports of disk usage for various users.
  • rmmod:   Removes modules.
  • rm:         Remove
  • rmdir:      Remove directory
  • rpm:        (RedHat flavors only)Used to install RPM's
  • rpcinfo:    Used to see what rpc services are available.
  • route:      Used to view/change routes between you and other hosts.

  • smbclient:     Used to connect to Windows shares or Samba.
  • smbadduser: Maps linux user names to Windows NT user names.
  • smbpasswd:  Used to update the smbpasswd file with new accounts.
  • set:               Used to read and write variables.
  • setquota:       Used to set disk quotas.
  • sort:              Sorts lines in a file by alphabetical order.
  • sndconfig:      Used to probe and configure a sound card.
  • su:                Change to Super User (root).
  • spell:             Checks for spelling errors in a file.
  • startx:           Start the X Server (GUI)
  • shutdown:      Shutdown machine
  • suspend:        Places a shell in the background.
  • showmount:   Shows mount information for an NFS server.
  • swapon:         Turns on the swapfile.
  • swapoff:         Turns off the swapfile.
  • testparm:    Used to troubleshoot Samba.
  • tar:             Used to compress multiple files.
  • timeconfig:  Used to set the timezone on your machine.
  • tac:            View a file from the last line up.
  • touch:        Creates an empty file.
  • tail:            Displays the last 10 lines of a file to the screen.
  • talk:           Used to chat with another user on the same machine.
  • tr:              Converts one set of characters to another.
  • traceroute:  Used to track the path a packet takes to a host.
  • top:            Shows information about the most CPU-intensive Apps.
  • useradd:     Add a user.
  • usermod:    Modify a user.
  • userdel:      Delete a user.
  • umount:      Removes a device from the filesystem.
  • updatedb:   Updates the locate database.
  • uname:       Determines OS name, version and machine name.
  • vmstat:     Lists information on memory usage.
  • vi:            A text editor
  • whereis:   Finds documentation files.
  • who:        Tells you who is logged into your server.
  • whoami:   Tells you your user information.
  • wc:          Print the number of bytes, words, and lines in files
  • which:      Finds the full path for a command.
  • write:       Used to send a message to another user.
  • whois:      Used to query servers for info on.
  • wall:        Writes a message to all logged in users.
  • xman:        Graphical interface for man pages.
  • xf86config: Used to configure X.
  • zcat:       Read files that have been compressed with gzip.


Print lines matching a pattern with the command : grep

December 12, 2009
       grep, egrep, fgrep, rgrep - print lines matching a pattern

       grep [OPTIONS] PATTERN [FILE...]
       grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]

       grep  searches  the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is
       given as file name) for lines containing a match to the given PATTERN.   By  default,  grep  prints  the  matching

       In addition, three variant programs egrep, fgrep and rgrep are available.  egrep is the same as grep -E.  fgrep is
       the same as grep -F.  rgrep is the same as grep -r.  Direct invocation as either egrep or fgrep is deprecated, but
       is provided to allow historical applications that rely on them to run unmodified.

   Generic Program Information
       --help Print  a  usage  message briefly summarizing these command-line options and the bug-reporting address, then

       -V, --version
              Print the version number of grep to the standard output stream.  This version number should be included  in
              all bug reports (see below).

   Matcher Selection
       -E, --extended-regexp
              Interpret PATTERN as an extended regular expression (ERE, see below).  (-E is specified by POSIX.)

       -F, --fixed-strings
              Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.  (-F is
              specified by POSIX.)

       -G, --basic-regexp
              Interpret PATTERN as a basic regular expression (BRE, see below).  This is the default.

       -P, --perl-regexp
              Interpret PATTERN as a Perl regular expression.  This is highly  experimental  and  grep  -P  may  warn  of
              unimplemented features.

   Matching Control
       -e PATTERN, --regexp=PATTERN
              Use  PATTERN as the pattern.  This can be used to specify multiple search patterns, or to protect a pattern
              beginning with a hyphen (-).  (-e is specified by POSIX.)

       -f FILE, --file=FILE
              Obtain patterns from FILE, one per line.  The empty file contains  zero  patterns,  and  therefore  matches
              nothing.  (-f is specified by POSIX.)

       -i, --ignore-case
              Ignore case distinctions in both the PATTERN and the input files.  (-i is specified by POSIX.)

       -v, --invert-match
              Invert the sense of matching, to select non-matching lines.  (-v is specified by POSIX.)

       -w, --word-regexp
              Select  only those lines containing matches that form whole words.  The test is that the matching substring
              must either be at the beginning of the line, or preceded by a non-word constituent  character.   Similarly,
              it must be either at the end of the line or followed by a non-word constituent character.  Word-constituent
              characters are letters, digits, and the underscore.

       -x, --line-regexp
              Select only those matches that exactly match the whole line.  (-x is specified by POSIX.)

       -y     Obsolete synonym for -i.

   General Output Control
       -c, --count
              Suppress normal output; instead print a count of  matching  lines  for  each  input  file.   With  the  -v,
              --invert-match option (see below), count non-matching lines.  (-c is specified by POSIX.)

       --color[=WHEN], --colour[=WHEN]
              Surround  the  matched  (non-empty)  strings, matching lines, context lines, file names, line numbers, byte
              offsets, and separators (for fields and groups of context lines) with escape sequences to display  them  in
              color  on  the  terminal.   The colors are defined by the environment variable GREP_COLORS.  The deprecated
              environment variable GREP_COLOR is still supported, but its setting does not have priority.  WHEN is never,
              always, or auto.

       -L, --files-without-match
              Suppress  normal output; instead print the name of each input file from which no output would normally have
              been printed.  The scanning will stop on the first match.

       -l, --files-with-matches
              Suppress normal output; instead print the name of each input file from which  output  would  normally  have
              been printed.  The scanning will stop on the first match.  (-l is specified by POSIX.)

       -m NUM, --max-count=NUM
              Stop  reading a file after NUM matching lines.  If the input is standard input from a regular file, and NUM
              matching lines are output, grep ensures that the standard input  is  positioned  to  just  after  the  last
              matching line before exiting, regardless of the presence of trailing context lines.  This enables a calling
              process to resume a search.  When grep stops after NUM matching lines,  it  outputs  any  trailing  context
              lines.   When  the  -c or --count option is also used, grep does not output a count greater than NUM.  When
              the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.

       -o, --only-matching
              Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.

       -q, --quiet, --silent
              Quiet; do not write anything to standard output.  Exit immediately with zero status if any match is  found,
              even if an error was detected.  Also see the -s or --no-messages option.  (-q is specified by POSIX.)

       -s, --no-messages
              Suppress  error  messages  about  nonexistent  or unreadable files.  Portability note: unlike GNU grep, 7th
              Edition Unix grep did not conform to POSIX, because it lacked -q and its -s option behaved like GNU  grep's
              -q  option.  USG-style grep also lacked -q but its -s option behaved like GNU grep.  Portable shell scripts
              should avoid both -q and -s and should redirect standard and error output to  /dev/null  instead.   (-s  is
              specified by POSIX.)

   Output Line Prefix Control
       -b, --byte-offset
              Print the 0-based byte offset within the input file before each line of output.  If -o (--only-matching) is
              specified, print the offset of the matching part itself.

       -H, --with-filename
              Print the file name for each match.  This is the default when there is more than one file to search.

       -h, --no-filename
              Suppress the prefixing of file names on output.  This is the default when there is only one file  (or  only
              standard input) to search.

              Display  input  actually  coming  from  standard input as input coming from file LABEL.  This is especially
              useful for tools like zgrep, e.g., gzip -cd foo.gz | grep --label=foo something

       -n, --line-number
              Prefix each line of output with the 1-based line number within its input file.  (-n is specified by POSIX.)

       -T, --initial-tab
              Make sure that the first character of actual line content lies on a tab stop, so that the alignment of tabs
              looks  normal.   This is useful with options that prefix their output to the actual content: -H,-n, and -b.
              In order to improve the probability that lines from a single file will all start at the same  column,  this
              also causes the line number and byte offset (if present) to be printed in a minimum size field width.

       -u, --unix-byte-offsets
              Report Unix-style byte offsets.  This switch causes grep to report byte offsets as if the file were a Unix-
              style text file, i.e., with CR characters stripped off.  This will produce  results  identical  to  running
              grep  on  a  Unix  machine.   This  option has no effect unless -b option is also used; it has no effect on
              platforms other than MS-DOS and MS-Windows.

       -Z, --null
              Output a zero byte (the ASCII NUL character) instead of the character that normally follows  a  file  name.
              For  example,  grep -lZ outputs a zero byte after each file name instead of the usual newline.  This option
              makes the output unambiguous, even in the  presence  of  file  names  containing  unusual  characters  like
              newlines.   This  option  can  be  used  with commands like find -print0, perl -0, sort -z, and xargs -0 to
              process arbitrary file names, even those that contain newline characters.

   Context Line Control
       -A NUM, --after-context=NUM
              Print NUM lines of trailing context after matching lines.  Places a line containing a group separator  (--)
              between  contiguous  groups  of  matches.   With the -o or --only-matching option, this has no effect and a
              warning is given.

       -B NUM, --before-context=NUM
              Print NUM lines of leading context before matching lines.  Places a line containing a group separator  (--)
              between  contiguous  groups  of  matches.   With the -o or --only-matching option, this has no effect and a
              warning is given.

       -C NUM, -NUM, --context=NUM
              Print NUM lines of output context.  Places a line containing a  group  separator  (--)  between  contiguous
              groups of matches.  With the -o or --only-matching option, this has no effect and a warning is given.

   File and Directory Selection
       -a, --text
              Process a binary file as if it were text; this is equivalent to the --binary-files=text option.

              If  the  first  few bytes of a file indicate that the file contains binary data, assume that the file is of
              type TYPE.  By default, TYPE is binary, and grep normally outputs either a one-line message saying  that  a
              binary  file  matches,  or  no message if there is no match.  If TYPE is without-match, grep assumes that a
              binary file does not match; this is equivalent to the -I option.  If TYPE is text, grep processes a  binary
              file  as  if  it  were  text; this is equivalent to the -a option.  Warning: grep --binary-files=text might
              output binary garbage, which can have nasty side effects if the output is a terminal and  if  the  terminal
              driver interprets some of it as commands.

       -D ACTION, --devices=ACTION
              If  an input file is a device, FIFO or socket, use ACTION to process it.  By default, ACTION is read, which
              means that devices are read just as if they were ordinary files.  If ACTION is skip, devices  are  silently

       -d ACTION, --directories=ACTION
              If  an  input  file is a directory, use ACTION to process it.  By default, ACTION is read, which means that
              directories are read just as if they were ordinary files.  If ACTION  is  skip,  directories  are  silently
              skipped.   If ACTION is recurse, grep reads all files under each directory, recursively; this is equivalent
              to the -r option.

              Skip files whose base name matches GLOB (using wildcard matching).  A file-name glob  can  use  *,  ?,  and
              [...]  as wildcards, and \ to quote a wildcard or backslash character literally.

              Skip  files  whose  base name matches any of the file-name globs read from FILE (using wildcard matching as
              described under --exclude).

              Exclude directories matching the pattern DIR from recursive searches.

       -I     Process  a  binary  file  as  if  it  did  not  contain  matching  data;  this   is   equivalent   to   the
              --binary-files=without-match option.

              Search only files whose base name matches GLOB (using wildcard matching as described under --exclude).

       -R, -r, --recursive
              Read all files under each directory, recursively; this is equivalent to the -d recurse option.

   Other Options
              Use line buffering on output.  This can cause a performance penalty.

       --mmap If  possible,  use  the  mmap(2) system call to read input, instead of the default read(2) system call.  In
              some situations, --mmap yields better performance.  However, --mmap can cause undefined behavior (including
              core dumps) if an input file shrinks while grep is operating, or if an I/O error occurs.

       -U, --binary
              Treat  the  file(s)  as  binary.   By  default,  under MS-DOS and MS-Windows, grep guesses the file type by
              looking at the contents of the first 32KB read from the file.  If grep decides the file is a text file,  it
              strips  the  CR  characters  from the original file contents (to make regular expressions with ^ and $ work
              correctly).  Specifying -U overrules this guesswork, causing all  files  to  be  read  and  passed  to  the
              matching mechanism verbatim; if the file is a text file with CR/LF pairs at the end of each line, this will
              cause some regular expressions to fail.  This option has no effect on platforms other than MS-DOS  and  MS-

       -z, --null-data
              Treat  the  input  as a set of lines, each terminated by a zero byte (the ASCII NUL character) instead of a
              newline.  Like the -Z or --null option, this option can be used with  commands  like  sort  -z  to  process
              arbitrary file names.

       A  regular  expression  is  a  pattern  that  describes  a  set  of  strings.  Regular expressions are constructed
       analogously to arithmetic expressions, by using various operators to combine smaller expressions.

       grep understands two different versions of regular expression syntax: “basic” and “extended.”  In GNU grep,  there
       is  no  difference  in  available  functionality  using  either  syntax.   In other implementations, basic regular
       expressions are less powerful.  The following description applies to extended regular expressions; differences for
       basic regular expressions are summarized afterwards.

       The  fundamental  building  blocks  are  the  regular expressions that match a single character.  Most characters,
       including all letters and digits, are regular expressions that match themselves.  Any meta-character with  special
       meaning may be quoted by preceding it with a backslash.

       The period . matches any single character.

   Character Classes and Bracket Expressions
       A  bracket  expression is a list of characters enclosed by [ and ].  It matches any single character in that list;
       if the first character of the list is the caret ^ then it matches any character not in the list.  For example, the
       regular expression [0123456789] matches any single digit.

       Within  a bracket expression, a range expression consists of two characters separated by a hyphen.  It matches any
       single character that sorts between the two characters, inclusive,  using  the  locale's  collating  sequence  and
       character set.  For example, in the default C locale, [a-d] is equivalent to [abcd].  Many locales sort characters
       in dictionary order, and in these locales [a-d] is typically not equivalent to [abcd]; it might be  equivalent  to
       [aBbCcDd], for example.  To obtain the traditional interpretation of bracket expressions, you can use the C locale
       by setting the LC_ALL environment variable to the value C.

       Finally, certain named classes of characters are predefined within bracket expressions, as follows.   Their  names
       are  self  explanatory,  and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:],
       [:punct:], [:space:], [:upper:], and [:xdigit:].  For example, [[:alnum:]] means [0-9A-Za-z],  except  the  latter
       form  depends  upon the C locale and the ASCII character encoding, whereas the former is independent of locale and
       character set.  (Note that the brackets in these class names are part of the symbolic names, and must be  included
       in  addition  to the brackets delimiting the bracket expression.)  Most meta-characters lose their special meaning
       inside bracket expressions.  To include a literal ] place it first in the list.  Similarly, to include a literal ^
       place it anywhere but first.  Finally, to include a literal - place it last.

       The  caret  ^  and the dollar sign $ are meta-characters that respectively match the empty string at the beginning
       and end of a line.

   The Backslash Character and Special Expressions
       The symbols \< and \> respectively match the empty string at the beginning and end  of  a  word.   The  symbol  \b
       matches the empty string at the edge of a word, and \B matches the empty string provided it's not at the edge of a
       word.  The symbol \w is a synonym for [[:alnum:]] and \W is a synonym for [^[:alnum:]].

       A regular expression may be followed by one of several repetition operators:
       ?      The preceding item is optional and matched at most once.
       *      The preceding item will be matched zero or more times.
       +      The preceding item will be matched one or more times.
       {n}    The preceding item is matched exactly n times.
       {n,}   The preceding item is matched n or more times.
       {,m}   The preceding item is matched at most m times.
       {n,m}  The preceding item is matched at least n times, but not more than m times.

       Two regular expressions may be concatenated; the  resulting  regular  expression  matches  any  string  formed  by
       concatenating two substrings that respectively match the concatenated expressions.

       Two regular expressions may be joined by the infix operator |; the resulting regular expression matches any string
       matching either alternate expression.

       Repetition takes precedence over concatenation,  which  in  turn  takes  precedence  over  alternation.   A  whole
       expression may be enclosed in parentheses to override these precedence rules and form a subexpression.

   Back References and Subexpressions
       The  back-reference  \n,  where  n  is  a  single  digit,  matches  the  substring  previously  matched by the nth
       parenthesized subexpression of the regular expression.

   Basic vs Extended Regular Expressions
       In basic regular expressions the meta-characters ?, +, {, |, (, and ) lose their special meaning; instead use  the
       backslashed versions \?, \+, \{, \|, \(, and \).

       Traditional  egrep  did  not  support  the { meta-character, and some egrep implementations support \{ instead, so
       portable scripts should avoid { in grep -E patterns and should use [{] to match a literal {.

       GNU grep -E attempts to support traditional usage by assuming that { is not special if it would be the start of an
       invalid  interval  specification.   For example, the command grep -E '{1' searches for the two-character string {1
       instead of reporting a syntax error in the regular expression.  POSIX.2 allows this behavior as an extension,  but
       portable scripts should avoid it.

       The behavior of grep is affected by the following environment variables.

       The  locale for category LC_foo is specified by examining the three environment variables LC_ALL, LC_foo, LANG, in
       that order.  The first of these variables that is set specifies the locale.  For example, if LC_ALL  is  not  set,
       but LC_MESSAGES is set to pt_BR, then the Brazilian Portuguese locale is used for the LC_MESSAGES category.  The C
       locale is used if none of these environment variables are set, if the locale catalog is not installed, or if  grep
       was not compiled with national language support (NLS).

              This  variable  specifies  default  options to be placed in front of any explicit options.  For example, if
              GREP_OPTIONS is '--binary-files=without-match --directories=skip', grep  behaves  as  if  the  two  options
              --binary-files=without-match and --directories=skip had been specified before any explicit options.  Option
              specifications are separated by whitespace.  A backslash escapes the next character, so it can be  used  to
              specify an option containing whitespace or a backslash.

              This variable specifies the color used to highlight matched (non-empty) text.  It is deprecated in favor of
              GREP_COLORS, but still supported.  The mt, ms, and mc capabilities of GREP_COLORS have  priority  over  it.
              It  can  only  specify  the  color  used  to  highlight the matching non-empty text in any matching line (a
              selected line when the -v command-line option is omitted, or a context line when  -v  is  specified).   The
              default is 01;31, which means a bold red foreground text on the terminal's default background.

              Specifies  the  colors  and other attributes used to highlight various parts of the output.  Its value is a
              colon-separated list of capabilities  that  defaults  to  ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36
              with the rv and ne boolean capabilities omitted (i.e., false).  Supported capabilities are as follows.

              sl=    SGR  substring  for  whole  selected  lines (i.e., matching lines when the -v command-line option is
                     omitted, or non-matching lines when -v is specified).  If however the boolean rv capability and  the
                     -v  command-line  option  are  both  specified,  it  applies to context matching lines instead.  The
                     default is empty (i.e., the terminal's default color pair).

              cx=    SGR substring for whole context lines (i.e., non-matching lines when the -v command-line  option  is
                     omitted,  or  matching lines when -v is specified).  If however the boolean rv capability and the -v
                     command-line option are both specified, it applies to  selected  non-matching  lines  instead.   The
                     default is empty (i.e., the terminal's default color pair).

              rv     Boolean  value  that  reverses  (swaps)  the  meanings  of  the sl= and cx= capabilities when the -v
                     command-line option is specified.  The default is false (i.e., the capability is omitted).

                     SGR substring for matching non-empty text in any matching line (i.e., a selected line  when  the  -v
                     command-line option is omitted, or a context line when -v is specified).  Setting this is equivalent
                     to setting both ms= and mc= at once to the same value.  The default is a bold  red  text  foreground
                     over the current line background.

                     SGR  substring  for  matching  non-empty  text  in  a selected line.  (This is only used when the -v
                     command-line option is omitted.)  The effect of the sl= (or cx= if  rv)  capability  remains  active
                     when this kicks in.  The default is a bold red text foreground over the current line background.

                     SGR  substring  for  matching  non-empty  text  in  a  context line.  (This is only used when the -v
                     command-line option is specified.)  The effect of the cx= (or sl= if rv) capability  remains  active
                     when this kicks in.  The default is a bold red text foreground over the current line background.

              fn=35  SGR  substring  for file names prefixing any content line.  The default is a magenta text foreground
                     over the terminal's default background.

              ln=32  SGR substring for line numbers prefixing any content line.  The default is a green  text  foreground
                     over the terminal's default background.

              bn=32  SGR  substring  for byte offsets prefixing any content line.  The default is a green text foreground
                     over the terminal's default background.

              se=36  SGR substring for separators that are inserted between selected line  fields  (:),  between  context
                     line  fields, (-), and between groups of adjacent lines when nonzero context is specified (--).  The
                     default is a cyan text foreground over the terminal's default background.

              ne     Boolean value that prevents clearing to the end of line using Erase in Line (EL)  to  Right  (\33[K)
                     each  time  a colorized item ends.  This is needed on terminals on which EL is not supported.  It is
                     otherwise useful on terminals for which the back_color_erase (bce) boolean terminfo capability  does
                     not  apply, when the chosen highlight colors do not affect the background, or when EL is too slow or
                     causes too much flicker.  The default is false (i.e., the capability is omitted).

              Note that boolean capabilities have no =...  part.  They are omitted (i.e., false) by  default  and  become
              true when specified.

              See  the  Select Graphic Rendition (SGR) section in the documentation of the text terminal that is used for
              permitted values and their meaning as character attributes.  These substring values are integers in decimal
              representation  and  can  be concatenated with semicolons.  grep takes care of assembling the result into a
              complete SGR sequence (\33[...m).  Common values to concatenate include 1 for bold, 4 for underline, 5  for
              blink,  7  for  inverse,  39  for  default  foreground  color, 30 to 37 for foreground colors, 90 to 97 for
              16-color mode foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color modes foreground colors,  49
              for  default  background  color,  40  to  47 for background colors, 100 to 107 for 16-color mode background
              colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes background colors.

              These variables specify the locale for the LC_COLLATE category, which  determines  the  collating  sequence
              used to interpret range expressions like [a-z].

              These  variables  specify  the  locale  for the LC_CTYPE category, which determines the type of characters,
              e.g., which characters are whitespace.

              These variables specify the locale for the LC_MESSAGES category, which determines the  language  that  grep
              uses for messages.  The default C locale uses American English messages.

              If  set,  grep  behaves as POSIX.2 requires; otherwise, grep behaves more like other GNU programs.  POSIX.2
              requires that options that follow file names must be treated as file names; by default,  such  options  are
              permuted  to  the  front  of  the  operand  list  and  are treated as options.  Also, POSIX.2 requires that
              unrecognized options be diagnosed as “illegal”, but since they are not really against the law  the  default
              is  to  diagnose  them as “invalid”.  POSIXLY_CORRECT also disables _N_GNU_nonoption_argv_flags_, described

              (Here N is grep's numeric process ID.)  If the ith character of this environment variable's value is 1,  do
              not  consider  the ith operand of grep to be an option, even if it appears to be one.  A shell can put this
              variable in the environment for each command it runs, specifying which operands are  the  results  of  file
              name  wildcard  expansion  and therefore should not be treated as options.  This behavior is available only
              with the GNU C library, and only when POSIXLY_CORRECT is not set.

       Normally, the exit status is 0 if selected lines are found and 1 otherwise.  But the exit status is 2 if an  error
       occurred,  unless  the -q or --quiet or --silent option is used and a selected line is found.  Note, however, that
       POSIX only mandates, for programs such as grep, cmp, and diff, that the exit status in case of  error  be  greater
       than 1; it is therefore advisable, for the sake of portability, to use logic that tests for this general condition
       instead of strict equality with 2.


Execute a command as another user with the command : sudo, sudoedit

December 12, 2009
       sudo, sudoedit - execute a command as another user

       sudo [-n] -h | -K | -k | -L | -V | -v

       sudo -l[l] [-AnS] [-g groupname|#gid] [-U username] [-u username|#uid] [command]

       sudo [-AbEHnPS] [-a auth_type] [-C fd] [-c class|-] [-g groupname|#gid] [-p prompt] [-r role] [-t type]
       [-u username|#uid] [VAR=value] [-i | -s] [command]

       sudoedit [-AnS] [-a auth_type] [-C fd] [-c class|-] [-g groupname|#gid] [-p prompt] [-u username|#uid] file ...

       sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers
       file.  The real and effective uid and gid are set to match those of the target user as specified in the passwd
       file and the group vector is initialized based on the group file (unless the -P option was specified).  If the
       invoking user is root or if the target user is the same as the invoking user, no password is required.  Otherwise,
       sudo requires that users authenticate themselves with a password by default (NOTE: in the default configuration
       this is the user's password, not the root password).  Once a user has been authenticated, a timestamp is updated
       and the user may then use sudo without a password for a short period of time (15 minutes unless overridden in

       When invoked as sudoedit, the -e option (described below), is implied.

       sudo determines who is an authorized user by consulting the file @sysconfdir@/sudoers.  By running sudo with the
       -v option, a user can update the time stamp without running a command. The password prompt itself will also time
       out if the user's password is not entered within 0 minutes (unless overridden via sudoers).

       If a user who is not listed in the sudoers file tries to run a command via sudo, mail is sent to the proper
       authorities, as defined at configure time or in the sudoers file (defaults to root).  Note that the mail will not
       be sent if an unauthorized user tries to run sudo with the -l or -v option.  This allows users to determine for
       themselves whether or not they are allowed to use sudo.

       If sudo is run by root and the SUDO_USER environment variable is set, sudo will use this value to determine who
       the actual user is.  This can be used by a user to log commands through sudo even when a root shell has been
       invoked.  It also allows the -e option to remain useful even when being run via a sudo-run script or program.
       Note however, that the sudoers lookup is still done for root, not the user specified by SUDO_USER.

       sudo can log both successful and unsuccessful attempts (as well as errors) to syslog(3), a log file, or both.  By
       default sudo will log via syslog(3) but this is changeable at configure time or via the sudoers file.

       sudo accepts the following command line options:

       -A          Normally, if sudo requires a password, it will read it from the current terminal.  If the -A (askpass)
                   option is specified, a helper program is executed to read the user's password and output the password
                   to the standard output.  If the SUDO_ASKPASS environment variable is set, it specifies the path to the
                   helper program.  Otherwise, the value specified by the askpass option in sudoers(5) is used.

       -a type     The -a (authentication type) option causes sudo to use the specified authentication type when
                   validating the user, as allowed by /etc/login.conf.  The system administrator may specify a list of
                   sudo-specific authentication methods by adding an "auth-sudo" entry in /etc/login.conf.  This option
                   is only available on systems that support BSD authentication.

       -b          The -b (background) option tells sudo to run the given command in the background.  Note that if you
                   use the -b option you cannot use shell job control to manipulate the process.

       -C fd       Normally, sudo will close all open file descriptors other than standard input, standard output and
                   standard error.  The -C (close from) option allows the user to specify a starting point above the
                   standard error (file descriptor three).  Values less than three are not permitted.  This option is
                   only available if the administrator has enabled the closefrom_override option in sudoers(5).
       -c class    The -c (class) option causes sudo to run the specified command with resources limited by the specified
                   login class.  The class argument can be either a class name as defined in /etc/login.conf, or a single
                   '-' character.  Specifying a class of - indicates that the command should be run restricted by the
                   default login capabilities for the user the command is run as.  If the class argument specifies an
                   existing user class, the command must be run as root, or the sudo command must be run from a shell
                   that is already root.  This option is only available on systems with BSD login classes.

       -E          The -E (preserve environment) option will override the env_reset option in sudoers(5)).  It is only
                   available when either the matching command has the SETENV tag or the setenv option is set in

       -e          The -e (edit) option indicates that, instead of running a command, the user wishes to edit one or more
                   files.  In lieu of a command, the string "sudoedit" is used when consulting the sudoers file.  If the
                   user is authorized by sudoers the following steps are taken:

                   1.  Temporary copies are made of the files to be edited with the owner set to the invoking user.

                   2.  The editor specified by the SUDO_EDITOR, VISUAL or EDITOR environment variables is run to edit the
                       temporary files.  If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first program listed in
                       the editor sudoers variable is used.

                   3.  If they have been modified, the temporary files are copied back to their original location and the
                       temporary versions are removed.

                   If the specified file does not exist, it will be created.  Note that unlike most commands run by sudo,
                   the editor is run with the invoking user's environment unmodified.  If, for some reason, sudo is
                   unable to update a file with its edited version, the user will receive a warning and the edited copy
                   will remain in a temporary file.

       -g group    Normally, sudo sets the primary group to the one specified by the passwd database for the user the
                   command is being run as (by default, root).  The -g (group) option causes sudo to run the specified
                   command with the primary group set to group.  To specify a gid instead of a group name, use #gid.
                   When running commands as a gid, many shells require that the '#' be escaped with a backslash ('\').
                   If no -u option is specified, the command will be run as the invoking user (not root).  In either
                   case, the primary group will be set to group.

       -H          The -H (HOME) option sets the HOME environment variable to the homedir of the target user (root by
                   default) as specified in passwd(5).  By default, sudo does not modify HOME (see set_home and
                   always_set_home in sudoers(5)).

       -h          The -h (help) option causes sudo to print a usage message and exit.

       -i [command]
                   The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the target
                   user as a login shell.  This means that login-specific resource files such as .profile or .login will
                   be read by the shell.  If a command is specified, it is passed to the shell for execution.  Otherwise,
                   an interactive shell is executed.  sudo attempts to change to that user's home directory before
                   running the shell.  It also initializes the environment, leaving DISPLAY and TERM unchanged, setting
                   HOME, SHELL, USER, LOGNAME, and PATH, as well as the contents of /etc/environment on Linux and AIX
                   systems.  All other environment variables are removed.

       -K          The -K (sure kill) option is like -k except that it removes the user's timestamp entirely.  Like -k,
                   this option does not require a password.

       -k          The -k (kill) option to sudo invalidates the user's timestamp by setting the time on it to the Epoch.
                   The next time sudo is run a password will be required.  This option does not require a password and
                   was added to allow a user to revoke sudo permissions from a .logout file.

       -L          The -L (list defaults) option will list out the parameters that may be set in a Defaults line along
                   with a short description for each.  This option is useful in conjunction with grep(1).

       -l[l] [command]
                   If no command is specified, the -l (list) option will list the allowed (and forbidden) commands for
                   the invoking user (or the user specified by the -U option) on the current host.  If a command is
                   specified and is permitted by sudoers, the fully-qualified path to the command is displayed along with
                   any command line arguments.  If command is specified but not allowed, sudo will exit with a status
                   value of 1.  If the -l option is specified with an l argument (i.e. -ll), or if -l is specified
                   multiple times, a longer list format is used.

       -n          The -n (non-interactive) option prevents sudo from prompting the user for a password.  If a password
                   is required for the command to run, sudo will display an error messages and exit.

       -P          The -P (preserve group vector) option causes sudo to preserve the invoking user's group vector
                   unaltered.  By default, sudo will initialize the group vector to the list of groups the target user is
                   in.  The real and effective group IDs, however, are still set to match the target user.

       -p prompt   The -p (prompt) option allows you to override the default password prompt and use a custom one.  The
                   following percent (`%') escapes are supported:

                   %H  expanded to the local hostname including the domain name (on if the machine's hostname is fully
                       qualified or the fqdn sudoers option is set)

                   %h  expanded to the local hostname without the domain name

                   %p  expanded to the user whose password is being asked for (respects the rootpw, targetpw and runaspw
                       flags in sudoers)

                   %U  expanded to the login name of the user the command will be run as (defaults to root)

                   %u  expanded to the invoking user's login name

                   %%  two consecutive % characters are collapsed into a single % character

                   The prompt specified by the -p option will override the system password prompt on systems that support
                   PAM unless the passprompt_override flag is disabled in sudoers.

       -r role     The -r (role) option causes the new (SELinux) security context to have the role specified by role.

       -S          The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal

       -s [command]
                   The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the
                   shell as specified in passwd(5).  If a command is specified, it is passed to the shell for execution.
                   Otherwise, an interactive shell is executed.

       -t type     The -t (type) option causes the new (SELinux) security context to have the type specified by type.  If
                   no type is specified, the default type is derived from the specified role.

       -U user     The -U (other user) option is used in conjunction with the -l option to specify the user whose
                   privileges should be listed.  Only root or a user with sudo ALL on the current host may use this

       -u user     The -u (user) option causes sudo to run the specified command as a user other than root.  To specify a
                   uid instead of a user name, use #uid.  When running commands as a uid, many shells require that the
                   '#' be escaped with a backslash ('\').  Note that if the targetpw Defaults option is set (see
                   sudoers(5)) it is not possible to run commands with a uid not listed in the password database.

       -V          The -V (version) option causes sudo to print the version number and exit.  If the invoking user is
                   already root the -V option will print out a list of the defaults sudo was compiled with as well as the
                   machine's local network addresses.

       -v          If given the -v (validate) option, sudo will update the user's timestamp, prompting for the user's
                   password if necessary.  This extends the sudo timeout for another 15 minutes (or whatever the timeout
                   is set to in sudoers) but does not run a command.

       --          The -- option indicates that sudo should stop processing command line arguments.  It is most useful in
                   conjunction with the -s option.

       Environment variables to be set for the command may also be passed on the command line in the form of VAR=value,
       e.g.  LD_LIBRARY_PATH=/usr/local/pkg/lib.  Variables passed on the command line are subject to the same
       restrictions as normal environment variables with one important exception.  If the setenv option is set in
       sudoers, the command to be run has the SETENV tag set or the command matched is ALL, the user may set variables
       that would overwise be forbidden.  See sudoers(5) for more information.

       Upon successful execution of a program, the exit status from sudo will simply be the exit status of the program
       that was executed.

       Otherwise, sudo quits with an exit value of 1 if there is a configuration/permission problem or if sudo cannot
       execute the given command.  In the latter case the error string is printed to stderr.  If sudo cannot stat(2) one
       or more entries in the user's PATH an error is printed on stderr.  (If the directory does not exist or if it is
       not really a directory, the entry is ignored and no error is printed.)  This should not happen under normal
       circumstances.  The most common reason for stat(2) to return "permission denied" is if you are running an
       automounter and one of the directories in your PATH is on a machine that is currently unreachable.

       sudo tries to be safe when executing external commands.

       There are two distinct ways to deal with environment variables.  By default, the env_reset sudoers option is
       enabled.  This causes commands to be executed with a minimal environment containing TERM, PATH, HOME, SHELL,
       LOGNAME, USER and USERNAME in addition to variables from the invoking process permitted by the env_check and
       env_keep sudoers options.  There is effectively a whitelist for environment variables.

       If, however, the env_reset option is disabled in sudoers, any variables not explicitly denied by the env_check and
       env_delete options are inherited from the invoking process.  In this case, env_check and env_delete behave like a
       blacklist.  Since it is not possible to blacklist all potentially dangerous environment variables, use of the
       default env_reset behavior is encouraged.

       In all cases, environment variables with a value beginning with () are removed as they could be interpreted as
       bash functions.  The list of environment variables that sudo allows or denies is contained in the output of sudo
       -V when run as root.

       Note that the dynamic linker on most operating systems will remove variables that can control dynamic linking from
       the environment of setuid executables, including sudo.  Depending on the operating system this may include _RLD*,
       DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.  These type of variables are removed from the environment
       before sudo even begins execution and, as such, it is not possible for sudo to preserve them.

       To prevent command spoofing, sudo checks "." and "" (both denoting current directory) last when searching for a
       command in the user's PATH (if one or both are in the PATH).  Note, however, that the PATH environment variable is
       further modified in Debian because of the use of the SECURE_PATH build option.

       sudo will check the ownership of its timestamp directory (@timedir@ by default) and ignore the directory's
       contents if it is not owned by root or if it is writable by a user other than root.  On systems that allow non-
       root users to give away files via chown(2), if the timestamp directory is located in a directory writable by
       anyone (e.g., /tmp), it is possible for a user to create the timestamp directory before sudo is run.  However,
       because sudo checks the ownership and mode of the directory and its contents, the only damage that can be done is
       to "hide" files by putting them in the timestamp dir.  This is unlikely to happen since once the timestamp dir is
       owned by root and inaccessible by any other user, the user placing files there would be unable to get them back
       out.  To get around this issue you can use a directory that is not world-writable for the timestamps
       (/var/adm/sudo for instance) or create @timedir@ with the appropriate owner (root) and permissions (0700) in the
       system startup files.

       sudo will not honor timestamps set far in the future.  Timestamps with a date greater than current_time + 2 *
       TIMEOUT will be ignored and sudo will log and complain.  This is done to keep a user from creating his/her own
       timestamp with a bogus date on systems that allow users to give away files.

       Please note that sudo will normally only log the command it explicitly runs.  If a user runs a command such as
       sudo su or sudo sh, subsequent commands run from that shell will not be logged, nor will sudo's access control
       affect them.  The same is true for commands that offer shell escapes (including most editors).  Because of this,
       care must be taken when giving users access to commands via sudo to verify that the command does not inadvertently
       give the user an effective root shell.  For more information, please see the PREVENTING SHELL ESCAPES section in

       sudo utilizes the following environment variables:

       EDITOR          Default editor to use in -e (sudoedit) mode if neither SUDO_EDITOR nor VISUAL is set

       HOME            In -s or -H mode (or if sudo was configured with the --enable-shell-sets-home option), set to
                       homedir of the target user

       PATH            Set to a sane value if the secure_path sudoers option is set.

       SHELL           Used to determine shell to run with -s option

       SUDO_ASKPASS    Specifies the path to a helper program used to read the password if no terminal is available or if
                       the -A option is specified.

       SUDO_COMMAND    Set to the command run by sudo

       SUDO_EDITOR     Default editor to use in -e (sudoedit) mode

       SUDO_GID        Set to the group ID of the user who invoked sudo

       SUDO_PROMPT     Used as the default password prompt

       SUDO_PS1        If set, PS1 will be set to its value for the program being run

       SUDO_UID        Set to the user ID of the user who invoked sudo

       SUDO_USER       Set to the login of the user who invoked sudo

       USER            Set to the target user (root unless the -u option is specified)

       VISUAL          Default editor to use in -e (sudoedit) mode if SUDO_EDITOR is not set

       @sysconfdir@/sudoers    List of who can run what

       @timedir@               Directory containing timestamps

       /etc/environment        Initial environment for -i mode on Linux and AIX

       Note: the following examples assume suitable sudoers(5) entries.

       To get a file listing of an unreadable directory:

        $ sudo ls /usr/local/protected

       To list the home directory of user yazza on a machine where the file system holding ~yazza is not exported as

        $ sudo -u yazza ls ~yazza

       To edit the index.html file as user www:

        $ sudo -u www vi ~www/htdocs/index.html

       To shutdown a machine:

        $ sudo shutdown -r +15 "quick reboot"

       To make a usage listing of the directories in the /home partition.  Note that this runs the commands in a sub-
       shell to make the cd and file redirection work.

        $ sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"


Change user ID or become superuser with the command : su

December 12, 2009
       su - change user ID or become superuser

       su [options] [username]

       The su command is used to become another user during a login session. Invoked without a username, su defaults to
       becoming the superuser. The optional argument - may be used to provide an environment similar to what the user
       would expect had the user logged in directly.

       Additional arguments may be provided after the username, in which case they are supplied to the user´s login
       shell. In particular, an argument of -c will cause the next argument to be treated as a command by most command
       interpreters. The command will be executed by the shell specified in /etc/passwd for the target user.

       You can use the -- argument to separate su options from the arguments supplied to the shell.

       The user will be prompted for a password, if appropriate. Invalid passwords will produce an error message. All
       attempts, both valid and invalid, are logged to detect abuse of the system.

       The current environment is passed to the new shell. The value of $PATH is reset to /bin:/usr/bin for normal users,
       or /sbin:/bin:/usr/sbin:/usr/bin for the superuser. This may be changed with the ENV_PATH and ENV_SUPATH
       definitions in /etc/login.defs.

       A subsystem login is indicated by the presence of a "*" as the first character of the login shell. The given home
       directory will be used as the root of a new file system which the user is actually logged into.

       The options which apply to the su command are:

       -c, --command COMMAND
           Specify a command that will be invoked by the shell using its -c.

       -, -l, --login
           Provide an environment similar to what the user would expect had the user logged in directly.

           When - is used, it must be specified as the last su option. The other forms (-l and --login) do not have this

       -s, --shell SHELL
           The shell that will be invoked.

           The invoked shell is chosen from (highest priority first):

           ·   The shell specified with --shell.

           ·   If --preserve-environment is used, the shell specified by the $SHELL environment variable.

           ·   The shell indicated in the /etc/passwd entry for the target user.

           ·    /bin/sh if a shell could not be found by any above method.

               If the target user has a restricted shell (i.e. the shell field of this user´s entry in /etc/passwd is not
               listed in /etc/shell), then the --shell option or the $SHELL environment variable won´t be taken into
               account, unless su is called by root.

           -m, -p, --preserve-environment
               Preserve the current environment.

               If the target user has a restricted shell, this option has no effect (unless su is called by root).

       This version of su has many compilation options, only some of which may be in use at any particular site.

       The following configuration variables in /etc/login.defs change the behavior of this tool:

       CONSOLE_GROUPS (string)
           List of groups to add to the user´s supplementary groups set when logging in on the console (as determined by
           the CONSOLE setting). Default is none.
           Use with caution - it is possible for users to gain permanent access to these groups, even when not logged in
           on the console.

       DEFAULT_HOME (boolean)
           Indicate if login is allowed if we can´t cd to the home directory. Default in no.

           If set to yes, the user will login in the root (/) directory if it is not possible to cd to her home

       ENV_PATH (string)
           If set, it will be used to define the PATH environment variable when a regular user login. The value can be
           preceded by PATH=, or a colon separated list of paths (for example /bin:/usr/bin). The default value is

       ENV_SUPATH (string)
           If set, it will be used to define the PATH environment variable when the superuser login. The value can be
           preceded by PATH=, or a colon separated list of paths (for example /sbin:/bin:/usr/sbin:/usr/bin). The default
           value is PATH=/bin:/usr/bin.

       SULOG_FILE (string)
           If defined, all su activity is logged to this file.

       SU_NAME (string)
           If defined, the command name to display when running "su -". For example, if this is defined as "su" then a
           "ps" will display the command is "-su". If not defined, then "ps" would display the name of the shell actually
           being run, e.g. something like "-sh".

       SYSLOG_SU_ENAB (boolean)
           Enable "syslog" logging of su activity - in addition to sulog file logging.

           User account information.

           Secure user account information.


Remove files or directories with the command : rm

December 12, 2009
       rm - remove files or directories

       rm [OPTION]... FILE...

       This manual page documents the GNU version of rm.  rm removes each specified file.  By default, it does not remove

       If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive
       are  given,  then  rm  prompts  the user for whether to proceed with the entire operation.  If the response is not
       affirmative, the entire command is aborted.

       Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is  not  given,  or
       the  -i  or  --interactive=always  option  is  given,  rm prompts the user for whether to remove the file.  If the
       response is not affirmative, the file is skipped.

       Remove (unlink) the FILE(s).

       -f, --force
              ignore nonexistent files, never prompt

       -i     prompt before every removal

       -I     prompt once before removing more than three files, or when removing recursively.  Less intrusive  than  -i,
              while still giving protection against most mistakes

              prompt according to WHEN: never, once (-I), or always (-i).  Without WHEN, prompt always

              when  removing  a hierarchy recursively, skip any directory that is on a file system different from that of
              the corresponding command line argument

              do not treat `/' specially

              do not remove `/' (default)

       -r, -R, --recursive
              remove directories and their contents recursively

       -v, --verbose
              explain what is being done

       --help display this help and exit

              output version information and exit

       By default, rm does not remove directories.  Use the --recursive (-r or -R) option to remove  each  listed  direc‐
       tory, too, along with all of its contents.

       To remove a file whose name starts with a `-', for example `-foo', use one of these commands:

              rm -- -foo

              rm ./-foo

       Note  that  if  you  use rm to remove a file, it is usually possible to recover the contents of that file.  If you
       want more assurance that the contents are truly unrecoverable, consider using shred.


Merge lines of files with the command : paste

December 12, 2009
       paste - merge lines of files

       paste [OPTION]... [FILE]...

       Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard out‐
       put.  With no FILE, or when FILE is -, read standard input.

       Mandatory arguments to long options are mandatory for short options too.

       -d, --delimiters=LIST
              reuse characters from LIST instead of TABs

       -s, --serial
              paste one file at a time instead of in parallel

       --help display this help and exit

              output version information and exit


Copy files and directories with the command : cp

December 12, 2009
       cp - copy files and directories

       cp [OPTION]... [-T] SOURCE DEST
       cp [OPTION]... -t DIRECTORY SOURCE...

       Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

       Mandatory  arguments  to  long  options are mandatory for short options

       -a, --archive
              same as -dR --preserve=all

              make a backup of each existing destination file

       -b     like --backup but does not accept an argument

              copy contents of special files when recursive

       -d     same as --no-dereference --preserve=links

       -f, --force
              if an existing destination file cannot be opened, remove it  and
              try again (redundant if the -n option is used)

       -i, --interactive
              prompt before overwrite (overrides a previous -n option)

       -H     follow command-line symbolic links in SOURCE
       cp - copy files and directories

       cp [OPTION]... [-T] SOURCE DEST
       cp [OPTION]... -t DIRECTORY SOURCE...

       Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

       Mandatory  arguments  to  long  options are mandatory for short options

       -a, --archive
              same as -dR --preserve=all

              make a backup of each existing destination file

       -b     like --backup but does not accept an argument

              copy contents of special files when recursive

       -d     same as --no-dereference --preserve=links

       -f, --force
              if an existing destination file cannot be opened, remove it  and
              try again (redundant if the -n option is used)

       -i, --interactive
              prompt before overwrite (overrides a previous -n option)

       -H     follow command-line symbolic links in SOURCE

       -l, --link
              link files instead of copying

       -L, --dereference
              always follow symbolic links in SOURCE

       -n, --no-clobber
              do  not  overwrite  an  existing  file  (overrides a previous -i

       -P, --no-dereference
              never follow symbolic links in SOURCE

       -p     same as --preserve=mode,ownership,timestamps

              preserve the specified attributes (default: mode,ownership,time‐
              stamps),  if  possible  additional  attributes:  context, links,
              xattr, all

              don't preserve the specified attributes

              use full source file name under DIRECTORY

       -R, -r, --recursive
              copy directories recursively

              remove each existing destination file before attempting to  open
              it (contrast with --force)

              control creation of sparse files

              remove any trailing slashes from each SOURCE argument

       -s, --symbolic-link
              make symbolic links instead of copying

       -S, --suffix=SUFFIX
              override the usual backup suffix

       -t, --target-directory=DIRECTORY
              copy all SOURCE arguments into DIRECTORY

       -T, --no-target-directory
              treat DEST as a normal file

       -u, --update
              copy  only  when  the  SOURCE file is newer than the destination
              file or when the destination file is missing

       -v, --verbose
              explain what is being done

       -x, --one-file-system
              stay on this file system

       --help display this help and exit

              output version information and exit

Make a Free Website with Yola.