-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeek2
43 lines (28 loc) · 1.29 KB
/
Week2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Man Command - Shows the manual of all bash commands Manual
eg. man man
apropos command - searches for the command available
eg. apropos editor // searches all the available editor commands
grep command - for searching and listing the file content.
eg. grep "New" states.txt // shows all the content of states.txt containing the word "New".
egrep commands - (Extended grep) with added functionality
find command - to find the location of file or group of file
- to search for the file according to the flags
eg. find . -name "states.txt"
eg. find . -name ".html.txt"
EXERCISE I :
a) egrep -n "New" states.txt canada.txt
b) egrep "[^eiou]" states.txt > no_a.txt
egrep "[^ioua]" states.txt > no_e.txt and so on
c) find . -name "*.html" > HTMLdocs.txt
wc HTMLdocs.txt
history Command :
Whenever we close the terminal, our recent commands are written to bash_history file.
bash_history is a hidden file in home directory.
head -n 10 ~/.bash_history //it shows the topmost 10 commands from the bash_history file.
egrep "states" ~/.bash_history // shows the result of searching.
diff command:
To generate the difference between any two files.
eg. diff file1.txt file2.txt
sdiff command :
To generate side by side differences.
eg. sdiff file1.txt file2.txt