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:
8456
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:
Script to make File and Directory Management Operations menu based : Display Current directory, List Directory, Make Directory, Change Directory etc
Display information about all the current programs running
Change login password and associated attributes - passwd
Shell Script for generating a mark sheet
Count no.of character in file abc?
Write a shell program to exchange the values of two variables
Print message a shown in description
Update access, modification, and / or change times of file - touch
Tee examples in unix
Write a shell program to count number of words, characters,white spaces and special symbols in a givin text
Write a shell script, which will receive any number of filenames as arguments .The shell script should check whether such files already exist.
How delete directory with files?
List all hidden files in current directory
For joining the line
Sort Numeric file
Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal)
Shell script to print first 5 odd numbers
Program to count length of user input string
Split a large file into small files
Write a shell script to find how many terminals has this user logged in
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