Linux Crash Course - The sed Command

  Рет қаралды 124,618

Learn Linux TV

Learn Linux TV

Күн бұрын

In this episode of Linux Crash Course, we explore the sed command. sed, aka the "stream editor" is an underused command, and that's a shame because it's extremely useful for manipulating text. In this video, I'll show you the basics of the sed command.
LearnLinuxTV Sites
🐧 Main site:
➡️ www.learnlinux.tv
🐧 LearnLinuxTV Community:
➡️ community.lear...
Support LearnLinuxTV (commission earned)
☁️ Support LearnLinuxTV and Set up your own cloud server with Akamai Connected Cloud:
➡️ learnlinux.lin...
📖 Check out Jay's latest book, Mastering Ubuntu Server 4th Edition. Covers Ubuntu 22.04!
➡️ ubuntuserverbo...
🙌 Support me on Patreon and get early access to new content!
➡️ learnlinux.lin...
🛒 Affiliate store for Linux compatible hardware/accessories:
➡️ learnlinux.lin...
💻 Check out the Tiny Pilot KVM for your Homelab:
➡️ learnlinux.lin...
About Me
🐦 Follow me on Twitter!
➡️ learnlinux.lin...
📘 FAQ
• What is a "Distribution" of Linux? ➜ linux.video/wh...
• What is a "Desktop Environment"? ➜ linux.video/de...
• Which Linux Distro should I use on my Server? ➜ linux.video/wh...
• How do I create USB install media? ➜ linux.video/in...
• How do I create multi-boot USB media? ➜ linux.video/ve...
• How do I connect to a Linux server via SSH? ➜ linux.video/us...
• How do I exit vim? ➜ linux.video/vim
• How do I use APT? ➜ linux.video/apt
• How do I use DNF? ➜ linux.video/dnf
• How do I use pacman? ➜ linux.video/pa...
• How do I use zypper? ➜ linux.video/zy...
• What the heck is a "Flatpak"? ➜ linux.video/fl...
• What is a "Snap" package? ➜ linux.video/snap
• How do I install Arch Linux? ➜ linux.video/in...
• How do I configure SSH on my server? linux.video/ss...
• How do I install updates? ➜ linux.video/up...
• What server tweaks should I implement? ➜ linux.video/ev...
• How do I use LVM? ➜ linux.video/lvm
• How do I use Git? ➜ linux.video/git
• When will the "Year of the Linux Desktop" Happen? ➜ linux.video/yotld
• Do you have a sense of humor? ➜ linux.video/lol
#CLI#Linux #sed

Пікірлер: 157
@fleborne
@fleborne 3 жыл бұрын
I believe the 's' before the search pattern actually stands for "substitute", not "string".
@andromida81
@andromida81 2 жыл бұрын
Yes you are correct
@PS_Tube
@PS_Tube Жыл бұрын
sed is called stream editor, which is what Jay said.
@alexo4600
@alexo4600 3 жыл бұрын
it's important to note that '-i' is a GNU only option - so it won't work on BSD or MacOS etc.
@martinschulz1778
@martinschulz1778 2 жыл бұрын
Just run into this, had to switch to gnu sed on my mac
@greendog105
@greendog105 2 жыл бұрын
oh that explains it all thnks
@MakeItWork256
@MakeItWork256 9 ай бұрын
Great tutorial. Unlike many other KZbinr's you don't overcomplicate things. Linux at it's core is made out of a ton of simple idea's that become complicated when they all work together.
@simfoo
@simfoo 3 жыл бұрын
Your channel is one of those rare gems on KZbin
@mason8714
@mason8714 3 жыл бұрын
love seeing new videos like this for new people to linux. Jay's content is fantastic
@crazyivan315
@crazyivan315 3 жыл бұрын
Finally, a way to easily remove pineapple from pizza topping lists.
@manny8717
@manny8717 3 жыл бұрын
Couldn’t agree more. Pineapple as a topping? HECK NO!!
@yewenyi
@yewenyi Жыл бұрын
Pineapple are good, so is feta. It should change it to both.
@k.chriscaldwell4141
@k.chriscaldwell4141 Ай бұрын
Amen!
@TradersTradingEdge
@TradersTradingEdge 3 жыл бұрын
I love these short session. Very codensed helpful stuff. Thanks Jay!
@shabadabadoo4326
@shabadabadoo4326 3 жыл бұрын
Doing linux webserver support for well over a decade, sed became a go-to tool for flipping switches in config files. That said, I know its a lot more powerful than what I ever did with it.
@BilalKhan-rm8qk
@BilalKhan-rm8qk Жыл бұрын
This is my first video, that i watched on your channel. You have explained it very nice and clear.
@larrywilliams8010
@larrywilliams8010 3 жыл бұрын
sed 's/\/etc//' paths.txt Yeah, the command can get rather ugly when lots of escaped characters are needed, but it works and it's second nature for me since I often search for spaces and other characters that must be escaped anyway. Still, I appreciate that there is such an option in case someone wants to learn/use a different delimiter. Thanks for the video
@anthonychaple3031
@anthonychaple3031 3 жыл бұрын
Not all heroes wear cape. Great videos. Go buy this man's book too
@villico3
@villico3 3 жыл бұрын
you explain stuff very well and simple that makes it easy to grasp! thank you for sharing!
@TR1ckY_TV
@TR1ckY_TV 3 жыл бұрын
Finally!!! 🔥 🔥 🔥 Thank you Sir for put the effort in making these amazing videos
@guypartush2976
@guypartush2976 10 ай бұрын
Hi Jay, LOVE your videos! Thank you so much for sharing your knowledge. please consider adding a video on the "w" and "who" commands. I realize it looks kind of obvious, but I am a total beginner in linux and your explanations of commands are the best. Looking forward to keep on learning.
@LearnLinuxTV
@LearnLinuxTV 10 ай бұрын
I completely agree that would be a great fit for my series. I will add it to my list.
@rcdenis1
@rcdenis1 3 жыл бұрын
I asked a college professor what sed was and I could not get a straight answer from him. Thanks Jay, now I understand. Thank you for posting.
@brandonhunter3036
@brandonhunter3036 Жыл бұрын
Thanks man that's what I needed to know. Glad the video was short and to the point.
@MaximumRD
@MaximumRD 3 жыл бұрын
He sed, She sed......................I'll see myself out......
@billquain2369
@billquain2369 3 жыл бұрын
I didn't know that you could change the delimiter to a different character. this would have come in handy last year when I took a Unix/Linux course at college
@chromerims
@chromerims Жыл бұрын
Incredible information that sed delimiter can be something other than / I too had no idea. I look fwd to using other delimiters with sed.
@souleymanebarry9231
@souleymanebarry9231 3 ай бұрын
Instead of changing the delimiter, you can use the backslash(\) before to escape the slash (/) just like this : sed 's/\/etc//'
@devilmaycry0204
@devilmaycry0204 Жыл бұрын
Simple and straight forward, thanks man
@mnmleung
@mnmleung Жыл бұрын
Thank you for very clear presentation and explanation.
@ccroy2001
@ccroy2001 3 жыл бұрын
The word sed means thirst in Spanish. So have some Pineapple juice. Thanks I've set a goal to get better at the terminal so this helps.
@nobilkwt7222
@nobilkwt7222 3 жыл бұрын
I want to eat a pizza now 😂🤣😂🤣😂🤣😂🤣😂😂🤣😂🤣🤣🤣
@xrafter
@xrafter 3 жыл бұрын
Pineapple pizza ?
@YannMetalhead
@YannMetalhead 5 ай бұрын
Great explanation!
@vladimirkulakov8667
@vladimirkulakov8667 Жыл бұрын
oh man... we can use any delimeter!! not only / !!! Thank you! )
@oldpain7625
@oldpain7625 9 ай бұрын
"What are some cool cli apps?" "sed and awk"
@riccoc.6507
@riccoc.6507 2 жыл бұрын
Thank you for showing syntax
@ChristianDavis-x5z
@ChristianDavis-x5z Жыл бұрын
'...something EXTREMELY WRONG with this file.' LOL I'm with you, Jay. Pineapple on pizza--I'm OUT. Thanks for the help on delimiters.
@linuxdoesmatter5542
@linuxdoesmatter5542 9 ай бұрын
You are a genius!!!!! Than you 4 teaching me!!!
@dalirch8496
@dalirch8496 Жыл бұрын
thanks for your effort and explanation
@john-r-edge
@john-r-edge 3 жыл бұрын
Not sure ordinary mortals can master both sed and awk.
@Acksakal
@Acksakal 7 ай бұрын
Thank you
@antoineweb1
@antoineweb1 8 ай бұрын
how about the /g at the end? chatGPT tells me that if you don't add /g at the end, it will only substitute the word once per line, which may not be enough
@antoineweb1
@antoineweb1 8 ай бұрын
for example: echo "a a" | sed s/a/b/ gives "b a" as output
@elnurvalikhanli6783
@elnurvalikhanli6783 2 жыл бұрын
Amazing command and tutorial thanks
@AM-cz7qy
@AM-cz7qy 10 ай бұрын
Thank you very much
@LearnLinuxTV
@LearnLinuxTV 10 ай бұрын
You are welcome
@venkateshiyer5073
@venkateshiyer5073 Жыл бұрын
thank you sir, very helpful
@danperrault
@danperrault Жыл бұрын
That was very helpful. thanks
@guilherme5094
@guilherme5094 3 жыл бұрын
Thanks Jay.
@Blubberland
@Blubberland Жыл бұрын
3:10 instant like
@BlindRambler
@BlindRambler 2 жыл бұрын
Oh no, no, no. I must change every topping to pineapple. This is not allowed to stand. Thanks for showing me how to use sed to do that. You are very kind, but very wrong.
@adammureiko7508
@adammureiko7508 3 жыл бұрын
And what, may I ask, is wrong with Pineapple?
@janekmachnicki2593
@janekmachnicki2593 Жыл бұрын
thanks mate for suspenseful tutorial
@noeelreeds
@noeelreeds 5 ай бұрын
now i can proceed w automations
@surajbhattathiri
@surajbhattathiri 2 жыл бұрын
Thanks
@tolstoievski4926
@tolstoievski4926 Жыл бұрын
what is the difference between -i and -i.bak ?
@محمّد.09
@محمّد.09 2 ай бұрын
that s is for substitute right.
@narayangurung7090
@narayangurung7090 8 ай бұрын
Fantastic
@ThodoreErnest-m6b
@ThodoreErnest-m6b 4 күн бұрын
Noelia Harbor
@Ranblv
@Ranblv 3 жыл бұрын
I think the s stands for substitute not string
@muralikrishna9748
@muralikrishna9748 Жыл бұрын
Wondering what would be the script if I want to replace only the last occurance in the last line of the word Pineapple with Olives in your example file ?
@strifef7
@strifef7 2 жыл бұрын
rude Jay! Pineapple is the GOAT on pizza!!
@TomikoLinne
@TomikoLinne 16 күн бұрын
9450 Aliza Orchard
@nobilkwt7222
@nobilkwt7222 3 жыл бұрын
what about a video about chroot
@sivaprasadk4756
@sivaprasadk4756 2 жыл бұрын
Nice...very useful
@TaunyaRoseberry-t6r
@TaunyaRoseberry-t6r 5 күн бұрын
Shirley Spring
@chessmaster856
@chessmaster856 2 жыл бұрын
How do you undo if find and replace was wrong? Notepad++ can find and replace across all files from ui. You don't need Unix command for that. Also it can undo it. Can you undo from unix????
@CarrollGeorgia
@CarrollGeorgia 19 күн бұрын
121 Dejah Mountains
@spondoolie6450
@spondoolie6450 7 ай бұрын
woah ... I've been using the sed command this whole time in vim?
@derekfrost8991
@derekfrost8991 3 жыл бұрын
The option i followed by a suffix creates a backup = -i.bak this is important as -i can be dangerous.. :)
@AllenWhatley-v2w
@AllenWhatley-v2w 8 күн бұрын
Kyla Islands
@stevenoderayi5776
@stevenoderayi5776 2 жыл бұрын
‘sed’ is short for ‘stream editor’, for those who’re wondering what the command means.
@markchristophergemzon1052
@markchristophergemzon1052 2 жыл бұрын
it was said in the video. thanks anyway.
@shajibdey6451
@shajibdey6451 Жыл бұрын
et(44)1,tet(37)1,oqxB1,VanX-D4,VanX-D4,tet(O)2,aadA51,VanR-G1, here how can I remove everything that comes only after the bracket () by using sed??
@JohnsonFitch
@JohnsonFitch 13 күн бұрын
505 Sunny Branch
@JosephMartinez-r1m
@JosephMartinez-r1m 14 күн бұрын
Kasandra Inlet
@LavoneMaiocco-l4g
@LavoneMaiocco-l4g 15 күн бұрын
Efren Route
@ahmadfrahmand
@ahmadfrahmand 2 жыл бұрын
Sir, have a question for you hope you are doing well. i have 1000 of these files 3B43.20000101.7A.HDF.nc4 i would like to remove . (dots) from the file names, and it should look lie 3B43200001017AHDF.nc4 . i watched your tutorial about sed but it is not working here for this as it is not a txt. hope you got my question
@sohaibesohaib2914
@sohaibesohaib2914 3 ай бұрын
the video starts at 1:20
@spacelem
@spacelem 2 ай бұрын
Sitting here watching the video while eating a ham and pineapple pizza...
@debeeriz
@debeeriz 3 жыл бұрын
i was playing around with it to change one letter in a word to another letter and it worked but only in the first word in each line with the letter. Other occasions of the letter remain unchanged
@debeeriz
@debeeriz 3 жыл бұрын
found out how add a g for global quidsup explains it in more detail
@khomo12
@khomo12 2 жыл бұрын
Nice!
@ivanm9186
@ivanm9186 11 ай бұрын
CHICKEN PINEAPPLE PIZZA IS THE BEST and PERIOD!
@AnzanHoshinRoshi
@AnzanHoshinRoshi 3 жыл бұрын
Thank you, Jay.
@stefanchoh4991
@stefanchoh4991 2 жыл бұрын
I need to use sed to replace ip adress is to nginx config files I wrote a short bash shell script that has the new IP address and the old IP address as variables, I used sed to pass the variables but it give an error Syntax used Is sed “s|$VAR1|$VAR2|” file.txt but this works in the command line just not in the shell script
@MarkClark-m8g
@MarkClark-m8g 20 күн бұрын
Paolo Summit
@vikasmahour6059
@vikasmahour6059 Жыл бұрын
Thanks for your vedios. I am stuck in a problem . My XMl FIle contains data like : 1234 2345 8787987 89898 80098 I want to arrange my xml file such that the tags and should be in a single line without space. 1234 2345 8787987 89898 80098 Tried many sed commands but no luck.Please help me to resolve it .
@ValentineSeegar-k1x
@ValentineSeegar-k1x 22 күн бұрын
Metz Street
@StephanieParker-w4k
@StephanieParker-w4k 12 күн бұрын
Kub Lodge
@PhilipBoullion-o5k
@PhilipBoullion-o5k 13 күн бұрын
Zechariah Trail
@EduardoReyesDPM
@EduardoReyesDPM 3 жыл бұрын
Ty
@chessmaster856
@chessmaster856 2 жыл бұрын
Is Unix dinosaur or not?
@zeeeeeman
@zeeeeeman Жыл бұрын
video starts at 2:00
@ChristianHarvey-u1c
@ChristianHarvey-u1c 6 күн бұрын
Paucek Forges
@HouseAntony-c1h
@HouseAntony-c1h 22 күн бұрын
Ratke Meadow
@srsr6099
@srsr6099 3 жыл бұрын
Awesome again. Now I have awk sed & $bash ?
@xrafter
@xrafter 3 жыл бұрын
ّ
@xrafter
@xrafter 3 жыл бұрын
bash: Now: command not found
@srsr6099
@srsr6099 3 жыл бұрын
sudo apt-get update, could help
@paulojr1384
@paulojr1384 2 жыл бұрын
i felt that a can cheat the machine... stupid machine... lol
@marcravey4621
@marcravey4621 3 жыл бұрын
You have to understand. Unless you can make ordinary devices work, like Bluetooth.. You will always be a third choice. I need to use Bluetooth, and it only stays connected for on average 15 mins. At least printers use the web browser printer settings, else that would be another thing , that doesn't work on any Distro I have used just about every Distro out there, none have lasted for over a year except Linux Mint
@hezekiahwatkins
@hezekiahwatkins 8 ай бұрын
I regret joining cyber security. I understand none of this shit.
@icyjiub2228
@icyjiub2228 Жыл бұрын
anti pineapple people will always be weak
@RayleignRonald
@RayleignRonald Ай бұрын
Moore Jeffrey Perez Barbara Hernandez Anthony
@Thr0nSK
@Thr0nSK Жыл бұрын
Good video, liked it very much but sorry man, I had to click the dislike button... pineapple absolutely BELONGS on pizza!
@alexhu98
@alexhu98 3 жыл бұрын
You just lost all credibility for disliking pineapple🤪
@poojithapriya2370
@poojithapriya2370 3 жыл бұрын
First
@willforrhall
@willforrhall 11 ай бұрын
needs to be -i.bak on mac
@bobwong8268
@bobwong8268 3 жыл бұрын
👍👍👍👍👍 Thanks! This is a great first-step into the wonderful world of /sed/.
@dillon1012
@dillon1012 7 ай бұрын
You sed it
@Ollital
@Ollital 2 жыл бұрын
I tried to understand sed for years. I guess now I've got it. Thank you
@itbook182
@itbook182 3 жыл бұрын
Good morning, Jay. Thank you very much for the detailed guides ! I have an old Toshiba Portege 14" Laptop with Kali 10.04 still installed there. Recently, I wanted to use it for a monitoring device and reinstall it but it is giving the "no pae"- error (common for the very old hardware). It doesn't boot from USB, only from CD/DVD. Do you think, I can still use it to install a Linux OS on it (I wouldn't mind being only CLI - I need it just to be able to install software to monitor my network), and which one you would propose if yes ? Thank you in advance. Asen
@swarooprajpurohit110
@swarooprajpurohit110 2 жыл бұрын
You could use a distro which doesn't require pae or install an older version of kali and then upgrade it
@thalcave8220
@thalcave8220 3 жыл бұрын
Sed is command that I couldn't understand when I was beginner. I learned it but did not understand. After few months of writing sed s/... I noticed that I understand what I was writing.
@MurangShaBu_MahalNaBiGas
@MurangShaBu_MahalNaBiGas 2 жыл бұрын
Thank you Jay Linux is really vast, I just had my certification and I never heard of sed command. I'm glad your putting content for us.
@dorotamartyniuq5553
@dorotamartyniuq5553 2 жыл бұрын
"maybe I'm just hungry, I have no idea why I decided to use pizza toppings as the basis for today's video, but you know what, I did what I did and here it is" it made my day
@brentrambo2571
@brentrambo2571 Жыл бұрын
You sed yes, I sed no You sed stop and I sed go go go, oh no You sed goodbye and I sed hello Hello hello I don't know why you sed goodbye, I sed hello Hello hello I don't know why you sed goodbye, I sed hello
Linux Crash Course - awk
16:07
Learn Linux TV
Рет қаралды 98 М.
Learning Sed Is Beneficial For Linux Users
19:27
DistroTube
Рет қаралды 84 М.
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,7 МЛН
Cute
00:16
Oyuncak Avı
Рет қаралды 12 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 1,8 МЛН
Ozoda - Lada (Official Music Video)
06:07
Ozoda
Рет қаралды 11 МЛН
LCL 30 - sed - Linux Command Line tutorial for forensics
23:02
BlueMonkey 4n6
Рет қаралды 12 М.
EVERYONE Needs to Learn a Little Bit of AWK!
16:29
Gary Explains
Рет қаралды 398 М.
Linux Crash Course - The find command
25:56
Learn Linux TV
Рет қаралды 85 М.
Linux Crash Course - The /etc/fstab file
30:29
Learn Linux TV
Рет қаралды 105 М.
Learning Awk Is Essential For Linux Users
20:02
DistroTube
Рет қаралды 298 М.
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 1,1 МЛН
Linux Crash Course - The grep Command
14:57
Learn Linux TV
Рет қаралды 108 М.
Using `sed` and Regular Expressions (Unix/Linux command line)
14:56
The Tragedy of systemd
47:18
linux.conf.au
Рет қаралды 1,1 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,7 МЛН