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:
8315
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:
Shell script to change extension of an existing file
Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension
Redirection in unix
Count no.of words in file abc?
Shell script to perform string replacement in a file and view the content of file
Terminate a process - kill
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?
Explain the difference between echo “$SHELL” and echo ‘$SHELL’
To identify directory and executable file which command is used?
Display your current working directory
Write a menu driven shell script for Copy a file, Remove a file, Move a file
Overview of UNIX
How would you know machine’s name in the network?
Write a shell program to search for a given number from the list of numbers provided using binary search method
Search a file for a pattern - grep
Split a large file into small files
Shell Script to check file is ordinary or not
Program to perform operations like Count char,words and lines of file, display file in reverse, change case and frequency of a particular word in file
Which command display version of the UNIX?
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