Basic Linux Tutorial
Introduction – What is it? Why to learn? Linux installation directory structures Boot process Run levels in Linux Desktop Environments Different shells BASH Internal and External Commands Basic Linux Commands Important files and directories in Linux Environmental and Shell Variables Command history in Linux Character classes in Linux Text editors vim nano Searching files Creating new files Viewing File Contents File commands File permissions and ownership WildCards (Globbing) in files File compression Directory commands xargs command in Linux Comparing files Searching patterns using grep command Translating the characters using tr command Extracting data using cut command Stream editing using sed command Data extraction and reporting using awk command Sorting the file or string input uniq command in Linux Difference between grep, tr, cut, sed and awk commands Hardware commands Hard disk and memory space commands Working with Processes Managing Jobs Working with cron jobs Service command in Linux Network commands Managing Users and Groups Other Popular commands Standard streams and Redirection Pipes Package Managers in Linuxsed command in linux shell
sed stands for stream editor. We can extract data from files or streams as well as edit the stream contents. Here are some of the examples on sed command.- sed ‘1d’ f1.txt – This command can be used to delete line number 1 from file f1.txt
- sed ‘/^a/d’ f1.txt -This command can be used to delete the lines starting with a
- sed -n ‘1,4p’ f1.txt – This command can be used to print lines 1,2,3 and 4
- sed -n ‘/abc/p’ f1.txt – This command can be used to print lines matching the pattern specified between / /
- sed ‘s/abc/xyz/gi f1.txt – This command can be used to substitute the occurrences of abc by xyz in file f1.txt. Here s stands for substitute, g stands for global (all occurrences) and i stands for case-insensitive replacement.
- sed ‘1s/abc/xyz/g’ f1.txt – This command is similar to above. The difference is that it will do case sensitive replacement in line number 1 only.
Web development and Automation testing
solutions delivered!!