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:
8085
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:
Write a shell script to find how many terminals has this user logged in
Write a shell script to ask your name, program name and enrolement number and print it on the screen.
Write a shell program to find the sum of the series sum=1+1/2+...+1/n
Special files in unix
Write a shell program to convert all the contents into the uppercase in a particular file
How would you know machine’s name in the network?
Set or display name of current host system - hostname
Give example of paste command
Unix Commands and description of ls,logout,mkdir,rmdir,rm,cd,man,talk,write,pico,pine,more,sz,rz,telnel,ftp,archie,irc,lynx,gopher,tin,trn,passwd etc
Write a shell script to find the smallest of three numbers
To identify directory and executable file which command is used?
Shell Script to find out the sum of the given numbers using command line argument
Is it possible to create and remover more than one directory together?
Shell Script to display the exit status using grep command which search a string from a string
Absolute movement in unix
Give example of cut command?
menu driven shell program which have the options change the term, change the prompt and user list of unix system.
Shell Script to separate the colon from the given item
Shell Script to create a pyramid of number
Terminate a process - kill
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