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
- cd means change directory. You can jump between folders using this command.
34
38
-Syntax:
@@ -37,34 +41,120 @@ __4. ```cd``` command__
37
41
-```cd ../folder_name``` -
38
42
-```cd /<foldername>``` - use absolute paths, which start from the root folder ```/```
39
43
44
+
40
45
__5. ```pwd``` command__
41
46
- prints current folder path.
42
47
48
+
43
49
__6. ```rmdir``` command__
44
50
- delete __empty__ folders using this command
45
51
- Syntax:
46
-
-```rmdir <folder_name>
52
+
-```rmdir <folder_name>```
47
53
-```rm -rf <folder>``` : _To delete folders with files in them_
48
54
> ❗ NOTE: this command does not ask for the confirmation from the user and immediately remove that you ask it to remove.
49
55
56
+
50
57
__7. ```touch``` command__
51
58
- to create an empty file
52
-
- Syntax: ```touch <file_name>
59
+
- Syntax: ```touch <file_name>```
53
60
- If the file already exists, it opens th file in write mode.
54
61
62
+
55
63
__8. ```mv``` command__
56
64
- to move the file and also to rename the file
57
65
-```mv <from_folder/file> <to_folder/file>```
58
66
-```mv <file1> <file2> <tofolder>``` - to move more than one file, make a list of file and move to folder.
59
67
68
+
60
69
__9. ```cp``` command__
61
70
- to copy a file
62
71
72
+
63
73
__10. ```open``` command__
64
74
- to open a file using this command
65
75
- Syntax: ```open <filename>```
66
76
67
-
__11. ```find``` command
77
+
78
+
__11. ```find``` command__
68
79
- used to find files or folders matching a particular search pattern. It searches recursively.
80
+
-```file . -name <file_name>``` - to find the file with its name.
69
81
- Example: to find all the files in current directory with extension ```.png``` and also print the relative path.
70
-
- ```find . -name '*.png'```
82
+
- Syntax:
83
+
-```find . -name '*.png'```
84
+
-
85
+
86
+
87
+
__12. ```gzip``` command__
88
+
- to compress a file with extension ``` .gz```
89
+
- Syntax:
90
+
-```gzip <file_name>``` : using this the original file will be deleted.
91
+
-```gzip -c <file_name> > <filename.gz>``` : using ```-c``` option specifies that the output will go to the standard output stream without affecting original file.
92
+
93
+
> or can use -k option
94
+
95
+
```gzip -k <file_name>```
96
+
-```gzip <file1> <file2>``` : to zip mutiple files
97
+
- 🟡```gzip -r <folder_name>```: to compress a folder recursively
98
+
- 🟢```gzip -d <file_name.gz>``` : to decompress a file
99
+
100
+
101
+
__13. ```gunzip``` command__
102
+
- equivalent to ```gzip``` command, but ``` -d``` option is enabled by default.
103
+
- Syntax:
104
+
-```gunzip [option] [archive name/file name]```
105
+
106
+
107
+
__14. ```alias``` command__
108
+
- to create your command for your convenience.
109
+
- Example:
110
+
-```alias ll = 'ls -al'``` : use ```ll``` in place of ```ls -al``` command
111
+
-```alias``` : *(with no option)* to list all alias defines
112
+
113
+
114
+
__15. ```cat``` command__
115
+
-*SUPER POWERFUL command*
116
+
-```cat <file_name>``` : prints a file content
117
+
-```cat <file1> <file2>``` : to print multiple file content
118
+
-```cat <file1> <file2> > file3``` : to concatenate the content of multiple files into a new one.
119
+
-```cat <file1> <file2> >> <file3>``` : to append content of multiple files into new one.
120
+
-```cat <file_name> | <another_command>``` : to feed a file's content as input to another command.
121
+
-```cat -s <file_name>``` to remove multiple empty lines.
122
+
123
+
124
+
__16. ```less``` command__
125
+
- to watch the file content in an interactive UI
126
+
-```less <filename>```
127
+
128
+
129
+
__17. ```head``` and ```tail``` command__
130
+
-```head``` to print first 10 lines of the file.
131
+
-```tail``` to print last 10 lines of the file.
132
+
133
+
134
+
__18. ```wc``` command__
135
+
- helps in counting the lines, words, and characters in a file. Mostly, it is used with pipes ```|``` for counting operation.
136
+
- It will display the number of lines, words, and bytes from the file.
137
+
- Syntax: ```wc [option]... [file]...```
138
+
139
+
140
+
__19. ```grep``` command__
141
+
> grep command filters the content of a file which makes search easy.
142
+
> _grep_ stands for global regular expression print.
143
+
144
+
-_helpful in day-to-day coding_
145
+
- Syntax:
146
+
-```command | grep <searchWord>``` : with pipes (case sensitive by default)
147
+
-```grep <search_Word> <file_name>``` : without pipes
148
+
-```grep -v <search_Word> <file_name>``` : to search for non-matching searched word.
149
+
-```grep -i <searchWord> <filename>``` : to filter output in a case-insensitive way.
150
+
151
+
152
+
__20. ```sort``` command__
153
+
- used to sort the list items
154
+
-```sort <file_name>``` : by default case sensitive and alphabetic.
155
+
-```sort -r <file_name>``` : reverse order sort.
156
+
-```sort --ignore-case <file_name>``` : to sort case insensitive, use ```-n``` to sort numerically.
157
+
-```sort -u <file_name>``` : to remove duplicated.
158
+
- Example : ```ls | sort``` : used with list command.
0 commit comments