Skip to content

Commit 247445b

Browse files
authored
Update modify.md
change prompts to match speaker, add a couple notes
1 parent 043d95f commit 247445b

File tree

1 file changed

+44
-43
lines changed

1 file changed

+44
-43
lines changed

docs/modify.md

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
**Questions**
66

77
- 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.)
99

1010
**Learning objectives**
1111

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.
1615

1716
## Create and remove directories/files
1817

@@ -54,13 +53,15 @@ To create files, you would normally use an editor (``nano``, ``vim``, ``emacs``,
5453
touch FILE
5554
```
5655

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).
5859

5960
!!! warning
6061

6162
If you do not add the flag/option "-i" the file will be deleted without prompting. Be careful!
6263

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.
6465

6566
!!! example "Examples"
6667

@@ -78,46 +79,46 @@ You can remove files with ``rm``. Again, you can use the flag/option ``-i`` to p
7879

7980
### Examples
8081

81-
**Reminder**
82+
???+ faq "Reminder"
8283

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.
9293

9394
!!! example "Creating directories, changing directories, removing directory and file, removing files by pattern"
9495

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.
9697

9798
**HINT: Code-along!**
9899

99100
```bash
100-
[x_birbr@tetralith1 ~]$ mkdir myowntestdir
101-
[x_birbr@tetralith1 ~]$ cd myowntestdir/
102-
[x_birbr@tetralith1 myowntestdir]$ mkdir testdir1
103-
[x_birbr@tetralith1 myowntestdir]$ mkdir testdir2
104-
[x_birbr@tetralith1 myowntestdir]$ mkdir testdir3
105-
[x_birbr@tetralith1 myowntestdir]$ rm -rf testdir3
106-
[x_birbr@tetralith1 myowntestdir]$ cd testdir1
107-
[x_birbr@tetralith1 testdir1]$ touch file1.txt
108-
[x_birbr@tetralith1 testdir1]$ touch file2.sh
109-
[x_birbr@tetralith1 testdir1]$ touch file3.c
110-
[x_birbr@tetralith1 testdir1]$ touch file4.dat
111-
[x_birbr@tetralith1 testdir1]$ touch file5.txt
112-
[x_birbr@tetralith1 testdir1]$ rm file5.txt
113-
[x_birbr@tetralith1 testdir1]$
114-
[x_birbr@tetralith1 testdir1]$ cd ..
115-
[x_birbr@tetralith1 myowntestdir]$ cd testdir2/
116-
[x_birbr@tetralith1 testdir2]$ touch meow.txt
117-
[x_birbr@tetralith1 testdir2]$ touch catsmeow1.txt
118-
[x_birbr@tetralith1 testdir2]$ touch homeowners_assoc.txt
119-
[x_birbr@tetralith1 testdir2]$ ls *meow*.txt
120-
[x_birbr@tetralith1 testdir2]$ rm -r *meow{,1}.txt
101+
[x_rebpi@tetralith1 ~]$ mkdir mytestdir
102+
[x_rebpi@tetralith1 ~]$ cd mytestdir/
103+
[x_rebpi@tetralith1 mytestdir]$ mkdir testdir1
104+
[x_rebpi@tetralith1 mytestdir]$ mkdir testdir2
105+
[x_rebpi@tetralith1 mytestdir]$ mkdir testdir3
106+
[x_rebpi@tetralith1 mytestdir]$ rm -rf testdir3
107+
[x_rebpi@tetralith1 mytestdir]$ cd testdir1
108+
[x_rebpi@tetralith1 testdir1]$ touch file1.txt
109+
[x_rebpi@tetralith1 testdir1]$ touch file2.sh
110+
[x_rebpi@tetralith1 testdir1]$ touch file3.c
111+
[x_rebpi@tetralith1 testdir1]$ touch file4.dat
112+
[x_rebpi@tetralith1 testdir1]$ touch file5.txt
113+
[x_rebpi@tetralith1 testdir1]$ rm file5.txt
114+
[x_rebpi@tetralith1 testdir1]$
115+
[x_rebpi@tetralith1 testdir1]$ cd ..
116+
[x_rebpi@tetralith1 mytestdir]$ cd testdir2/
117+
[x_rebpi@tetralith1 testdir2]$ touch meow.txt
118+
[x_rebpi@tetralith1 testdir2]$ touch catsmeow1.txt
119+
[x_rebpi@tetralith1 testdir2]$ touch homeowners_assoc.txt
120+
[x_rebpi@tetralith1 testdir2]$ ls *meow*.txt
121+
[x_rebpi@tetralith1 testdir2]$ rm -r *meow{,1}.txt
121122

122123
```
123124

@@ -279,13 +280,13 @@ ln -s real-file-or-lib link-name
279280
ln -s /proj/linux-intro/users/MYUSERNAME $HOME/myproj
280281
```
281282

282-
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:
283284

284285
```bash
285-
[x_birbr@tetralith1 ~]$ ls -l
286+
[x_rebpi@tetralith1 ~]$ ls -l
286287
total 2
287-
lrwxrwxrwx 1 x_birbr x_birbr 31 Sep 11 12:01 myproj -> /proj/linux-intro/users/x_birbr
288-
drwxrwxr-x 4 x_birbr x_birbr 4096 Sep 11 11:43 mytestdir
288+
lrwxrwxrwx 1 x_rebpi x_rebpi 31 Sep 11 12:01 myproj -> /proj/linux-intro/users/x_rebpi
289+
drwxrwxr-x 4 x_rebpi x_rebpi 4096 Sep 11 11:43 mytestdir
289290
```
290291

291292
!!! summary

0 commit comments

Comments
 (0)