Тёмный

JC's Favorite BASH Commands 

Joe Collins
Подписаться 128 тыс.
Просмотров 26 тыс.
50% 1

We chill and look at some cool commands for the BASH terminal and scripts.
Link to the list of commands: www.ezeelinux.com/news/jcs-fa...
Check out www.ezeelinux.com for more about Linux.

Хобби

Опубликовано:

 

1 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 61   
@richardpayne
@richardpayne 5 лет назад
The reason the cat command writes stuff after you press ctrl+c is that you're using pipes. Pipes route data from one program to the next in a line by line fashion. When you pressed enter, you started a new line and the line you just finished was passed down the pipe and written to the file. The Ctrl+C just cancels the operation with submitting any more data. Ctrl+D finishes input and also sends the text on the current line down the pipe. This is also why you can't return to the previous line to edit it. The data has already been sent. You can also see this by piping a file. For example, test.txt contains: This is a test Line 2 Line 3 Running the following command gives: $ cat test.txt | xargs -I{} echo "{} EOL" >test2.txt $ cat test2.txt This is a test EOL Line 2 EOL Line 3 EOL The echo command appended EOL to each line as it passed through rather than just doing it once at the end of the file content.
@fernabianer1898
@fernabianer1898 5 лет назад
Richard Payne thats my new favorite comment
@BrucesWorldofStuff
@BrucesWorldofStuff 5 лет назад
Great video Joe! Never get tired of these, I always get something new and I use them as references when I want to do something... Thanks Joe!
@samiordning9708
@samiordning9708 5 лет назад
Once again, thanks for a great video. Got some good tips how to do things in terminal. Keep up the good work and be well.
@kiwifren4254
@kiwifren4254 5 лет назад
Just watching your Bash basics (part 3) AMAZING!!!!
@petewest3122
@petewest3122 5 лет назад
Really informative. Thanks for all the top tips, Joe
@matthewhodge196
@matthewhodge196 5 лет назад
Really enjoy your videos. I appreciate your open-source mindset and your willingness to help others indulge into the wonderful world which is open-source. Wondering if you could explain to us in another video the differences between the various DE terminal variations. (MATE terminal vs. xfce terminal vs.Cinnamon terminal, etc.) I am still a fairly green in the linux world, so perhaps a video dedicated to this subject isn't necessary. Personally, I enjoy your explanations of specific situations in which a specific command would be useful. Great channel Joe! Always looking forward to new videos.
@alexherget
@alexherget 5 лет назад
Awesome vid! Thank you very much Joe for sharing this great info. Big thumbs up !!
@jackd6134
@jackd6134 5 лет назад
Very *useful* video and clear presentation!
@rudyseghers6320
@rudyseghers6320 5 лет назад
Tanks Joe, from the Netherlands.
@finndriver1063
@finndriver1063 5 лет назад
Nice video! pushd and popd are my new best friends. My personal favourite commands are: - jobs, fg, bg, disown - pgrep, pkill, ps - lsblk - script, scriptreplay - hunt, bcd, ppt, ul
@michelecarey9668
@michelecarey9668 4 года назад
Love your videos. Glad I subscribed.
@kellingc
@kellingc 5 лет назад
^S and ^Q is a hold over from the modem days. It's proc code is XOFF (^S) which tells the host to stop sending. XON (^Q) tells the host to rezume sending. With a full duplex modem connection, you type a character, the terminal sends it to the host, and the host sends a copy of the character back to confirm by displaying it on the screen or printing on the paper. Control characters didn't print, because they are commands to the host. ^G rang the terminal bell, ^L caused a vertical tab (or form feed), ^M cauused a carriage rrturn, and ^N casued a new line. There are others, but you get the idea. The point is the reason nothing typed when you pressed ^S, the host hsld sending the character to the screen until it was told to send ^Q. It then sent what was in the buffer to the screen. With the more and less commands, ^S and ^Q is really useless unless you accidently come across a binary file and use cat. You could use ^S to stop it and ^Q to resume where it left off.
@macinman
@macinman 5 лет назад
Some of these commands I was already familiar wit. The more programming oriented commands I found interesting. I was curious, if there are any BASIC packages for Linux, that's the main language I've had experience with. I have done some C, and I've used bash, though I'm experimenting with FISH right now. I'm going to be installing FreeBSD into a VM sometime in the future and going to do some testing and comparison between it and Linux to see which I like better, and what differences are, etc. Great video Joe, always enjoy watching :)
@VictoriaMan69
@VictoriaMan69 Год назад
Thanks for teaching me about wget!
@FinderX
@FinderX 5 лет назад
46:35 here, you can improve your script adding this option to DF -x devtmpfs From the MAN ; ) *-x, --exclude-type=TYPE* limit listing to file systems not of type TYPE This gonna rid those udev from the output.
@jlmg3543
@jlmg3543 3 года назад
Greetings and salutations! Thank you for the amazing video :-) edit: typo
@Khyree_Holmes
@Khyree_Holmes 5 лет назад
Linux shutdown commands are my favorite!
@MacsekU2B
@MacsekU2B Год назад
usually when I want to run a long time running program I start it in screen, then detach. In case I need status I oftentimes run watch to see du, df, ls, iotop, ps or whatever, mostly on another screen (ctrl-a c) If not using screen then &. That way no cat is intelligent enough to interfere with the long-running program
@MichaelMantion
@MichaelMantion 5 лет назад
1:30 If I knew what I was doing it wouldn't be called learning. In general I always try to learn when ever possible, so I rarely what I am doing before I do it.
@chrikrah
@chrikrah 5 лет назад
Will dpkg -l work on all Linux distros?
@EzeeLinux
@EzeeLinux 5 лет назад
No, It only works on Debian based distros. Debian, Ubuntu Linux Mint and so on... :)
@petewest3122
@petewest3122 5 лет назад
Off topic to the video - After running update manager in LM 19, I get an error list of a bunch of packages and files that have been configured in multiple destinations. 1. Is this anything to be concerned about. 2. Is there a simple solution to resolving all of the redundant packages? I'm aware that certain files - such as bashrc - are stored as backups and should therefore be left alone. Is there an easy way to cross-reference which files have purposeful backups, and which are truly redundant?
@EzeeLinux
@EzeeLinux 5 лет назад
I'm not sure what you talking about here... Run sudo apt update and then see what it says. Apt will usually suggest a command to fix/clear the issue.
@petewest3122
@petewest3122 5 лет назад
@@EzeeLinux Thanks for replying. I had a closer look, and somehow I ended up with a duplicate repository list in /etc/apt/. I deleted the one created most recently, re-ran update manager, and no more errors. Edit* I saved a copy before deleting, just in case.
@hielke2332
@hielke2332 5 лет назад
I think your Percy's patch can be improved to make it catch all the input and not only till the first line break. You can do this by setting the delimiter to an empty string. It also seems that the max characters can be left out. Like so: read -d '' -t 1
@EzeeLinux
@EzeeLinux 5 лет назад
For some reason, it does not do this when running in a script. At least it didn't when I tested it last. Thanks for the input, though. :)
@hielke2332
@hielke2332 5 лет назад
@@EzeeLinux That is odd. Not when I tested it. Another idea would be to use cat to catch the input. Like so: 𝚜𝚕𝚎𝚎𝚙 𝟽; 𝚌𝚊𝚝 > /𝚍𝚎𝚟/𝚗𝚞𝚕𝚕. But it won't automatically terminate when done. You have to provide Ctrl+D to stop it. Twice even for some reason. You also don't get any feedback when it is done. To get at least a hint that your script is done you can use for example Perl to print something when done. 𝚜𝚕𝚎𝚎𝚙 𝟽; 𝚙𝚎𝚛𝚕 '𝚠𝚑𝚒𝚕𝚎(){𝚙𝚛𝚒𝚗𝚝 "𝚍𝚘𝚗𝚎";}' But I wouldn't say this has now become a very elegant solution, but I guess a patch is often not very elegant.
@myszkaagresorka3506
@myszkaagresorka3506 5 лет назад
@@hielke2332 𝚌𝚊𝚝 > /𝚍𝚎𝚟/𝚗𝚞𝚕𝚕
@drhectoralmonte
@drhectoralmonte 5 лет назад
Great
@igorthelight
@igorthelight 5 лет назад
Also, cat is not unpredictable: * If you type and hit Enter - you actually added that to the file. You can even kill a Terminal Emulator. It's ALREADY commited. * Until you hit Enter it's not written. So Ctrl + D = Ctrl + C in this case. Also, if wget downloads slower than your normal download speed, that means that server doesn't "want" to give you a better speed. For that you need "axel" or "aria2". They use more that one connection to speed up downloading. Of course you have to install one of them first... if you HAVE TO use wget - you just can make it download in parallel mode: wget -r -np -N [url] & wget -r -np -N [url] & wget -r -np -N [url] & wget -r -np -N [url] Now you will donwload using 4 connections. But that trick will NOT help if you downloading just one file (as far as I know).
@EzeeLinux
@EzeeLinux 5 лет назад
It's unpredictable when compared to something like nano...
@igorthelight
@igorthelight 5 лет назад
@@EzeeLinux I agree.
@tomormiston6592
@tomormiston6592 5 лет назад
Also when buying a 'new' old machine, in the live install say $ inxi -F $ lsusb $ free -h $ speedtest-cli Maybe I'd cat foocomand >> system.txt them to a file too... 🤔
@KDGNOR
@KDGNOR 5 лет назад
"cd -" switch back to last place you are at.
@EzeeLinux
@EzeeLinux 5 лет назад
Still not the same thing: unix.stackexchange.com/questions/272965/pushd-popd-vs-cd-cd-in-bash-and-zsh
@marko11kram
@marko11kram 5 лет назад
i find that just using vi is simpler than using cat to edit a file
@Ilsh1964
@Ilsh1964 5 лет назад
". .profile" or ". .bashrc" is not equivalent to "source .profile" or "source .bashrc"?
@EzeeLinux
@EzeeLinux 5 лет назад
Yes, it is... I just didn't do it that way. :)
@jeanrodrigues6249
@jeanrodrigues6249 Год назад
Livro
@henrymach
@henrymach 5 лет назад
curl is better than wget
@EzeeLinux
@EzeeLinux 5 лет назад
nano is better than vi. :)
@henrymach
@henrymach 5 лет назад
It is indeed. But I got the joke
@igorthelight
@igorthelight 5 лет назад
> That's a "greater than" < That's a "less than" How to memorise them? > Points to the right - that's "greater" < Points to the left - that's "less" BUT the main question is: Is "cat" a real cat? :-) By the way - can you review a SteamOS? I know - there are some reviews on the RU-vid but they are kinda old. Maybe Valve did something cool with it? :-)
@EzeeLinux
@EzeeLinux 5 лет назад
Thanks for trying... It never takes, even after nearly 50 years.
@igorthelight
@igorthelight 5 лет назад
@@EzeeLinux :-)
@free-john_2008
@free-john_2008 5 лет назад
@@EzeeLinux As a former 1st grade teacher, think of it as a mouth. It always opens to eat the bigger one.
@EzeeLinux
@EzeeLinux 5 лет назад
@@free-john_2008 LOL.. Yep. I still forget. Thanks, Mr. President! :)
@richardpayne
@richardpayne 5 лет назад
@@EzeeLinux Big end is greater than small end. Ie 5 > 4 and 4 < 5 are both 5 greater than 4, or conversely 4 less than 5. Big end points at the thing that should be greater than.
@amrodiab3143
@amrodiab3143 4 года назад
"The root account does not exist in Ubuntu"......errrrrr, what? Factually incorrect Also, it's not asking for your password, it's asking for root's password. That whole section has several fallacies.
@EzeeLinux
@EzeeLinux 4 года назад
The root account is locked and therefore for all intents and purposes does not exist... Those with sudo privileges act as root but are not logged in as root. Any cleaerer for you?
@amrodiab3143
@amrodiab3143 4 года назад
Agreed that it is locked, but you mentioned specifically at least twice that it doesn't exist - that is very different to it being locked. There are many other accounts created by detfault which are also locked in various ways - but by saying it doesn't exist so forcefully can lead to it being taken literally by some especially when targetting a beginner audience who have just been introduced to that user.
@EzeeLinux
@EzeeLinux 4 года назад
@@amrodiab3143 I've been doing this a long time... I sad the account is locked and then said in effect it does not exist. You have to be forceful and generalize to get the point across. Anybody who would dig in a bit deeper would eventually understand what you're talking about. That's all that matters...
@hanes2
@hanes2 5 лет назад
dud, you wanna join the ZSH creww :P
@EzeeLinux
@EzeeLinux 5 лет назад
No, I'm good with BASH. I use it and teach it because it's what everybody gets to start with. :)
@igorthelight
@igorthelight 5 лет назад
Be gone occultist! ;-)
Далее
Linux Tip | How to Customize Your BASH Environment
35:31
Linux Terminal Basics 2 | Working with Files
43:34
Просмотров 15 тыс.
Ne jamais regarder une fille à la plage 😂
00:10
Просмотров 837 тыс.
A Beginner's Introduction to BASH Shell Scripting
44:24
Linux Tip | 10 Useful Linux Commands
34:35
Просмотров 662 тыс.
Beginner's Guide to the Bash Terminal
1:14:37
Просмотров 2,3 млн
Top 5 Mistakes New Linux Users Make
41:02
Просмотров 669 тыс.
Shell Scripting Tutorial
59:12
Просмотров 904 тыс.
Ваш дом мешает 🗿
0:47
Просмотров 3,1 млн