1) cp [options] file1 file2
copy file1 into file2; file2 shouldn't already exist. This command
creates or overwrites file2.The format of a cp command is to specify first the name of the file you want to copy and then the new filename. Both names must be either relative filenames or absolute filenames.
--Copy the contents of one file to another with the cp command.
--Cant copy directories
--Can copy many files at once if you specify a directory as the destination rather than specifying a new filename.
Syntax
cp [options] old_filename new_filename
Common Options
-i interactive (prompt and wait for confirmation before proceeding)
-r recursively copy a directory
2) mv [options] file1 file2
move file1 into file2
--Rename a file with the move command, mv.
--Rather than creating multiple copies of the files you’re copying, mv physically relocates them from the old directory to the new.
Syntax
mv [options] old_filename new_filename
Common Options
-i interactive (prompt and wait for confirmation before proceeding)
-f don’t prompt, even when copying over an existing target file (overrides -i)
3) rm [options] file remove (delete) a file or directory
(-r recursively deletes the directory and its contents)
(-i prompts before removing files)
--Remove a file with the rm, remove, command.
--The rm command removes files permanently
--You can remove more than one file at a time by specifying each of the files to the rm command
Syntax
rm [options] filename
Common Options
-i interactive (prompt and wait for confirmation before proceeding)
-r recursively remove a directory, first removing the files and subdirectories beneath it (but all files and directories inside it as well, to be removed.)
-f don’t prompt for confirmation (overrides -i)
4) cat [options] file concatenate (list) a
file
Display the contents of a file with the concatenate command, cat.Syntax
cat [options] [file]
Common Options
-n precede each line with a line number
-v display non-printing characters, except tabs, new-lines, and form-feeds
-e display $ at the end of each line (prior to new-line) (when used with -v option)
5) echo [text string] echo the text string to stdout
The echo command is used to repeat, or echo, the argument you give it back to the standard output device. It normally ends with a line-feed, but you can specify an option to prevent this.
Syntax
echo [string]
6) head [-number] file
--display the first 10 (or number of) lines of a file
head displays the head, or start, of the file.
head [options] file
Common Options
-n number number of lines to display, counting from the top of the file
7) more (or less or pg) [options] file page through a text file
8) tail [options] file display the last few lines (or parts) of a file
tail displays the tail, or end, of the file.
Syntax
tail [options] file
Common Options
-number number of lines to display, counting from the bottom of the file
9) date [options] report the current date and time
No comments:
Post a Comment