Linux is basically a Unix-like Operating system, So Commands are important to run the terminal in Linux. Windows uses a command prompt like ...
Linux is basically a Unix-like Operating system, So Commands are important to run the terminal in Linux. Windows uses a command prompt like that on Linux it is called a terminal or shell or Bash.
The Terminal or Shell is used to run every command. So some of the Basic commands need to know before running in the terminal.
If you are New to Linux Please checkout my Blog Mastering the Essentials: Basic Linux Commands (Part 1) after that you can check this blog for continuation
35. Grep command
Grep command is used to search the particular word in the entire files and directories.
Syntax: grep -r “word”
Command: grep -r “linux”
grep -r “linux” > search.txt – this command is used to append the search result to another file.
36. Find command
To find a particular Directory(or)folder name in the Linux system
Syntax: find . -name “foldername”
To find a particular file in the Linux system
Syntax: find . -name “filename”
To Find a particular .extension file
Syntax: find . -name “*.txt”
Command: find /home/ec2-user -name "test.txt"
find / -type d -iname "computer"
find / -type d -name "computer.*" - > We can use wild cards also
37. sed Command
The sed command used to find and replace the string in the particular file.
command: sed 's/unix/linux/g' test.txt
sed -i 's/unix/linux/g' test.txt
The above command "unix" is a word already placed in the test.txt file, linux is the word need to replace for the word "linux"
if you not passing the "i" option the command it will find the word but will not replace, instead it will show you replacing lines with replaced word.