🖥️cp
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the cp command with important options and switches using examples.
2 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗██████╗
# ██╔════╝██╔══██╗
# ██║ ██████╔╝
# ██║ ██╔═══╝
# ╚██████╗██║
# ╚═════╝╚═╝
#==============================#
# CMD CP - copy
#==============================##==============================#
cp - u
# will only copy files that do not exist, or are newer than their existing counterparts, in the destination directory.
cp -r ./dir/*/*.pdb/.. ./pdb/ ; rm -r ./dir/
cp ReallyLongFileNameYouDontWantToTypeTwice{,.orig}
# Using expansion to move a file aside without having to type the file name twice
cp file.txt ~-/
# Copy file to the previous directory you were in. See "tilde expansion" in bash man page. Thx @gumnos
echo /home/aaronkilik/test/ /home/aaronkilik/tmp | xargs -n 1 cp -v /home/aaronkilik/bin/sys_info.sh
# How to Copy a File to Multiple Directories in Linux
# In the form above, the paths to the directories (dir1,dir2,dir3…..dirN) are echoed and piped as input to the xargs command where:
# -n 1 – tells xargs to use at most one argument per command line and send to the cp command.
# cp – used to copying a file.
# -v – enables verbose mode to show details of the copy operation.
#==============================##==============================#
# CMD CP - copy
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command cp in a clear format. This allows users to quickly access the needed information for cp without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for cp are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.