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:
7882
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:
Search a file for a pattern - grep
Create a directory - mkdir
How would u get online help of cat command?
Write a shell script to find the sum, the average and the product of the four integers entered
Shell script to display the name of those files (in the given directory) which are having multiple links
Write a shell scripts that finds total no. of users and finds out how many of them are currently loggedin
Write a shell program to concatenate the contents of 2 files
Shell script that prints names of all sub-directories present in the current directory
Tee examples in unix
How to find out difference between two files?
write a script to delete zero sized files from a given directory (and all its subdirectories)
Count no.of lines in file abc?
To identify directory and executable file which command is used?
How would you display the calendar of 2007?
Write a shell script to ask your name, program name and enrolement number and print it on the screen.
Rename a file from first1.txt to first2.txt
Write a shell script to find the sum, the average and the product of the four integers entered
Write a shell program to convert all the contents into the uppercase in a particular file
Shell Script to check file is ordinary or not
Shell Script for generating a mark sheet
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