mirror of
https://github.com/ro31337/rubyisforfun
synced 2024-11-16 19:50:09 +01:00
Save
This commit is contained in:
parent
623b73080e
commit
5473381930
1 changed files with 2 additions and 6 deletions
|
@ -42,7 +42,7 @@ $ tail -f file.txt
|
|||
|
||||
Press standard combination of Ctrl+C to quit from the command above.
|
||||
|
||||
Use `mv` (move) command to rename files (F6 in Far Manager). Technically, renaming and moving a file is the same thing for a computer. The point is that file system has file allocation table and actual file contents on the disk. Table contains only meta information about the file, like name, modification date, and the _pointer_ to the actual physical location of file data.
|
||||
Use `mv` (move) command to rename files (F6 in Far Manager). Technically, renaming and moving a file is the same thing for a computer. The point is that file system has file allocation table and actual file contents. Allocation table contains only meta information about the file, like name, modification date, and the _pointer_ to the actual physical location of file data.
|
||||
|
||||
So when you rename a file, in fact you update only file name in this table, without moving the file data. So renaming (or "moving") takes only few milliseconds if this operation is performed on the same disk (even for very large files). However, if you move (or "rename") the file _from one disk to another_, operating system will:
|
||||
|
||||
|
@ -120,19 +120,15 @@ $ find . -name '*.rb' -type f
|
|||
|
||||
E> ## Keep this in mind
|
||||
E>
|
||||
E> Often people do mistake and provide two hyphens `--` instead of one `-` to `find` command. For example, parameter with two hyphens like `--name` or `--type f` is incorrect. You must use one hyphen with `find`. However, some other Linux commands accept two hyphens. Don't get confused!
|
||||
E> Often people do mistake and provide two hyphens `--` instead of one `-` to `find` command. For example, parameter with two hyphens like `--name` or `--type f` is incorrect. You must use **one** hyphen with `find`. However, some other Linux commands accept two hyphens. Don't get confused!
|
||||
|
||||
As you can see, there are many ways of finding files in _current directory_. Current directory is indicated by dot right after `find` command (separated by space). Directory of one level up is indicated by two dots. Directory of two levels up is indicated by `../..` (two dots, slash, two dots). Here is the short list of directory shortcuts with examples of `find` command:
|
||||
|
||||
* `.` - current directory. Example (find all files with `log` extension):
|
||||
|
||||
```
|
||||
$ find . -name '*.log'
|
||||
```
|
||||
|
||||
* `..` - directory of one level up. Example (find all files with `log` extension in directory of one level up):
|
||||
|
||||
```
|
||||
$ find .. -name '*.log'
|
||||
```
|
||||
|
Loading…
Reference in a new issue