Wednesday, March 2, 2011

Important Linux commands

Linux is one of the most used, free open source operating system. Most of the web servers uses linux as the OS. So web developers should aware of basic linux commands for the easy installation and development. The main Linux commands and syntaxes are explained here.




Copy -cp
cp- copy files and directories

Syntax
  cp [options] SOURCE DEST
  cp [options] SOURCE DIRECTORY
 
  Options
-a, --archivesame as -dpR
--backup[=CONTROL]make a backup of each existing destination file
-blike --backup but does not accept an argument
--copy-contentscopy contents of special files when recursive
-dsame as --no-dereference --preserve=link
-f, --forceif an existing destination file cannot be opened, remove it and try again (redundant if the -n option is used)
-i, --interactiveprompt before overwrite (overrides a previous -n option)
-Hprompt before overwrite (overrides a previous -n option)
-l, --linklink files instead of copying
-L, --dereferencealways follow symbolic links
-psame as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: links, all
--no-preserve=ATTR_LISTdon't preserve the specified attributes
--parentsappend source path to DIRECTORY
-Psame as '--no-dereference'
-R, -r, --recursivecopy directories recursively
--remove-destinationremove each existing destination file before attempting to open it (contrast with --force)
--reply={yes,no,query}specify how to handle the prompt about an existing destination file
--sparse=WHENcontrol creation of sparse files
--strip-trailing-slashesremove any trailing slashes from each SOURCE argument
-s, --symbolic-linkmake symbolic links instead of copying
-S, --suffix=SUFFIXoverride the usual backup suffix
--target-directory=DIRECTORYmove all SOURCE arguments into DIRECTORY
-u, --updatecopy only when the SOURCE file is newer than the destination file or when the destination file is missing
-v, --verboseexplain what is being done
-x, --one-file-systemstay on this file system

Secure copy - scp
scp- secure copy (remote file copy program)

scp copies files between hosts on a network.  It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).  Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.
File names may contain a user and host specification to indicate that the file is to be copied to/from that host.  Local file names can be made explicit using absolute or relative pathnames to avoid scp treating file names containing ‘:’ as host specifiers.  Copies between two remote hosts are also permitted.

Syntax
scp [options] [[user@]host1:]file1[[user@]host2:]file2
Options
-1Forces scp to use protocol 1.
-2Forces scp to use protocol 2.
-4Forces scp to use IPv4 addresses only.
-6Forces scp to use IPv6 addresses only.
-BSelects batch mode (prevents asking for passwords or passphrases).
-CSelects batch mode (prevents asking for passwords or passphrases).
-F ssh_configSelects batch mode (prevents asking for passwords or passphrases).
-pPreserves modification times, access times, and modes from the original file.
-qQuiet mode: disables the progress meter as well as warning and diagnostic messages from ssh(1).
-rRecursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.
-vVerbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.


SSH

ssh - OpenSSH SSH client (remote login program)
ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network.  X11 connections and arbitrary  TCP ports can also be forwarded over the secure channel.

Syntax
ssh [user@]hostname [command]


Move - mv

mv - move (rename) files
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
Mandatory  arguments  to  long  options are mandatory for short options too.
Syntax
mv [options] [-T] SOURCE DEST
mv [options] SOURCE DIRECTORY

Options
--backup[=CONTROL]make a backup of each existing destination file
-f, --forcedo not prompt before overwriting
-T, --no-target-directorytreat DEST as a normal file
-v, --verboseexplain what is being done


Remove - rm
rm - remove files or directories

Syntax
rm [options] FILE
Options
-f, --forceignore nonexistent files, never prompt
-iprompt before every removal
-Iprompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving protection against most mistakes
--interactive[=WHEN]prompt according to WHEN: never, once(-I), or always(-i). Without WHEN, prompt always
-r, -R, --recursiveremove directories and their contents recursively
-v, --verboseexplain what is being done
--versionoutput version information and exit


0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Maintained by Web Themes