You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modify.md
+44-43Lines changed: 44 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,13 @@
5
5
**Questions**
6
6
7
7
- How do I create or remove files and directories?
8
-
- How do I copy or rename files and directories? (You will see why these two operations are mentioned together.)
8
+
- How do I copy or rename files and directories? (You will see why these two operations are mentioned together shortly.)
9
9
10
10
**Learning objectives**
11
11
12
-
- Learn how to navigate the Linux file system
13
-
- Learn about files and directories
14
-
- Learn about paths
15
-
- Be able to create, copy, rename, and delete files and directories
12
+
- Learn how to create and remove files and directories.
13
+
- Learn how to copy and rename/move files and directories.
14
+
- Learn to avoid a few common pitfalls that could cause files to be deleted or overwritten by mistake.
16
15
17
16
## Create and remove directories/files
18
17
@@ -54,13 +53,15 @@ To create files, you would normally use an editor (``nano``, ``vim``, ``emacs``,
54
53
touch FILE
55
54
```
56
55
57
-
You can remove files with ``rm``. Again, you can use the flag/option ``-i`` to prompt before removing a file. Be aware that files removed with ``rm`` are deleted *permanently*---they generally cannot be restored (people have gotten lucky with system backup snapshots, but don't count on those).
56
+
(The `touch` command is more often used to update the timestamps (specifically the latest access and modification times) of existing files.)
57
+
58
+
You can remove files with ``rm``. Again, you can use the flag/option ``-i`` to prompt before removing a file. Be aware that files removed with ``rm`` are deleted *permanently*---they generally cannot be restored (people have gotten lucky with system backup snapshots, but do not assume that those will be available).
58
59
59
60
!!! warning
60
61
61
62
If you do not add the flag/option "-i" the file will be deleted without prompting. Be careful!
62
63
63
-
Be **extra** careful using ``rm`` with glob patterns (see [Wild Cards under The File System](../filesystem/#wild__cards) )! It is strongly recommended that you always test a pattern with ``ls`` and check that the output is what you expect before using ``rm`` on that pattern.
64
+
Be **extra** careful using `rm -rf` with glob patterns (see [Wild Cards under The File System](../filesystem/#wild__cards) )! It is strongly recommended that you always test a pattern with `ls` and check that the output is what you expect before using `rm -rf` on that pattern.
64
65
65
66
!!! example "Examples"
66
67
@@ -78,46 +79,46 @@ You can remove files with ``rm``. Again, you can use the flag/option ``-i`` to p
78
79
79
80
### Examples
80
81
81
-
**Reminder**
82
+
???+ faq "Reminder"
82
83
83
-
-**mkdir DIR**: Create a directory DIR
84
-
-**rm -rf DIR**: Remove a directory DIR. The flag “-r” means recursively and “-f” means do so without asking for each file and subdirectory. Useful, but dangerous. Be careful!
85
-
-**cd**: Go to your home directory ($HOME)
86
-
-**cd DIR**: Change directory to DIR
87
-
-**cd ..**: Change directory to the parent directory of the current directory
88
-
-**cd -**: go back to the previous working directory
89
-
-**touch FILE**: create an empty file with the name FILE
90
-
-**rm FILE**: remove the file with the name FILE
91
-
- The command <code>pwd</code> tells you the current directory path.
84
+
- **mkdir DIR**: Create a directory DIR
85
+
- **rm -rf DIR**: Remove a directory DIR. The flag "-r" means recursively and "-f" means do so without asking for each file and subdirectory. Useful, but dangerous. Be careful!
86
+
- **cd**: Go to your home directory ($HOME)
87
+
- **cd DIR**: Change directory to DIR
88
+
- **cd ..**: Change directory to the parent directory of the current directory
89
+
- **cd -**: go back to the previous working directory
90
+
- **touch FILE**: create an empty file with the name FILE
91
+
- **rm FILE**: remove the file with the name FILE
92
+
- The command `pwd` tells you the current directory path.
92
93
93
94
!!! example "Creating directories, changing directories, removing directory and file, removing files by pattern"
94
95
95
-
This example will test some of the things we just learned, as well as the command ``cd`` and glob patterns from the previous section.
96
+
This example sequence will demonstrate some of the things we just learned, as well as the command `cd` and glob patterns from the previous section.
This creates a symbolic link named "myproj" in your home directory, pointing to the location /proj/linux-intro/users/MYUSERNAME. The directory "linux-intro" is the project storage directory for this course project. For user ``x_birbr``, it would look like this:
283
+
This creates a symbolic link named "myproj" in your home directory, pointing to the location /proj/linux-intro/users/MYUSERNAME. The directory "linux-intro" is the project storage directory for this course project. For user ``x_rebpi``, it would look like this:
0 commit comments