Kristofer Younger 8 lat temu
rodzic
commit
f8245d79a5
1 zmienionych plików z 7 dodań i 14 usunięć
  1. 7
    14
      Bash.md

+ 7
- 14
Bash.md Wyświetl plik

@@ -36,9 +36,8 @@ Change Directory to the path specified, for example cd projects. There are a few
36 36
 . refers to the current directory ./projects
37 37
 .. can be used to move up one folder use cd .., and can be combined to move up multiple levels ../../my_folder
38 38
 /is the root of your system to reach core folders, such as system, users, etc
39
-~ is the home directory, usually the path /users/username. Move back to folders referenced relative to this path by including it at the start of your path, for example ~/projects . If you need to access your shell configuration, you can easily find this with ~/.bashrc or ~/.zshrc — then add all sorts of beneficial aliases, configurations, commands and paths.
40
-For more on the mac directory structure
41
-- OSXDaily: Mac OS X Directory Structure Explained
39
+~ is the home directory, usually the path /users/username. Move back to folders referenced relative to this path by including it at the start of your path, for example ~/projects . If you need to access your shell configuration, you can easily find this with ~/.bashrc — then add all sorts of beneficial aliases, configurations, commands and paths.
40
+
42 41
 Now you can navigate directories, its time to create some of your own using…
43 42
 
44 43
 ### mkdir
@@ -47,34 +46,28 @@ Make directories with this command mkdir my_folder . Not only can it make the fo
47 46
 There are various ways to then create files using the command line, one of the most common is…
48 47
 
49 48
 ### touch
50
-Touches the file to update the access and or modification date of a file or directory without opening, saving or closing the file. But one of the most common uses is to create an empty file touch my_file.
49
+Touches the file to update the access and or modification date of a file or directory without opening, saving or closing the file. But one of the most common uses is to create an empty file `touch my_file`.
51 50
 
52
-Before you ask why I suggested touch to create files, read this page, which explores ways to create files using shell commands
53
-- StackExchange Unix & Linux: Why isn’t there any shell command to create files?
54 51
 To then use the file, open my_file will launch the application set for this file type. But you might want to see what’s in your files within the scope of the terminal. To do this you can use…
55 52
 
56 53
 ### cat
57
-Concatenate and print files to stdout cat my_file. You can pass one or more file names to this command, and even number the lines using the -n to number the lines. 
54
+Concatenate and print files to stdout `cat my_file`. You can pass one or more file names to this command, and even number the lines using the -n to number the lines. 
58 55
 
59
-For more on ways to use the cat command
60
-- 13 Basic Cat Command Examples in Linux
61 56
 The files may not be in the place you want them to be, rather than drag and drop using the mouse and windows, you command your terminal to…
62 57
 
63 58
 ### mv
64
-Moves files and folders. The first argument is the file you want to move, and the second is the location to move it to. Use the flags -f to force move them and -i to prompt confirmation before overwriting files.
59
+Moves files and folders. The first argument is the file you want to move, and the second is the location to move it to. Use the flags `-f` to force move them and `-i` to prompt confirmation before overwriting files.
65 60
 
66 61
 Alternatively, you may not want to remove the original, for example when making backups, in this case you would use…
67 62
 
68 63
 ### cp
69
-Copies files and folders cp my_file ./projects . The flag -r recursively copies subfolders and files.
64
+Copies files and folders `cp my_file ./projects` . The flag `-r` recursively copies subfolders and files.
70 65
 
71 66
 Now you have too many files, or some of them are no longer needed. The next command is a danger zone, because it is so good at its job…
72 67
 
73 68
 ### rm
74
-Removes files and folders rm my_folder . Using -r will again recursively delete subfolders, -f force deletes, and -rf for a recursive force delete. If you want to remove all folders and files in the current directory the command is rm -rf ./* , if you leave out the dot then it would reference the root directory!
69
+Removes files and folders `rm my_folder` . Using -r will again recursively delete subfolders, `-f` force deletes, and `-rf` for a recursive force delete (be very very careful). 
75 70
 
76
-Want to see what happens if you force a computer to run rm -rf /? Tip: don’t try this on yours, instead watch this video:
77
-- What happens when you sudo rm -rf / your machine? — YouTube
78 71
 There are ways to stop accidental deletes. If you use the -i flag (for interactive) you can specify the computer to prompt confirmation before delete.
79 72
 
80 73
 Another way is with permissions, which can be modified…