Welcome -
Guest!
Login
/
Register Now
|
Search:
Home
Articles
Forum
Interview FAQ
Activities
News
Videos
Poll
Links
People
Groups
Unix / Linux / Ubuntu Articles
Submit Article
Home
»
Articles
»
Unix / Linux / Ubuntu
»
Commands
RSS Feeds
Copy file and directory subtrees - cp
Posted By:
Pedro Silva
Category:
Unix / Linux / Ubuntu
Views:
7902
This article explains about cp command with an example in unix.
cp command is used to copy file and directory subtrees in unix.
Syntax of cp Command
cp [- options] oldfile newfile
Examples of cp Command
Example 1 : Copy file1 to new or existing new_file
cp file1 new_file
Example 2 : Copy file1 to existing directory
cp file1 destination_directory
Example 3 : To create a zero-length file
cp /dev/null file
Share:
Previous Post:
Display content of a file - more
Next Post:
Move or Rename file and directories - mv
Didn't find what you were looking for? Find more on
Copy file and directory subtrees - cp
Or get
search suggestion and latest updates
.
Pedro Silva
author of Copy file and directory subtrees - cp is from Salvador,
Brazil
.
View All Articles
Related Articles and Code:
Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file
Script to make File and Directory Management Operations menu based : Display Current directory, List Directory, Make Directory, Change Directory etc
Write a menu driven shell script for Copy a file, Remove a file, Move a file
Perform directory operations like display current , list, Make, Change directory and file operations like Copy, Rename, Delete, Edit based on menu
File handling program to copy bytes from one file to another
File handling program to copy characters from one file to another
Suppose four filenames are supplied then the first file should get copied into second file, the third file should get copied into four
Write a shell script that takes a file names as a argument and deletes this file from every directory above the present working directory.
write a script to delete zero sized files from a given directory (and all its subdirectories)
Electronic Telephone Directory - File Handling and Graphics
Program of telephone directory that provides append, find and display all records from a file
File handling program to display directory contents
List all hidden files in current directory
How delete directory with files?
Move or Rename file and directories - mv
Listing file and directories command - ls
Removing files and directories - rm
Concatenate, copy, print files - cat
Shell script that prints names of all sub-directories present in the current directory
Shell script that prints names of all sub-directories present in the current directory
Other Interesting Articles in Unix / Linux / Ubuntu:
Redirection in unix
Write a shell script to display the digits which are in odd position in a given 5 digit number
Shell script that prints names of all sub-directories present in the current directory
Write a shell script to sort the given numbers in descending order using Bubble sort
How to change permission of file as 644?
Write a shell program to add, subtract and multiply the 2 given numbers passed as command line arguments
Write a shell program to exchange the values of two variables
Shell script to display the name of those files (in the given directory) which are having multiple links
How to find out common lines between two files?
Shell Script for generating a mark sheet
Count no.of character in file abc?
Shell script to display time in word
Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file
Write a shell script to reverse the contents of a file
Shell script which would Receive the log name during execution ,obtain information about it from /etc/passswd and display this information on screen
Shell Script combine file in one file horizontally and vertically
Write a shell program to count number of words, characters, white spaces and special symbols in a given text
Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links
Shell script to display all users names, or users names of a particular group, or name of users who are currently working in the system
Configure network interface parameters - ifconfig
Please enter your Comment
*
*
Comment should be atleast 30 Characters.
Please put code inside [Code] your code [/Code].
Please login to post comment
No Comment Found, Be the First to post comment!
Unix / Linux / Ubuntu
View All
Advance
Basics
Commands
Homework Help
Interview FAQ
Terms and Terminology
Assembly Language
Artificial Intelligence
C Programming
C++ Programming
Visual C++
OOAD
Cobol
Java
SQL Server
Asp.net MVC
Rest and WCF Services
Entity Framework
Knockout.Js
Networking
OOPs Concept
HTML
Dos
SQL
System Analysis & Design
Gadgets
Internet
CSS
Javascript
.Net Framework
Asp.net
C#
VB.Net
Python
Perl
Oracle
Software Engineering
RDBMS Terms
AJAX Framework
Design Pattern
UML
WPF
WCF
SEO
PowerShell
Visual Studio
WWF
BizTalk Server
Azure
General
Testing
Online Certifications
PHP
My SQL
LinQ
Project Management
Silverlight
XML
MS Office
Windows OS
DHTML
Sharepoint