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
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
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
Remove - rm
rm - remove files or directories
Syntax
rm [options] FILE
Options
Copy -cp
cp- copy files and directories
Syntax
cp [options] SOURCE DEST
cp [options] SOURCE DIRECTORY
Options
-a, --archive | same as -dpR |
--backup[=CONTROL] | make a backup of each existing destination file |
-b | like --backup but does not accept an argument |
--copy-contents | copy contents of special files when recursive |
-d | same as --no-dereference --preserve=link |
-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 | prompt before overwrite (overrides a previous -n option) |
-l, --link | link files instead of copying |
-L, --dereference | always follow symbolic links |
-p | same 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_LIST | don't preserve the specified attributes |
--parents | append source path to DIRECTORY |
-P | same as '--no-dereference' |
-R, -r, --recursive | copy directories recursively |
--remove-destination | remove 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=WHEN | control creation of sparse files |
--strip-trailing-slashes | 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 |
--target-directory=DIRECTORY | move all SOURCE arguments into DIRECTORY |
-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 |
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
-1 | Forces scp to use protocol 1. |
-2 | Forces scp to use protocol 2. |
-4 | Forces scp to use IPv4 addresses only. |
-6 | Forces scp to use IPv6 addresses only. |
-B | Selects batch mode (prevents asking for passwords or passphrases). |
-C | Selects batch mode (prevents asking for passwords or passphrases). |
-F ssh_config | Selects batch mode (prevents asking for passwords or passphrases). |
-p | Preserves modification times, access times, and modes from the original file. |
-q | Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh(1). |
-r | Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal. |
-v | Verbose 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, --force | do not prompt before overwriting |
-T, --no-target-directory | treat DEST as a normal file |
-v, --verbose | explain what is being done |
Remove - rm
rm - remove files or directories
Syntax
rm [options] FILE
Options
-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 |
--interactive[=WHEN] | prompt according to WHEN: never, once(-I), or always(-i). Without WHEN, prompt always |
-r, -R, --recursive | remove directories and their contents recursively |
-v, --verbose | explain what is being done |
--version | output version information and exit |
0 comments:
Post a Comment