Some useful notes after this video : 1. vim : file editor in linux • 'sudo vim fileName' - open or create/open the fileName • 'a' - insert mode in vim • 'esc' - come out of insert mode 2. search in file • ': / *MAX*' - look for anything like MAX letters in vim opened file, down the file from the cursor • ': /? *max*' - look for anything like max letters , up the file from cursor • 'n' - find next in search results, up or down, inside the vim opened file. 3. switch to other file from within a file • ':e filename' - opens the new file 4. quit from file • ':q' - quit file (quit a file, say if you edited nothing) • ':q!' - force quit file (sometime unable to quit a file) • ':wq' - save file and quit • ':w fileNew' - save the content of present file to other file name fileNew (save as)
This guy is amazing. I learned a lot from Eli before I started my journey in the IT industry back in 2017. I have been jobless for about three years now, but I’m about to apply again for an IT staff position. Several companies require qualifications for a better understanding of Linux or more advanced knowledge. It took me about 4-5 hours to finish all of his 9 video tutorials to wakeup and refresh the learnings i had before. Even though the videos are old, they are still very effective. Thanks Eli! the best!
I hope I can give a 1000 likes for the way you teach. i got my current job because of listening to your videos before the interview. One of the best teachers out there. Thank you Eli.
Thanks Eli for a fantastic series of tutorials for the beginners. These tutorials have taken a lot of the fear out of learning Linux and migrating from windows. Clearly there are often many different ways of achieving the same result with software like vim but you only need to be told one way to learn and not all the different ways of doing the same task. A big thanks for your time and effort in presenting a easy to understand and effective series.
You are much more sophisticated than the vim, seriously you have done a really great job by providing the learning pack for the common people, thanks alot
Learned more in 30 minutes than I would had ever dreamed off. Clear explanations, clear examples and How To. Wished I had a teacher like this when took a Linux College course.
Thanks Eli. Very good teaching. I like the way you repeat the main points again at the end. Your teaching is such that it makes it easy to believe a person can migrate to linux from windows. - thanks for all your hard work.
Eli did warn us that there are some hard-core egomaniacs in the Linux user crowd who have to be the only ones right. He also managed to demonstrate that quite effectively by drawing them out of the woodwork. Thanks for the great intro material Eli.
I like that your videos are best as far as linux is concerned. All other courses and videos show slides with audio.Your videos show the instructor in frame always.Seeing the face of the instructor makes you understand better,makes you calm.Just keep your tutorial this way,that is,face to face ,eyes to heart.
Im starting my computer science degree program and your lessons help me so much, You do a great job. I passed your interview with the recruiter onto one of my professors.
Em... I don't think it's a good idea to instruct people to "always use sudo". That's essentially running as a root user all of the time. It's true that you need to be a root user for configuration file editing... but that's not (and shouldn't be) a general case. Unless it's specifically necessary, users should not run as root because it's unsafe and could break something... There are plenty of things (most?) you might use vim for which don't require root.
Very much agree! Sudo is only necessary for editing files outside your home directory. It has nothing to do with which Linux distribution you're using, like he says in the video.
Well.. You talking from a linux person perspective. You lack empathy. Eli tries to teach people how to run commands on their personal ubuntu server, sitting at home doing nothing. Eli talks about a linux server which we can play and break. If he says use sudo here and dont use sudo there, then half of totally beginners will give up. This is why Eli wins here. Noone gives up on his videos. He makes assumptions from the beginning to make everything simple for a beginner. Not a simple for someone who already has some idea about linux. This video doesn't care what a linux person would think. And I love this approach of Eli.
Hi Eli is just teaching us the basics to start in this class . Of course there are lots of things you have to consider before you making any changes to your production server . (sp. Security and FW ). He is the best person here if you have time upload your video and provide the link..
He is absolutely right about editor wars between linux geeks. The side you end up on depends on who showed you how to use whatever editor first. I'll have to say that I know emacs very well and it has been my go to editor for a long time. The problem with emacs is that it is a rather large app to put on a server (if you are penny-pinching space), and Vi/Vim are much more lightweight which is why they are the editors of choice for server systems. I must give a hat tip to Eli. His explanation and walk-through of Vim was very well done. I know this tutorial is at least 4 years old, but everything Eli explains here is still relevant today (2016 at the time of this post). It is well worth a review if you are not familiar with Vim.
+Lee Houchin I use to be an Emacs guy too as vi was kinda badmouthed at my Uni. Used it from 1998-2003 isch on off and now since 2014 I exclusively use vi as I work on minimal installation CentOS Linux nodes in clusters. I basically know like 10 things in vi and thats it, but its enough. I never learned Elisp or even "how to steal good" but I just kept using Emacs cause it did have some smart features back then, like multi-pane editing and when I was the most hardcore I nearly never touched the mouse (X11 manager on IRIX mostly back then and Redhat Linux of the Fedora kind, earliest versions). I hear you loud and clear and its damn true. But for server managers there is only really vi and maybe nano for the few that like that. Even as a vi advocate I will still say that it is a bit weird and one has to learn the vi tricks that only works in that editor, ie it doesnt share any standard stuff with any other programs which for me is the annoying part.
I've been using Linux for a few months now and I've come to always be explicit with file extensions. While they make no difference to the system itself, they're a major advantage / convenience to the user [For example, if you do ls -X, the files will be listed alphabetically by file extension, e.g., osifoe.abc, skefeui.bcd eajfhawdj.cde.]. So if I make or download a file, I'll always append the file name with the appropriate file extension. Linux doesn't get confused by miss assigned file extensions, either. You can take a .jpg and call it a .txt and an image viewer won't care. By the way, It's my understanding that all system configuration files in Linux are plain text. Meaning that any editor can view / edit them.
There are plenty of Linux programs that do expect correct extensions though. While it's true that you can tell a program to open a file despite a wrong extension (if you name an image file "picture.txt", a graphics editor can still open it), but still: - Many linux file managers will depend on the extension to assign an icon and a default program to open a file. - Software that scans your filesystem for specific files will often rely on the extension. E.g. music managers (like Banshee) will look for .mp3, .ogg, .flac and other music files. A music file with a wrong extension (or none) will not be found. While the above mostly relate to Linux desktops, servers have their own share of issues - just imagine a fileserver or webserver that only allows users to upload image files etc. (although it may be a good idea to check if a user tries to upload a virus with a .jpg extension)
8:25 No No No! Do not change the owner of root files! If you can read and write to the file, so can any program or script you run. It's not safe! The system also may not be able to open the files after chown changes.
sudo vim filename will allow you to edit files without need to permanently change permissions because its a security issue if you forget to change them back
Eli, your videos are amazing! Thank you! I would like to add just one thing. As a beginner, I stuck with 'quitting' the file. As I figured later, first, I had to hit the 'Esc' key to go into command mode. And only then type :wq.
Most of Eli's videos are not made from an encyclopedic standpoint. He wants to get a general concept across, which is difficult if you keep getting into subconcepts and subconcepts before someone understands the base concept. His teaching style makes it very easy to attack the content for not being detailed enough, or verbose. However, it's also a great way to explain something to someone who doesn't understand what the hell you're talking about.
6:15 'creating' a file (by calling it's name): not so fast! It will be created when you save that file, but it's discarded when you change your mind, and leave vim with say.. :q!
I am now just a fan of your.. Your are really awesome in explaining things... even if a person do have 0 knowledge you explained everything perfectly.... Thank you very much for all your awesome videos... Looking forward for some videos on Vmware technologies like ESX3.5, 4 :)
Great thanks Eli, I am English and from England and 60 years young, ( I wish people would say United Kingdom or leave it out; as I hate being called a resident of UK) Yeah It's nothing you said Eli, just a lot of information systems now shorten United Kingdom to UK and it's not nice. Yeah I found your lessons very helpful and I am defiantly thinking of changing to Linux for the power of command line usage. I really like your idea of using Windows 7 for GUI and Linux server for command line usage. So I downloaded Linux Mint to get me started as it's easy to experiment with Linux without even installing it. Your Lessons have been very helpful Eli; so thanks again.
Ricardo is right in something. The lesson is good, but it would be a great idea to introduce file permissions before... Change owner to modify a root owned config is a very strange approach. By the way, sudo vim ... will alow to modify any file. Cause it's a sudo. =) Other example to introduce chown command is needed. Learn security! Other way Eli will teach other people to hacking on your server. =)
I've gotta say this guy has officially convinced me to have a dual boot of windows and linux, from a brand new game developer standpoint, he's giving me a good background on a process of you know developing the game in windows, using IDE's like visual studio or sublime compiling and 3d models from blender putting them into unreal engine, however from what I gather unreal engine is glitchy as hell in linux and a lot of IDE's given visual studio is microsoft it'll probably never see linux compatibility. However rather to compile on windows then just use linux vim to edit and to maintain the server is friggen brilliant and I think this guy has some great insight into it. Because for me I only started to do all this a few weeks ago and I wouldn't have even known what an IDE or any of that all is but fuck this is just amazement, I feel like I understand life now.
The tutorial was great and I enjoy it as most of your videos. Ubuntu 16.04 is my first experience with Linux, and in it I was completely lost following your instruccions. After hours expending trying many codes to make the word INSERT comes up. Whent to a Ubuntu wep community page and discover that Vim is not there until is downloaded. So I installed Vim and back again to finished your video tutorial.
Compared to other editors, creating a file is not "very, very simple". There is no hint as to what you should do. I am sure that vim is amazing when you know it well, but my favorite command is still ":q". The initial learning curve is just way too steep. Sublime if you have a gui, otherwise i'd use nano.
A couple things: 1. You didn't explain a lot of the commands, which I think would have helped a lot of newbies to remember the commands. -For example, what is ":wq"? Had you noted that it means "write-n-quit", then that would be an easy mnemonic to remember it by.- (27:00); Why "a" (insert after) for insert? No mentioning of i/I (insert before/BOL), O/o (Over/under), or A (EOL). 2. You can search with simply "/" rather than ":/". Bonus points for activating ":set hls" 3. Am I the only one that pronounces it "sue d'oh"? ;)
+Braden Best Yes, those are 2 more that I also do. I suspect it's from being self taught instead of having had someone teach me, thereby forming my own pronunciations. That and when letters are initials that stand for something, I'm more inclined to distinguish each letter as a permanent reminder to myself of what those letters represent.
JHuff276 For me, it's more that I just hate the sound of the common pronunciations. In a professional environment, I'd pronounce them the "proper" way.
david Oh, that's neat! The thing is confusing to me, so I hardly use it except for, e.g. ":1!ls" to dump the directory contents into the buffer, or ":%!xxd" if I need to use a hex dump. all I know is that it takes lines as input and prints the result back into the buffer. I would have never guessed that this was possible, or that :w apparently writes the buffer contents to stdout. I'm going to have to play with that. When the read-only thing happens to me, I usually just save it to a temp file and then write it over the original. E.g... :wq ~/passwd ~$ su /home/braden# cat passwd > /etc/passwd && rm passwd I do it as root to ensure the permissions are preserved. I use 'cat >' because I always forget which one of (mv/cp) changes the owner. I've made that mistake so many times, though, that I've learned to catch the red "RO" at the bottom before I start editing...most of the time. *Edit:* my theory was correct. '!' pipes the selected lines to the command following the '!'. ":[lines] ! [command]" is equivalent to "sed -n "[lines]p" file | [command]". For some reason, it appears that 'w' acts like '%' when piping. :1,5!tee test2 (prints lines 1-5 to "test2") :1,5!xxd > test3 (prints a hex dump of lines 1-5 to "test3") I then tried it with a root owned file: $ su # cat test > test2 # ^D $ vi test2 :w [RO error] :%!sudo tee test2 (saved successfully) And it saved it it over the same file successfully. I think using "%" makes more sense, and it's strange that :w works at all. With this understanding, I've devised that an alternate way to do it is ":%!sudo cat>%", which selects all lines (the first %), and prints it into the same file (the second %) using I/O redirection (>). *Edit 2:* I just made the mistake now, and noticed that sudo cat doesn't work, oddly enough. ':%!sudo tee %' did work, though. So that brings up another question: aside from allowing you to split output between stdout and a file, what is the technical difference between 'tee' and '>' such that it means the difference between saving a file and being slapped with a permission denied error?
david Ah, I figured it out. tee is being run as sudo, but '>' is not, since it just uses the underlying shell to send 'sudo cat's output to a file. Thus, if I make the shell a root shell, and do it, then it should work :%!sudo sh -c "cat>%" And guess what, it works! And now that I understand what's going on under the hood, I won't be forgetting ':w!sudo tee %' any time soon
23:40 there are more keybindings to go to insert mode than just 'a'. 'a' goes to the next character 's' removes the next character 'o' creates an empty line below the current and goes down to it 'i' goes directly into insert mode without other actions.
im sorry, but though file associations are a little weird in linux, you can still have a filetype that will be associated with a program. either that or double clicking a png is black magic.
the section on permissions is confusing. If you're using sudo to edit, then you're doing everything as root, so what was the point of the whole chown thing.
if you want to learn vim there are three steps: 1. use vimtutor. that means type 'vimtutor' into the shell. do the whole thing. it takes an hour. 2. try and use vim to do literally everything for the next two weeks. Some exceptions to this rule are programming huge apps that require an IDE for code completion (like Android apps, large web apps maybe). Besides that use vim. Every time you don't know how to do something (or forget), google it. 3. slowly start customizing vim to do what you want. youtube and google are great places to learn how this works. Vim makes a lot of sense. You WILL learn to use BY USING IT and googling how to do things as the need arises. If you stick with it for two weeks you'll see you're gonna love it. Slowly you'll learn about plugins, commands, scripting... that'll take a few months. You'll enjoy vim and start being good at it after like 2 weeks of consistent use though. If you're not a programmer or natural tinkerer, don't use vim.
2:32 That's simply not true. Sure, text files typically don't have any extension. But documents and images of course do, e.g. docx and png. If an image doesn't have an extension, how is Linux supposed to know how to open it? It even warns you when you rename the file and remove the extension when using nautilus.
11:48 "..there are no file associations.." Would not some of the files that we would be editing as administrators have file extensions for the programs to know what to do with them as well? So, it is a rule not to have them or just this file that you are making in this tutorial... Of course I have not watched passed this point at this time. Thank you so much for the videos so far! Learning lots!
***** There are no file extensions in linux. Programs in linux does not care if a file ends in .png or .ini or whatever, the information about how the file is used is stored in the header of the file content itself. Some people still but .png or .ini or whatever just to remind them as users what the file is for.
DailyLGS There's also the fact that bash and a few other shells use file extensions to aid tab completion. For example, 'feh abc' will only autocomplete if I have a file named e.g. "abdcef.png". If it's "abcdef.conf", bash will ignore it. Personally, I find this to be more annoying than helpful. I shouldn't have to insert ';ls ' to make bash ignore the file extensions and quickly grab the filename. I shouldn't have to 'ls' before typing the command so I can select+paste the file with my mouse. I should be able to just press tab and have the bloody file auto-complete, regardless of the file extension, out of the box.
That being said, he doesn't suck, he just addresses a very basic audience. Sometimes, I feel, he is addressing an audience too basic for the task his pen testing stuff, if you're having to explain how to use virtualbox, I'm not sure the audience is ready.) if you don't know WHY the editor isn't allowing you to save your file (permissions issue), do "ls -l" on the parent directory and see what the permissions of the file is, definitely don't just go chowing files with sudo....
Download the files from your remote machine, and then edit them locally? You can't run an editor with a GUI on a system that doesn't have a GUI installed.
EvilPopsicleDog You can. If you are running linux (or really any system with an X server - i think there are even solutions for windows to do this) and you ssh into the box, if you ssh with the option -X, you can open gui programs from that command line (e.g. gedit to edit a file) and the gui will be rendered locally on your side.
True but as he said right at the beginning: you won't know what the ownership is until after you've done any edits and want to save the file. It's better to just get used to writing "sudo vim" than "vim" and realising after a massive edit "oh I don't have permission" You don't NEED to do it but it's erring on the side of caution
Just a few things, sudo is dangerous to use if you don't know what are you doing. The other thing is there is file assossiation in linux, but not to the extension of the file (the .txt thing on the end of the file) linux assossiates files based on the content of the file, this is done because is easy to "trick" the system if you name a file by a different extension. In the case of text editor you can open every file in your system, even binary files but you won't be able to understand it
I've been having an overheating problem with my Ubuntu...i.e. the computer shuts down when it hits it's critical trip point of 106 degrees. I've changed the permissions and ownership of the files correctly but I am still unable to modify or delete the thermal zone trip point files...Any suggestions? And no, I am not concerned about burning out my cpu.
I agree, Eli. I was taught on Vim & still use it primarily. I was shown Nano & it IS cool BUT I am very happy with Vim so why learn Nano, IMO? But... I have been explained the importance of learning Emacs along with Vim because some more high end administration is easier using a combination of the 2, so how about making us lazy folks an Emacs tutorial? Again, thanks for the awesome vids. I can only read so much in a day and these tutorials really help! BTW, I keep reading Elite Computer Guy :-D
You can run/read/write any file if you have permissions to do it, it is not associated with any distribution, at this level it just kernel. in your home, most of the cases, you have full access to the entire tree, in configuration files you can't of course, so you'll need to use any user who can. for example, /etc/sudoers, this is a non-editable file, unless you change it's permissions, same for /etc/fstab and so on... permissions, one key why Linux won't run virus.
I'm using Vim in Bash in Ubuntu, with the Windows Update. I cannot find the text files I save anywhere. The only way I can access them is through Vim with the : Also, my username doesn't seem to show in the User file under C: It's just Users/"Users", where "Users" would be my username. I already set my username in Ubuntu Bash. I am a little confused because this website shows how to do it, however I am not seeing the same things. www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/
Good basic introduction to vim. BUT: Please don't chown files willy-nilly. Basically the user lives in his home folder. Instances above are root owned on pupose. That prevents Joe-Blow from messing up the system by editing a crucial config-file. Just saying.
sudo has a configuration file which controls which users are able to run which programs via sudo. The only reason he was able to change users in his examples was he had full sudo access.
I understand that you type ":wq" instead of ":x" because it's easier for new people to remember. But don't you think that it would be easier to teach them that going to insert mode can be accomplished by hiting 'i'? In this video it would be also good if you would show them what's going to happen when they edit some config file (without sudo) and they would like to save. It would be easier than this part about chown. Anyway great job, you videos are really valuable! PS: not ROOT just root :)
I appreciate your instructions, but this one has several little errors. I do not like to dicuss the mentioned problem to change the ownership of files, but something on searching / moving in files: - It will not work, if you use ":/ tofind" with that space, because it searchs for " tofind", a string beginning with a space. - To search up to the beginning of the file you have to write ":?tofind", without the beginning slash "/". - At least for searching you need not to go to the complex mode by pressing ":". It's enough to press "/" oder "?" in the command mode. That's how it works on my system a 64-Bit-PC currently used under Linux Mint 18. Again, I appreciate your videos. (But because English is not my native language, I've problems spelling appreciate, it was the hardest part in writing this comment. Some day I will get it, I hope.) :-)
Cat isn't an editor. Nano is really basic and easy to understand: www.howtogeek.com/howto/42980/ Vim is a "real" editor, but it has a steeper learning curve.
The best one is the one with YOU can get the work done. nano is simple to use, vim has the command mode which one your learn it will let you reduce the time it takes you to get some tasks done. So in short, if you need to edit a lot, I would recommend you to learn vim.
Some useful notes after this video :
1. vim : file editor in linux
• 'sudo vim fileName' - open or create/open the fileName
• 'a' - insert mode in vim
• 'esc' - come out of insert mode
2. search in file
• ': / *MAX*' - look for anything like MAX letters in vim opened file, down the file from the cursor
• ': /? *max*' - look for anything like max letters , up the file from cursor
• 'n' - find next in search results, up or down, inside the vim opened file.
3. switch to other file from within a file
• ':e filename' - opens the new file
4. quit from file
• ':q' - quit file (quit a file, say if you edited nothing)
• ':q!' - force quit file (sometime unable to quit a file)
• ':wq' - save file and quit
• ':w fileNew' - save the content of present file to other file name fileNew (save as)
This guy is amazing. I learned a lot from Eli before I started my journey in the IT industry back in 2017. I have been jobless for about three years now, but I’m about to apply again for an IT staff position. Several companies require qualifications for a better understanding of Linux or more advanced knowledge. It took me about 4-5 hours to finish all of his 9 video tutorials to wakeup and refresh the learnings i had before. Even though the videos are old, they are still very effective. Thanks Eli! the best!
I hope I can give a 1000 likes for the way you teach. i got my current job because of listening to your videos before the interview. One of the best teachers out there. Thank you Eli.
Thanks Eli for a fantastic series of tutorials for the beginners. These tutorials have taken a lot of the fear out of learning Linux and migrating from windows.
Clearly there are often many different ways of achieving the same result with software like vim but you only need to be told one way to learn and not all the different ways of doing the same task.
A big thanks for your time and effort in presenting a easy to understand and effective series.
You are much more sophisticated than the vim, seriously you have done a really great job by providing the learning pack for the common people, thanks alot
Learned more in 30 minutes than I would had ever dreamed off. Clear explanations, clear examples and How To. Wished I had a teacher like this when took a Linux College course.
Thanks Eli. Very good teaching. I like the way you repeat the main points again at the end. Your teaching is such that it makes it easy to believe a person can migrate to linux from windows. - thanks for all your hard work.
Eli did warn us that there are some hard-core egomaniacs in the Linux user crowd who have to be the only ones right. He also managed to demonstrate that quite effectively by drawing them out of the woodwork.
Thanks for the great intro material Eli.
Man, Eli Bro you don't have any idea how much you have helped me . You're such a wonderful guy .
I like that your videos are best as far as linux is concerned. All other courses and videos show slides with audio.Your videos show the instructor in frame always.Seeing the face of the instructor makes you understand better,makes you calm.Just keep your tutorial this way,that is,face to face ,eyes to heart.
Im starting my computer science degree program and your lessons help me so much, You do a great job. I passed your interview with the recruiter onto one of my professors.
currently what are you doing ?
@@rhgsyh4775 I work at Apple
You are probably the best teacher on youtube without a doubt
Em... I don't think it's a good idea to instruct people to "always use sudo". That's essentially running as a root user all of the time. It's true that you need to be a root user for configuration file editing... but that's not (and shouldn't be) a general case. Unless it's specifically necessary, users should not run as root because it's unsafe and could break something... There are plenty of things (most?) you might use vim for which don't require root.
Very much agree! Sudo is only necessary for editing files outside your home directory. It has nothing to do with which Linux distribution you're using, like he says in the video.
sudo rm *
Well.. You talking from a linux person perspective. You lack empathy. Eli tries to teach people how to run commands on their personal ubuntu server, sitting at home doing nothing. Eli talks about a linux server which we can play and break. If he says use sudo here and dont use sudo there, then half of totally beginners will give up. This is why Eli wins here. Noone gives up on his videos. He makes assumptions from the beginning to make everything simple for a beginner. Not a simple for someone who already has some idea about linux. This video doesn't care what a linux person would think. And I love this approach of Eli.
I've found it's really a personal preference type of thing. I learned VIM first and liked it so that's what I use... VI is good too...
Brilliant pedagogical presentation. Absorbed in one sitting!
It just doesn't feel like a Linux tutorial without being patronised, talked down to and shouted at :-)
wrong fetish
Hi Eli is just teaching us the basics to start in this class . Of course there are lots of things you have to consider before you making any changes to your production server . (sp. Security and FW ). He is the best person here if you have time upload your video and provide the link..
for those who think you know, this is NOT for you! but for us who are just beginning to use linux, meeen! it's made a lot easy to sink in!
big up Eli.
He is absolutely right about editor wars between linux geeks. The side you end up on depends on who showed you how to use whatever editor first. I'll have to say that I know emacs very well and it has been my go to editor for a long time. The problem with emacs is that it is a rather large app to put on a server (if you are penny-pinching space), and Vi/Vim are much more lightweight which is why they are the editors of choice for server systems.
I must give a hat tip to Eli. His explanation and walk-through of Vim was very well done. I know this tutorial is at least 4 years old, but everything Eli explains here is still relevant today (2016 at the time of this post). It is well worth a review if you are not familiar with Vim.
+Lee Houchin I use to be an Emacs guy too as vi was kinda badmouthed at my Uni. Used it from 1998-2003 isch on off and now since 2014 I exclusively use vi as I work on minimal installation CentOS Linux nodes in clusters. I basically know like 10 things in vi and thats it, but its enough. I never learned Elisp or even "how to steal good" but I just kept using Emacs cause it did have some smart features back then, like multi-pane editing and when I was the most hardcore I nearly never touched the mouse (X11 manager on IRIX mostly back then and Redhat Linux of the Fedora kind, earliest versions). I hear you loud and clear and its damn true. But for server managers there is only really vi and maybe nano for the few that like that.
Even as a vi advocate I will still say that it is a bit weird and one has to learn the vi tricks that only works in that editor, ie it doesnt share any standard stuff with any other programs which for me is the annoying part.
I've been using Linux for a few months now and I've come to always be explicit with file extensions. While they make no difference to the system itself, they're a major advantage / convenience to the user [For example, if you do ls -X, the files will be listed alphabetically by file extension, e.g., osifoe.abc, skefeui.bcd eajfhawdj.cde.]. So if I make or download a file, I'll always append the file name with the appropriate file extension.
Linux doesn't get confused by miss assigned file extensions, either. You can take a .jpg and call it a .txt and an image viewer won't care.
By the way, It's my understanding that all system configuration files in Linux are plain text. Meaning that any editor can view / edit them.
There are plenty of Linux programs that do expect correct extensions though. While it's true that you can tell a program to open a file despite a wrong extension (if you name an image file "picture.txt", a graphics editor can still open it), but still:
- Many linux file managers will depend on the extension to assign an icon and a default program to open a file.
- Software that scans your filesystem for specific files will often rely on the extension. E.g. music managers (like Banshee) will look for .mp3, .ogg, .flac and other music files. A music file with a wrong extension (or none) will not be found.
While the above mostly relate to Linux desktops, servers have their own share of issues - just imagine a fileserver or webserver that only allows users to upload image files etc.
(although it may be a good idea to check if a user tries to upload a virus with a .jpg extension)
8:25 No No No! Do not change the owner of root files! If you can read and write to the file, so can any program or script you run. It's not safe! The system also may not be able to open the files after chown changes.
very poor, I feel sad now ;'c
:w !sudo tee %
:w !sudo sh -c "cat > %"
sudo vim filename will allow you to edit files without need to permanently change permissions because its a security issue if you forget to change them back
chown user.user /etc/passwd
Enjoy
Eli, your videos are amazing! Thank you!
I would like to add just one thing. As a beginner, I stuck with 'quitting' the file.
As I figured later, first, I had to hit the 'Esc' key to go into command mode. And only then type :wq.
Thank you Eli. You make things easy. I really appreciate your presentations. So, easy to understand.
Most of Eli's videos are not made from an encyclopedic standpoint. He wants to get a general concept across, which is difficult if you keep getting into subconcepts and subconcepts before someone understands the base concept. His teaching style makes it very easy to attack the content for not being detailed enough, or verbose. However, it's also a great way to explain something to someone who doesn't understand what the hell you're talking about.
Haha, good to see you here, 7 years too late. I can actually vouch, I am learning something from Eli.
6:15 'creating' a file (by calling it's name): not so fast! It will be created when you save that file, but it's discarded when you change your mind, and leave vim with say..
:q!
Is it stored in RAM until you write it to the disk with :w?
I am now just a fan of your.. Your are really awesome in explaining things... even if a person do have 0 knowledge you explained everything perfectly.... Thank you very much for all your awesome videos...
Looking forward for some videos on Vmware technologies like ESX3.5, 4 :)
Great thanks Eli,
I am English and from England and 60 years young, ( I wish people would say United Kingdom or leave it out; as I hate being called a resident of UK)
Yeah It's nothing you said Eli, just a lot of information systems now shorten United Kingdom to UK and it's not nice.
Yeah I found your lessons very helpful and I am defiantly thinking of changing to Linux for the power of command line usage.
I really like your idea of using Windows 7 for GUI and Linux server for command line usage.
So I downloaded Linux Mint to get me started as it's easy to experiment with Linux without even installing it.
Your Lessons have been very helpful Eli; so thanks again.
Ricardo is right in something. The lesson is good, but it would be a great idea to introduce file permissions before...
Change owner to modify a root owned config is a very strange approach. By the way, sudo vim ... will alow to modify any file. Cause it's a sudo. =)
Other example to introduce chown command is needed.
Learn security! Other way Eli will teach other people to hacking on your server. =)
Thank you very much,the tutorial is pretty easy to understand even for a Chinese student who isn't familiar with English and IT.
I've gotta say this guy has officially convinced me to have a dual boot of windows and linux, from a brand new game developer standpoint, he's giving me a good background on a process of you know developing the game in windows, using IDE's like visual studio or sublime compiling and 3d models from blender putting them into unreal engine, however from what I gather unreal engine is glitchy as hell in linux and a lot of IDE's given visual studio is microsoft it'll probably never see linux compatibility. However rather to compile on windows then just use linux vim to edit and to maintain the server is friggen brilliant and I think this guy has some great insight into it. Because for me I only started to do all this a few weeks ago and I wouldn't have even known what an IDE or any of that all is but fuck this is just amazement, I feel like I understand life now.
since last week your videos are like my good breakfast. best usage of my time
The tutorial was great and I enjoy it as most of your videos. Ubuntu 16.04 is my first experience with Linux, and in it I was completely lost following your instruccions. After hours expending trying many codes to make the word INSERT comes up. Whent to a Ubuntu wep community page and discover that Vim is not there until is downloaded. So I installed Vim and back again to finished your video tutorial.
Compared to other editors, creating a file is not "very, very simple". There is no hint as to what you should do. I am sure that vim is amazing when you know it well, but my favorite command is still ":q". The initial learning curve is just way too steep. Sublime if you have a gui, otherwise i'd use nano.
Great teaching voice...great communicator. I just found your channel. It's helping me understand Linux much better.
A couple things:
1. You didn't explain a lot of the commands, which I think would have helped a lot of newbies to remember the commands. -For example, what is ":wq"? Had you noted that it means "write-n-quit", then that would be an easy mnemonic to remember it by.- (27:00); Why "a" (insert after) for insert? No mentioning of i/I (insert before/BOL), O/o (Over/under), or A (EOL).
2. You can search with simply "/" rather than ":/". Bonus points for activating ":set hls"
3. Am I the only one that pronounces it "sue d'oh"? ;)
I pronounce it that way also. I pronounce GNU by saying each letter instead of g'noo. There are several others, but I don't remember them off hand.
JHuff276 Heheh, I too, spell out GNU. I also spell out GUI and ASCII because "gooey" and "ass key" don't sound right.
+Braden Best Yes, those are 2 more that I also do. I suspect it's from being self taught instead of having had someone teach me, thereby forming my own pronunciations. That and when letters are initials that stand for something, I'm more inclined to distinguish each letter as a permanent reminder to myself of what those letters represent.
JHuff276
For me, it's more that I just hate the sound of the common pronunciations. In a professional environment, I'd pronounce them the "proper" way.
I've never been in a professional environment, but I can't imagine doing it then, either. Lol.
If you edit a file in read only mode in vim you can save it using ":w !sudo tee %"
david Oh, that's neat! The thing is confusing to me, so I hardly use it except for, e.g. ":1!ls" to dump the directory contents into the buffer, or ":%!xxd" if I need to use a hex dump. all I know is that it takes lines as input and prints the result back into the buffer. I would have never guessed that this was possible, or that :w apparently writes the buffer contents to stdout. I'm going to have to play with that.
When the read-only thing happens to me, I usually just save it to a temp file and then write it over the original. E.g...
:wq ~/passwd
~$ su
/home/braden# cat passwd > /etc/passwd && rm passwd
I do it as root to ensure the permissions are preserved. I use 'cat >' because I always forget which one of (mv/cp) changes the owner.
I've made that mistake so many times, though, that I've learned to catch the red "RO" at the bottom before I start editing...most of the time.
*Edit:* my theory was correct. '!' pipes the selected lines to the command following the '!'. ":[lines] ! [command]" is equivalent to "sed -n "[lines]p" file | [command]".
For some reason, it appears that 'w' acts like '%' when piping.
:1,5!tee test2 (prints lines 1-5 to "test2")
:1,5!xxd > test3 (prints a hex dump of lines 1-5 to "test3")
I then tried it with a root owned file:
$ su
# cat test > test2
# ^D
$ vi test2
:w [RO error]
:%!sudo tee test2 (saved successfully)
And it saved it it over the same file successfully. I think using "%" makes more sense, and it's strange that :w works at all.
With this understanding, I've devised that an alternate way to do it is ":%!sudo cat>%", which selects all lines (the first %), and prints it into the same file (the second %) using I/O redirection (>).
*Edit 2:* I just made the mistake now, and noticed that sudo cat doesn't work, oddly enough. ':%!sudo tee %' did work, though. So that brings up another question: aside from allowing you to split output between stdout and a file, what is the technical difference between 'tee' and '>' such that it means the difference between saving a file and being slapped with a permission denied error?
Braden Best fwiw here's a stack overflow question about it stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work
david
Ah, I figured it out. tee is being run as sudo, but '>' is not, since it just uses the underlying shell to send 'sudo cat's output to a file. Thus, if I make the shell a root shell, and do it, then it should work
:%!sudo sh -c "cat>%"
And guess what, it works! And now that I understand what's going on under the hood, I won't be forgetting ':w!sudo tee %' any time soon
Braden Best
Eric Khanni Can someone explain what these empty replies are about? They're starting to piss me off.
23:40 there are more keybindings to go to insert mode than just 'a'.
'a' goes to the next character
's' removes the next character
'o' creates an empty line below the current and goes down to it
'i' goes directly into insert mode without other actions.
this tutorials are freaking awesome. Though no point in changing the ownership if your throwing sudo before every command
im sorry, but though file associations are a little weird in linux, you can still have a filetype that will be associated with a program. either that or double clicking a png is black magic.
regardless of OS is a bit off. because if you use a different file system it may not.
for insert mode in VIM, try to use i instead of a. Easier to remember :D
the section on permissions is confusing. If you're using sudo to edit, then you're doing everything as root, so what was the point of the whole chown thing.
Thank you for your clear introduction on vim. I really liked your class.
There is a CLI called "file" to check file types.
Eg. "file x.pdf"
x.pdf: PDF document, version 1.4
if you want to learn vim there are three steps:
1. use vimtutor. that means type 'vimtutor' into the shell. do the whole thing. it takes an hour.
2. try and use vim to do literally everything for the next two weeks. Some exceptions to this rule are programming huge apps that require an IDE for code completion (like Android apps, large web apps maybe). Besides that use vim. Every time you don't know how to do something (or forget), google it.
3. slowly start customizing vim to do what you want. youtube and google are great places to learn how this works.
Vim makes a lot of sense. You WILL learn to use BY USING IT and googling how to do things as the need arises. If you stick with it for two weeks you'll see you're gonna love it. Slowly you'll learn about plugins, commands, scripting... that'll take a few months. You'll enjoy vim and start being good at it after like 2 weeks of consistent use though.
If you're not a programmer or natural tinkerer, don't use vim.
2:32 That's simply not true. Sure, text files typically don't have any extension. But documents and images of course do, e.g. docx and png. If an image doesn't have an extension, how is Linux supposed to know how to open it? It even warns you when you rename the file and remove the extension when using nautilus.
Thank you Eli, this is awesome. Thank you for sharing your knowledge
16:25 - I love it. I don't think there is a more succinct way to describe the linux system.
Great teacher! Thank you very much for these lessons man!
I use vim also, and I really don't want to change at all.
What is your opinion about emacs? Will you ever make a video about it?
Instead of :/ to search you could simply type /
also instead of :/? for backward searches you culd simply type ?
THANKS Eli.. it is very useful for beginner...
I can run vim in Ubuntu 18.04 by typing 'vi' with or without sudo but typing "vim" is an error
thanks sir.You help many professional by sharing these videos.................. thanks a lot......
your explanations are very clear, thank you mate
you're videos always are great thanks eli
Can you please also explain upload. How to copy-paste? How to jump to a particular line or the end line?
11:48 "..there are no file associations.." Would not some of the files that we would be editing as administrators have file extensions for the programs to know what to do with them as well? So, it is a rule not to have them or just this file that you are making in this tutorial... Of course I have not watched passed this point at this time.
Thank you so much for the videos so far! Learning lots!
***** There are no file extensions in linux. Programs in linux does not care if a file ends in .png or .ini or whatever, the information about how the file is used is stored in the header of the file content itself. Some people still but .png or .ini or whatever just to remind them as users what the file is for.
DailyLGS There's also the fact that bash and a few other shells use file extensions to aid tab completion. For example, 'feh abc' will only autocomplete if I have a file named e.g. "abdcef.png". If it's "abcdef.conf", bash will ignore it. Personally, I find this to be more annoying than helpful. I shouldn't have to insert ';ls ' to make bash ignore the file extensions and quickly grab the filename. I shouldn't have to 'ls' before typing the command so I can select+paste the file with my mouse. I should be able to just press tab and have the bloody file auto-complete, regardless of the file extension, out of the box.
That being said, he doesn't suck, he just addresses a very basic audience. Sometimes, I feel, he is addressing an audience too basic for the task his pen testing stuff, if you're having to explain how to use virtualbox, I'm not sure the audience is ready.)
if you don't know WHY the editor isn't allowing you to save your file (permissions issue), do "ls -l" on the parent directory and see what the permissions of the file is, definitely don't just go chowing files with sudo....
Is there a way to remotely access files on GUI-less Linux boxes so I can edit files using a GUI editor? I've always hated vi and vim.
Download the files from your remote machine, and then edit them locally? You can't run an editor with a GUI on a system that doesn't have a GUI installed.
EvilPopsicleDog You can. If you are running linux (or really any system with an X server - i think there are even solutions for windows to do this) and you ssh into the box, if you ssh with the option -X, you can open gui programs from that command line (e.g. gedit to edit a file) and the gui will be rendered locally on your side.
You may install wine on your Linux system. Use Notepad++ with NPPFTP Plugin to edit remote files using ssh/sftp and ftp... :)
Do not complicate yourself with ftp and transfering files back and fort, just use nano.
True but as he said right at the beginning: you won't know what the ownership is until after you've done any edits and want to save the file. It's better to just get used to writing "sudo vim" than "vim" and realising after a massive edit "oh I don't have permission"
You don't NEED to do it but it's erring on the side of caution
Vim has a very nice tool called vimtutor that teaches the basics of vim very well.
I can't believe 10 minutes have passed and you didn't say anything about vim...
Just got to the a = insert mode. Sorry but i = insert mode, a allows you to append which also puts you into insert mode. But there is a difference.
Just a few things, sudo is dangerous to use if you don't know what are you doing. The other thing is there is file assossiation in linux, but not to the extension of the file (the .txt thing on the end of the file) linux assossiates files based on the content of the file, this is done because is easy to "trick" the system if you name a file by a different extension. In the case of text editor you can open every file in your system, even binary files but you won't be able to understand it
I've been having an overheating problem with my Ubuntu...i.e. the computer shuts down when it hits it's critical trip point of 106 degrees. I've changed the permissions and ownership of the files correctly but I am still unable to modify or delete the thermal zone trip point files...Any suggestions? And no, I am not concerned about burning out my cpu.
Thanks or these videos.
Please if you have any companion book you can recommend I'll really appreciate it
Great tutorials Eli! Thank you very much!
I LOVE YOU ELI.... BEST TEACHER EVER!
Just great...Well done Elite.
I installed the Ubuntu Linux server and it is not recognizing the vim cmd.
Install vi sudo apt-get install vim
I agree, Eli. I was taught on Vim & still use it primarily. I was shown Nano & it IS cool BUT I am very happy with Vim so why learn Nano, IMO?
But... I have been explained the importance of learning Emacs along with Vim because some more high end administration is easier using a combination of the 2, so how about making us lazy folks an Emacs tutorial?
Again, thanks for the awesome vids. I can only read so much in a day and these tutorials really help!
BTW, I keep reading Elite Computer Guy :-D
Also the "file" command will tell you what type of file a certain file is.
Well there is kinda file associations, usually on the readline under /etc/bash_completion
Thank you sir. Great stuff
You can run/read/write any file if you have permissions to do it, it is not associated with any distribution, at this level it just kernel. in your home, most of the cases, you have full access to the entire tree, in configuration files you can't of course, so you'll need to use any user who can.
for example, /etc/sudoers, this is a non-editable file, unless you change it's permissions, same for /etc/fstab and so on...
permissions, one key why Linux won't run virus.
Use sudo or su sparingly. Use it based on the file ownership.
I'm using Vim in Bash in Ubuntu, with the Windows Update. I cannot find the text files I save anywhere.
The only way I can access them is through Vim with the :
Also, my username doesn't seem to show in the User file under C: It's just Users/"Users", where "Users" would be my username. I already set my username in Ubuntu Bash. I am a little confused because this website shows how to do it, however I am not seeing the same things.
www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/
Thanks for sharing. Let us know if you have any questions.
vim is not user-friendly and takes getting used to but is worth learning because every Linux distro/Solaris/AIX/Unix etc will have vim on it.
and also more correct. the a stands for append not for insert.
i mustve missed how do you get into the linux server??
can you please make a redhat server video for server administration ?
Good basic introduction to vim.
BUT: Please don't chown files willy-nilly.
Basically the user lives in his home folder. Instances above are root owned on pupose. That prevents Joe-Blow from messing up the system by editing a crucial config-file.
Just saying.
Can anyone suggest a Good website for videos on Redhat specific training
Hello! are you able to copy and paste using vim, if yes, how? thanks.....
+Jose Paulino Romero CTRL + shift + C or V
instead of running "vim", run "vimtutor". this will start a tutorial for people who are new to vim
+Billy McCaffery thank you
+JHuff276 thank you
How can I copy a particular line in command mode and paste it in vim for a permanent mounting purpose
Best teacher Eli!
8:24 you tell us to change the ownership of the config files. can't we just do:
su root
enter password
and then edit the file the normal way?
thank you Eli - always very good videos!
@theyasin133 You first have to install vim by doing sudo apt-get install vim and then you can create the newfile.
sudo has a configuration file which controls which users are able to run which programs via sudo. The only reason he was able to change users in his examples was he had full sudo access.
Thank you mate you are great teacher.
Sorry, but he's right on this one, I just tried and the [:/?] command returned an error saying it didn't recognize the command.
How to check who is the current owner of some file ?
have you considered placing this content on khan academy?
I put sudo vim in the terminal and it said, "You are not in the sudoers file. This incident will be reported."
Lots of great examples of what NOT to do as a sysadmin.
I understand that you type ":wq" instead of ":x" because it's easier for new people to remember. But don't you think that it would be easier to teach them that going to insert mode can be accomplished by hiting 'i'? In this video it would be also good if you would show them what's going to happen when they edit some config file (without sudo) and they would like to save. It would be easier than this part about chown. Anyway great job, you videos are really valuable!
PS: not ROOT just root :)
Use the "file" command to have Linux tell you what kind of file you have. For example:
% file /etc/passwd
/etc/passwd: ASCII text
I appreciate your instructions, but this one has several little errors. I do not like to dicuss the mentioned problem to change the ownership of files, but something on searching / moving in files:
- It will not work, if you use ":/ tofind" with that space, because it searchs for " tofind", a string beginning with a space.
- To search up to the beginning of the file you have to write ":?tofind", without the beginning slash "/".
- At least for searching you need not to go to the complex mode by pressing ":". It's enough to press "/" oder "?" in the command mode.
That's how it works on my system a 64-Bit-PC currently used under Linux Mint 18.
Again, I appreciate your videos. (But because English is not my native language, I've problems spelling appreciate, it was the hardest part in writing this comment. Some day I will get it, I hope.) :-)
I have ubuntu desktop... I think I may start working in the terminal more.
Vim, cat or nano? Which is better?
:x
Cat isn't an editor. Nano is really basic and easy to understand: www.howtogeek.com/howto/42980/
Vim is a "real" editor, but it has a steeper learning curve.
The best one is the one with YOU can get the work done. nano is simple to use, vim has the command mode which one your learn it will let you reduce the time it takes you to get some tasks done.
So in short, if you need to edit a lot, I would recommend you to learn vim.