Manipulating Files And Directories
Introduction
This section will introduce the following commands:
cp
- Copy files and directoriesmv
- Move/rename files and directories-
mkdir
- Create directories rm
- Remove files and directoriesln
- Create hard and symbolic links
These five commands are among the most frequently used Linux commands. They are used for manipulating both files and directories.
Why use these command?
Now, some of the tasks performed by these commands are more easily done with a graphical file manager. With a file manager, we can drag and drop a file from one directory to another, cut and paste files, delete files, etc. So why use these old commands?
The answer is power and flexibility. While it is easy to perform simple file manipulations with a graphical file manager, complicated tasks can be easier with the commands. A simple example is:
Copy all files from one directory to another, but only copy files that do not exist in the destination directory or are newer than the versions in destination directory.
Wildcards
Before using these commands, we need to talk about the special characters that makes these commands so powerful. These special characters are called wildcards.
Using wildcards (which is also known as globbing) allow you to select filenames based on patterns of characters.
Latest Post
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Combine JavaScript and CSS
- Inline Small JavaScript and CSS
- Minify JavaScript and CSS
- Defer Parsing of JavaScript
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Percentile
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync