About two lines echo into one, after I thought I saw that I made a fast comment. The output makes more sense more readable I thought with the first two echos to one line. Then I tried to delete the comment but too late and after that I saw just two line echos. Weary eyes??! -thank you further for the -n : no new line tip.
@rskret: At what point in the video did I make too echo lines output as one line?
I don't think I did it in this video, but this is one way of doing it:
echo -n "this is a test "
echo "this is a nother test"
The -n in the first line prevents echo from creating a new line. Just make sure you have an extra space in your first string to the to lines don't run together.
so I've never even Heard of bash till today and this morning is the first time I've ever touched linux. I can repeat all the things you did here and remember a few commands but what is the purpose of this?
@metalx1000 i guess i just didnt recognize this as programming. the kind of programming im used to is a java IDE with a compile button, run button, etc. looks like my professor has some teaching to do.
@Charsept well, bash is a -Scripting- language, meaning that it does not needs to generate binaries, so no need to compile and run. it just interprets the script as is, sometimes with the help of other programs (echo, as example). Maybe metalx1000 can explain better.
tried echo "mplayer -fs -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g --cookies /tmp/cookie.txt (link in here ) > youtubestream.txt , but it didnt work. What should i have done please
@metalx1000 This might be something obvious but I just want to make sure; If I learn bash scripting will these scripts work with zsh? just by changing the #!/usr/bin/bash to zsh? or writing sh would work on both?... Thanks for the video.
@ttasutsu: Changing the SheBang (the first line of the script) is telling the OS what shell to use for this script. So, yes changing that line would make the computer use zsh instead of BASH, but if there is something in the script that works different in ZSH then it would in BASH, you might run into problems. Changing it to "sh" would cause it to use the sh shell.
@kalamonsy: First Question, is this Home work? Second, have you at lest started a script that you can share? People in the IRC Channel on my site maybe able to help.
@traveldoode369: You won't find a "tmp.sh" file. The "tmp.sh" is what you learned to make in this video. you can call it what ever you want when you make it.
@zlass55: When using a Unix or Unix like OS (Linux, BSD, Mac) the first line of a script is known as the "shebang". It tells the OS what type of script it is and what interpreter to use. In this case it's a BASH script. A few other options are #!/usr/bin/python for python scripts or #!/usr/bin/perl for perl scripts.
There are also different shell environments. Examples are sh, tcsh, dash, ksh, ash.
@martmelee: I know my first few videos the sound is real bad. They where originally just for a friend of mine and quality didn't matter to much. I've thought about redoing them and still may. But, I have so many things I have to make videos on. I have a list of over 40 videos to do, and every time I make a video I think of 3 more :)
@thecomputerist: You don't have too, it's just proper and a good habit to get into because there are cases where not having them will cause problems. Also, single quotes work different then double quotes.
Ok, I'm starting all over again, and am going to learn from the bottom up. Im such a noob..... but with Metalx1000 Bash lessons.....like an advertisement. (inset comical "before and after" pictures here)
@metalx1000 hello!!! it was an awesome tutorial!! good job!!! may i ask how is it possible to run the script and then output the result in a one file eg out txt?
@markiptvlover: Sure, keep watching my BASH Playlist, and I go over stuff like that. But for now, to save the output to a file just redirect it with a >
Here is an example:
echo "hello world" > output.txt
That will over write anything in that file.
To add to a file use >>
echo "hello world" >> output.txt
If you want to see the output on the screen and save it to a file you can use "tee" if it's install on your system:
@metalx1000 ok that worked!!! thank's!! may i ask something else? is there a way that the results are both appeared in the terminal and in the output file? I mean now i can see them only in the output file but not in the terminal. Any chance to see them both ways?
@markiptvlover: Yes, that is what "tee" does. I mentioned that in the first port. It may not be installed by default, but it should be in your package manager. Let me know if you can't figure it out and I'll give you more details.
@markiptvlover ok thank's!!! i finally made it!! Sorry but at first it seems that i haven't pay too much attention where it said "tee"....Thank's a LOT!!! YOU ARE AWESOME!!
Ok, 2 questions. How do I start Chrome from terminal? and I know how start Twinkle form terminal, but how do I see the lines of programming and list through it to examine it? I want to see my first code. I use a lot of SIP (like you haha) and want to see how it works. Then how do I delete it? I know how to sudo apt-get it. I still cant change directories by cd/ home. Thanks again for your vids, I am just now getting back into programming.
@analyzingfunny: I would think you just type "chrome", but if not you just need to find out what the program is called. Try typing "chrome" and hit tab a few times and see if what option come up. Same with twinkle. remember that it is case sensitive and in most cases the program is going to be all lower case.
@analyzingfunny:I don't know much about Twinkle, so I don't know if it's a scripting language (Python, Perl) or if it's compiled (C, C++). If it's a compiled program, you'll have to get the source code. In the repositories the source code will, in most cases come in the development files. Look for something like "twinkle-dev" other wise check out the twinkle website. They should have a source code package there.
Thanks very much for this video.. it helps alot.. !! and @s200784b.. i like this video and i am not a noob.. i have just started bash scripting and never seen this before in my life.. so how am i supposed to start to learn it.. by jumping straight to advanced??? idiot
@s200784b: Yup, when I start in Linux, I would say to myself, "To day I'm going through all the "A's". I would type "a" and hit [tab][tab] and start at the first command. Read the Man Page and maybe Google it. I would play with it some and then move on to the next command. The next day or when I finished the with "a" I would move on to "b"
thank you so much. ive been really interested in shell and bash scripting and this is really helpful. im glad to see you have at least 5 of them im not sure if you have more yet. i already can make a really basic script but i didnt know about setting a variable to this was really helpful.
oh and i did EXACTLY what you did so when i used ans for the variable it didnt work but then after the vid i tried changing it to blah (just random) and it worked. do you know why?
@mrbackhand1234: Thanks for watching. I actually have over a hundred tutorials up on writing shell scripts currently and I post a few new every week. I also have a lot of tutorial on other Open Source related stuff. Check out the links in the video description.
In the United States, the symbol is usually called the pound sign, and the key bearing this symbol on touch-tone phones is called the pound key. .. In most English-speaking countries outside North America, the symbol is usually called the hash mark, hash sign, or hash symbol, and the corresponding telephone key is the hash key.
@vnck25: I've been asked this before. I haven't read any myself, so I can't recommend a good one. I learn better from Online tutorials. I Google what I want to learn and skim the tutorial. I have plenty of video tutorial at my site that may help.
For some reason I have to keep moving the mouse for the video to proceed. If I don't move the mouse it just stops forever. But its a great tutorial for a newbie like me.
grateful and helpful tutorial. thanks and I would like something to ask about remove user input as you showed above is only for input data. How to remove input data from remove option?
I'll look into it. I'm sure it could be done with cURL. As far as Vista goes, I never touch the stuff, but I'm sure you can get cURL for Vista. And if you are being forced to use Vista you may want to look into something like cygwin.
metalx1000, thank you very much for putting this video up. It's much easier to learn this way than reading loads of pages before things get interesting.
About two lines echo into one, after I thought I saw that I made a fast comment. The output makes more sense more readable I thought with the first two echos to one line. Then I tried to delete the comment but too late and after that I saw just two line echos. Weary eyes??! -thank you further for the -n : no new line tip.
rskret 2 months ago
Thanks much. You made the learning faster, terrific!
rskret 2 months ago
Interesting how you got the 2 echo lines to output as one line! How?
rskret 2 months ago
@rskret: At what point in the video did I make too echo lines output as one line?
I don't think I did it in this video, but this is one way of doing it:
echo -n "this is a test "
echo "this is a nother test"
The -n in the first line prevents echo from creating a new line. Just make sure you have an extra space in your first string to the to lines don't run together.
Hope this helps.
metalx1000 2 months ago
where you download that program
SuperRifet 4 months ago
@SuperRifet You should get Linux or Mac OS and then just use the terminal and a simple texteditor of choice(i recommend xemacs).
Zillo91 4 months ago
@SuperRifet: try "linuxmint(dot)com"
metalx1000 4 months ago
The Purpose of bash scripting is making up a list of commands so you don't have to type them at the terminal all the time
andrewdraper3 4 months ago
so I've never even Heard of bash till today and this morning is the first time I've ever touched linux. I can repeat all the things you did here and remember a few commands but what is the purpose of this?
Charsept 5 months ago
@Charsept: Not sure what you mean by, "what is the purpose of this?".
You mean, "What is the purpose of programming?"
metalx1000 5 months ago
@metalx1000 i guess i just didnt recognize this as programming. the kind of programming im used to is a java IDE with a compile button, run button, etc. looks like my professor has some teaching to do.
Charsept 5 months ago
@Charsept: Oh, well I have over 300 video tutorial on BASH, feel free to check them out.
metalx1000 5 months ago
@Charsept well, bash is a -Scripting- language, meaning that it does not needs to generate binaries, so no need to compile and run. it just interprets the script as is, sometimes with the help of other programs (echo, as example). Maybe metalx1000 can explain better.
KaeLuX 3 months ago
Your tutorials are seriously better than the Linux script classes at my community college were. Thanks for posting them.
Abasuto 5 months ago
tried echo "mplayer -fs -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g --cookies /tmp/cookie.txt (link in here ) > youtubestream.txt , but it didnt work. What should i have done please
MrWaynemarshall 6 months ago
@MrWaynemarshall: Depends, what are you trying to do? I really can't tell from what you have posted.
metalx1000 6 months ago
@metalx1000 i,m trying to save it into a text file so i can open it in the terminal
MrWaynemarshall 6 months ago
@MrWaynemarshall: you are trying to say the video to a text file? as in you want to watch it in ASCII format?
metalx1000 6 months ago
Did anyone else feel like changing welcome... to: wake up neo... cause I did lol
NerdHater72 6 months ago 8
Thanks for posting. This is a nice intro.
steferfootballdude13 7 months ago
@metalx1000 This might be something obvious but I just want to make sure; If I learn bash scripting will these scripts work with zsh? just by changing the #!/usr/bin/bash to zsh? or writing sh would work on both?... Thanks for the video.
ttasutsu 7 months ago
@ttasutsu: Changing the SheBang (the first line of the script) is telling the OS what shell to use for this script. So, yes changing that line would make the computer use zsh instead of BASH, but if there is something in the script that works different in ZSH then it would in BASH, you might run into problems. Changing it to "sh" would cause it to use the sh shell.
metalx1000 7 months ago
Cool how this works on macs :D Faved, this video is fantastic.
TheQuestion8 8 months ago
Very helpful and well explained, thanks for these tutorials!
basil81 8 months ago
could you help me to make calendar with:
Subject,"Start Date","Start Time","End Date","End Time","All day event","Reminder on/off","Reminder Date","Reminder Time","Categories","Description","Location","Private"
kalamonsy 9 months ago
@kalamonsy: First Question, is this Home work? Second, have you at lest started a script that you can share? People in the IRC Channel on my site maybe able to help.
metalx1000 9 months ago
@traveldoode369: You won't find a "tmp.sh" file. The "tmp.sh" is what you learned to make in this video. you can call it what ever you want when you make it.
metalx1000 10 months ago
Why do we need to start the script with: " #!/bin/bash " ?
I can't seem to remember having written that before in any of my earlier scripts. Although said scripts were quite simple. Thanks in advance.
zlass55 10 months ago
@zlass55: When using a Unix or Unix like OS (Linux, BSD, Mac) the first line of a script is known as the "shebang". It tells the OS what type of script it is and what interpreter to use. In this case it's a BASH script. A few other options are #!/usr/bin/python for python scripts or #!/usr/bin/perl for perl scripts.
There are also different shell environments. Examples are sh, tcsh, dash, ksh, ash.
metalx1000 10 months ago
thanks for the tutorials, i think you should re-do them though, the sound quality is not really good, anyway just a suggestion.. xD
thanks again.
martmelee 1 year ago
@martmelee: I know my first few videos the sound is real bad. They where originally just for a friend of mine and quality didn't matter to much. I've thought about redoing them and still may. But, I have so many things I have to make videos on. I have a list of over 40 videos to do, and every time I make a video I think of 3 more :)
metalx1000 1 year ago
Thank you, nice tutorial.
michaeltrich 1 year ago
great video.
cheezcola 1 year ago
wait....why do you have to put the quotes when echo-ing ?
thecomputerist 1 year ago
@thecomputerist: You don't have too, it's just proper and a good habit to get into because there are cases where not having them will cause problems. Also, single quotes work different then double quotes.
echo "test!!"
is different then
echo 'test!!'
go ahead and give it a try
metalx1000 1 year ago
Ok, I'm starting all over again, and am going to learn from the bottom up. Im such a noob..... but with Metalx1000 Bash lessons.....like an advertisement. (inset comical "before and after" pictures here)
analyzingfunny 1 year ago
@metalx1000 hello!!! it was an awesome tutorial!! good job!!! may i ask how is it possible to run the script and then output the result in a one file eg out txt?
markiptvlover 1 year ago
@markiptvlover: Sure, keep watching my BASH Playlist, and I go over stuff like that. But for now, to save the output to a file just redirect it with a >
Here is an example:
echo "hello world" > output.txt
That will over write anything in that file.
To add to a file use >>
echo "hello world" >> output.txt
If you want to see the output on the screen and save it to a file you can use "tee" if it's install on your system:
echo "hello world"|tee output.txt
metalx1000 1 year ago
@metalx1000 actually i want for example all of the following commands to be output in a file out.txt
echo "Hello my login name is" $LOGNAME
echo "I belong in the group" $HOME
echo "The operational system in the machine that i am connected is" $OSTYPE
echo "The current directory that i am in is" $PWD
echo "The list of directories to search for commands is" $PATH
markiptvlover 1 year ago
@markiptvlover : Try this:
#!/bin/bash
cat >>output.txt<< EOF
Hello my login name is $LOGNAME
I belong in the group $HOME
The operational system in the machine that i am connected is $OSTYPE
The current directory that i am in is $PWD
The list of directories to search for commands is $PATH
EOF
metalx1000 1 year ago
@metalx1000 ok that worked!!! thank's!! may i ask something else? is there a way that the results are both appeared in the terminal and in the output file? I mean now i can see them only in the output file but not in the terminal. Any chance to see them both ways?
markiptvlover 1 year ago
@markiptvlover: Yes, that is what "tee" does. I mentioned that in the first port. It may not be installed by default, but it should be in your package manager. Let me know if you can't figure it out and I'll give you more details.
metalx1000 1 year ago
@markiptvlover ok thank's!!! i finally made it!! Sorry but at first it seems that i haven't pay too much attention where it said "tee"....Thank's a LOT!!! YOU ARE AWESOME!!
markiptvlover 1 year ago
Ok, 2 questions. How do I start Chrome from terminal? and I know how start Twinkle form terminal, but how do I see the lines of programming and list through it to examine it? I want to see my first code. I use a lot of SIP (like you haha) and want to see how it works. Then how do I delete it? I know how to sudo apt-get it. I still cant change directories by cd/ home. Thanks again for your vids, I am just now getting back into programming.
analyzingfunny 1 year ago
@analyzingfunny: I would think you just type "chrome", but if not you just need to find out what the program is called. Try typing "chrome" and hit tab a few times and see if what option come up. Same with twinkle. remember that it is case sensitive and in most cases the program is going to be all lower case.
metalx1000 1 year ago
@analyzingfunny:I don't know much about Twinkle, so I don't know if it's a scripting language (Python, Perl) or if it's compiled (C, C++). If it's a compiled program, you'll have to get the source code. In the repositories the source code will, in most cases come in the development files. Look for something like "twinkle-dev" other wise check out the twinkle website. They should have a source code package there.
it should be:
cd /home
not
cd/ home
metalx1000 1 year ago
@s200784b stating the obvious does make you one too
lakshmere 1 year ago
@s200784b that was cool and very helpful. Thanks. I see how it gives all possible commands.
analyzingfunny 1 year ago
Thanks very much for this video.. it helps alot.. !! and @s200784b.. i like this video and i am not a noob.. i have just started bash scripting and never seen this before in my life.. so how am i supposed to start to learn it.. by jumping straight to advanced??? idiot
buzzbingbuzz 1 year ago
Awesome tutorial! You did an amazing job for beginners like me :)
thebigbigdaddy 1 year ago
@s200784b: Yup, when I start in Linux, I would say to myself, "To day I'm going through all the "A's". I would type "a" and hit [tab][tab] and start at the first command. Read the Man Page and maybe Google it. I would play with it some and then move on to the next command. The next day or when I finished the with "a" I would move on to "b"
metalx1000 1 year ago
@s200784b: Everyone has to start somewhere.
metalx1000 1 year ago 11
Thank you for this tutorial! 10/10 :D
fodz0 1 year ago
Thanks dude, you are a true command line warrior!
hallsan 1 year ago
Good tutorial. Thank you.
georun974 1 year ago
good video
tupatmkdc12 1 year ago
Great tutorial.
littleorphanannie100 1 year ago
great video, I was looking for a tutorial like this. Thanks!
MetalShreader 1 year ago
@MetalShreader: No Problem, Thanks for watching.
metalx1000 1 year ago
thanks alot. you are great metalx1000
parkoz2008 1 year ago
Learning to use command line made me love linux even more <3
mdeonx16 1 year ago
Great tut, thanks!
Rene09091971 1 year ago
thanks a lot
very nice tutorial
chmod421 1 year ago
excelent Tutorials
susahe 1 year ago
thank you so much. ive been really interested in shell and bash scripting and this is really helpful. im glad to see you have at least 5 of them im not sure if you have more yet. i already can make a really basic script but i didnt know about setting a variable to this was really helpful.
oh and i did EXACTLY what you did so when i used ans for the variable it didnt work but then after the vid i tried changing it to blah (just random) and it worked. do you know why?
well thanks again.
mrbackhand1234 1 year ago
@mrbackhand1234: Thanks for watching. I actually have over a hundred tutorials up on writing shell scripts currently and I post a few new every week. I also have a lot of tutorial on other Open Source related stuff. Check out the links in the video description.
metalx1000 1 year ago
I want to be a hacker +-+ But first i need some help with this,
I downloaded Backtrack4 (a version of linux with a lot of tools for sniffing, Cracking, xploiting and more)
Thank you for the tutorial, really helpful +10
MrSaggat 1 year ago
gd tutorial!
reverse342 1 year ago
that's toooo easy
why not show me how to make a bomb
popshvt 1 year ago
Dude you said wrong about the sign.
# = Hash Sign
£ = Pound Sign
OlloX3 1 year ago
Interesting.
From Wiki:
In the United States, the symbol is usually called the pound sign, and the key bearing this symbol on touch-tone phones is called the pound key. .. In most English-speaking countries outside North America, the symbol is usually called the hash mark, hash sign, or hash symbol, and the corresponding telephone key is the hash key.
metalx1000 1 year ago
Hash or pound, I hear both used on a regular basis.
I'm Canadian, so we still use British terms for many things, unlike the United States.
67576856666478964567 1 year ago
@metalx1000
Could you recommend a good book for a beginner level bash script programming book ?
Thanks
vnck25 1 year ago
@vnck25: I've been asked this before. I haven't read any myself, so I can't recommend a good one. I learn better from Online tutorials. I Google what I want to learn and skim the tutorial. I have plenty of video tutorial at my site that may help.
metalx1000 1 year ago
@OlloX3 Well said I'm offended now :(
I'm English!
...:(...
WOWNumansi 1 year ago
Comment removed
Zookhaarh 1 year ago
For some reason I have to keep moving the mouse for the video to proceed. If I don't move the mouse it just stops forever. But its a great tutorial for a newbie like me.
Thanks.
RabbiTzedakah 1 year ago
@RabbiTzedakah Wow, a rabbi learning bash!! Awesome!!
senantiasa 1 year ago
nice!
dreamworker777 1 year ago
very nice and crisp tutorial buddy.
thanks a ton for uploading this
sumersinghable 2 years ago
whered you get your linux?
MrManRod 2 years ago
In this video I am running Debian with icewm.
metalx1000 2 years ago
Distrowatch org is a good place to find different distributions of Linux and other Open-Source OS's.
metalx1000 2 years ago
grateful and helpful tutorial. thanks and I would like something to ask about remove user input as you showed above is only for input data. How to remove input data from remove option?
ooneguy1 2 years ago
Thanks, great vid.
Goveynetcom 2 years ago
very good, thank you
krezkort 2 years ago
all your videos are very helpfull and informative... :) thanks a lot.
pbompally 2 years ago
How to upload videos fast on to youtube? is there any script tool which I can install and use on Vista?
pbompally 2 years ago
I'll look into it. I'm sure it could be done with cURL. As far as Vista goes, I never touch the stuff, but I'm sure you can get cURL for Vista. And if you are being forced to use Vista you may want to look into something like cygwin.
metalx1000 2 years ago
the most incredible clear tutorial here, thank you very much.
UR the man!
squirtmph 2 years ago
Great Tutorial! Very descriptive and easy to understand. Keep up the good work!
xXRedD3athXx 2 years ago
Great tutorial :)
MissLadyboy007 2 years ago
thx man
Adrianisv 2 years ago
Dude, that was a GREEEEEAAAATTTT Job, keep them coming!
RabinoBoricuaVirtual 2 years ago
go linux!
cheese319 2 years ago
I want to thank u so much, u made this so much clearer than my prof. THANKKKKKKKKK U. Keep the good work.
TanikaB 2 years ago
metalx1000, thank you very much for putting this video up. It's much easier to learn this way than reading loads of pages before things get interesting.
Many thanks!!! Wishing you all the best.
MagnificentKot 2 years ago
New to Unix/Linux thank you very much. This so much easier than reading a HOWTO!
mattposton1982 2 years ago
thanks loads
jayjaygibbs 2 years ago
thanks i am new to linux
unstman12 2 years ago
very helpful, thanks for putting this. :D
orelhai 2 years ago
cheers, very helpful keep them coming ^^
wezrule 2 years ago