No video

HakTip - Bash Basics: Turn Long Commands into Scripts

  Рет қаралды 44,517

Hak5

Hak5

13 жыл бұрын

Hak5 -- Cyber Security Education, Inspiration, News & Community since 2005:
____________________________________________
In this Bash basics HakTip, we're turning exhaustively long commands into shell scripts with minimal effort.
____________________________________________
Founded in 2005, Hak5's mission is to advance the InfoSec industry. We do this through our award winning educational podcasts, leading pentest gear, and inclusive community - where all hackers belong.

Пікірлер: 39
@storytimecentral3894
@storytimecentral3894 7 жыл бұрын
forget the haters I'm just starting out and this is good information well presented, thank you very much indeed.... subbed!
@vapornate
@vapornate 6 жыл бұрын
Back when Netflix sponsored Hak5, those were the days.
@TaiiwoLlort
@TaiiwoLlort 13 жыл бұрын
i once made a batch script in windows that boots up a tethered apple device in DFU mode. i was pretty happy with myself :D this rule generally applies to bash scripts: if you don't know how to do it yourself, you wont be able to tell your computer how to do it by itself.
@ross817
@ross817 13 жыл бұрын
Wouldn't bash be /bin/bash? /bin/sh is a different interpreter, I think.
@buumi3
@buumi3 13 жыл бұрын
ty for the ctrl-x ctrl-e never knew this: btw: you can change the default edit doing this update-alternatives --config editor
@ABitOfZero
@ABitOfZero 13 жыл бұрын
Just a little history on the name: BASH was called so because it was what replaced it's previous UNIX shell, the "Bourne Shell" which was created by Stephen Bourne, the Bourne Again Shell was then named such by Brian Fox as a tribute to the predecessor.
@andjack
@andjack 13 жыл бұрын
Why not use Emacs, which have many short commands in common with Bash. Usefull command: M-x shell C-x C-f (C-x extended command C-f fined file) C-x C-s (C-w save file) C-x C-c (C-c quit) C-x b C-x C-b (b buffer C-b list buffers) C-a C-e C-k C-w C-y (C-a first C-e end C-k kill line C-w cut C-y past) Tab to expand filename M-/ find next occurance of string just typed. There are much more. The commands have logical names. And you can make commands "stronger" with C- and M-
@1197vijay
@1197vijay 7 жыл бұрын
It is very help full to me.. thank u very much
@Lolliloll1285
@Lolliloll1285 13 жыл бұрын
You should do a tutorial on intelligent scripts, with if, then and else. I love them, because they make scripts safer to do, as they can depend on conditions to run. (Like, if you're not root, it won't even run.) And of course, variables. Variables are the most important thing with making scripts. It's what makes us as lazy as we are.
@BenAshton24
@BenAshton24 13 жыл бұрын
@bobicool You could also use command line arguments, like so: ping $1 | while [...] and then run it with "./pingdate 8.8.8.8" or whatever ip you wanted
@SecurityTalent
@SecurityTalent 2 жыл бұрын
Great
@andjack
@andjack 13 жыл бұрын
@Coolmax71 As i wrote, it's easier to remember commands in Emacs than in vim. AND the key bindings in Bash is the same as in Emacs :)
@maximumrfan
@maximumrfan 13 жыл бұрын
@tylerzacc If you don't mind me asking, could you post it somewhere? It sounds very interesting.
@andjack
@andjack 13 жыл бұрын
@buumi3 to use update-alternatives only work in Debian (and distributions created from Debian). It also set default editor for ALL users on your machine. With my sollution, you only change for this user. Better to use environment variables instead. They only change for you. export EDITOR="value" makes all commands started from this shell have "value" as value of EDITOR. unset EDITOR removes variable EDITOR from this shell and all commands started from this shell.
@andjack
@andjack 13 жыл бұрын
@buumi3 Better to use environment variablers. Bash (and other) first check VISUAL., and uses the value as the command. If no VISUAL, check EDITOR and use that if exists. If not, start default editor. So, start an Emacs in background (with "emacs &") and type M-x server-start (or start from ~/.emacs, se man) Set EDITOR="emacsclient -t" and/or set VISUAL="emacsclien -c" Go on and now try C-x C-e in Bash. Exit emacs with C-x # Now editing with emacs is fast.
@buumi3
@buumi3 13 жыл бұрын
@andjack thanks for the info :-)
@MarianoBillinghurst
@MarianoBillinghurst 6 жыл бұрын
What happened to the wireless Series?????
@cdbcbd4930
@cdbcbd4930 4 жыл бұрын
it didn't work? im going to through it into a curl -P | xargs.
@candlehawk
@candlehawk 13 жыл бұрын
BASH is Bourne Again SHell.
@jarisipilainen3875
@jarisipilainen3875 7 жыл бұрын
I have never seen darren teach us gcc :)))
@fission1110
@fission1110 13 жыл бұрын
@blake9753 Nope. It will write whatever you type into the variable $randomvar
@nathanstott1909
@nathanstott1909 6 жыл бұрын
The shebang should be /bin/bash not ksh
@NoctuTech
@NoctuTech 13 жыл бұрын
Darren needs to send me a hak5 skin for my netbook!!!!!!!!!
@Coolmax71
@Coolmax71 13 жыл бұрын
nano? vim ftw! (;
@JaqenHghar.
@JaqenHghar. 10 жыл бұрын
I know this is really old but I'm just learning about this stuff and these episodes have helped a lot but why am I getting my permission denied when I try to save the file?
@xTheRebellion
@xTheRebellion 9 жыл бұрын
Jaqen H'ghar Late reply, so hopefully you found your answer.. but you cannot save a file which you do not have write permissions to.. so either use "chmod" as super user to give you those permissions -> chmod u+w file.txt and then you will be able to save, or sudo nano file.txt and you will be able to save ( try not to use sudo unless necessary)
@Mammongorothkar
@Mammongorothkar 9 жыл бұрын
+Jaqen H'ghar He tells you how to change file permissions..... chmod+x "filename"
@MrMinecraftviking
@MrMinecraftviking 8 жыл бұрын
+Jaqen H'ghar Because you are saving in a dir owned by another user. (likely root)
@AmarKashyap1995
@AmarKashyap1995 13 жыл бұрын
hey! Loving the new series... i wanted to install crunchbang linux on a VERY old netbook of mine but it doesnt have a cd drive. when i tried to install it from usb i get an error saying it cant find the cd! help!!!!
@randallrulo2109
@randallrulo2109 2 жыл бұрын
go into your bios and change your boot order...
@FeelItRising
@FeelItRising 13 жыл бұрын
so muxh linux!!! sponsored by Netflix?
@SynxS
@SynxS 13 жыл бұрын
@afonso360 use a VPN service
@Emorejets
@Emorejets 13 жыл бұрын
WPA hacking?
@fission1110
@fission1110 13 жыл бұрын
@blake9753 a blake. Yep, just type "read randomvar" this will allow the user to input information, and then save it into the variable "$randomvar"
@FanColdRikkie
@FanColdRikkie 13 жыл бұрын
:D
@afonso360
@afonso360 13 жыл бұрын
i woud like netflix but im in europe
@beardymonger
@beardymonger 13 жыл бұрын
8.8.8.8 = One of Google's DNS servers. Don't use if you don't want to be tracked by Google. Just kidding....
@Rufeo0
@Rufeo0 13 жыл бұрын
should have mentioned how to use variables, pretty pointless without variables
@metal571
@metal571 11 жыл бұрын
Bourne again shell. Misspellings make me angry more than your lack of including all the other linux shells.
Советы на всё лето 4 @postworkllc
00:23
История одного вокалиста
Рет қаралды 5 МЛН
Comfortable 🤣 #comedy #funny
00:34
Micky Makeover
Рет қаралды 16 МЛН
Terminal vs. Bash vs. Command line vs. Prompt
11:06
Luke Smith
Рет қаралды 234 М.
Linux Command-Line Tips & Tricks: Over 15 Examples!
31:37
Learn Linux TV
Рет қаралды 215 М.
HakTip - Bash History Tricks
5:01
Hak5
Рет қаралды 13 М.
HakTip - Packet Sniffing 101: Promiscuous Mode
6:53
Hak5
Рет қаралды 115 М.
Bash for Bug Bounty & Ethical Hacking | Basic Course
40:33
Ryan John
Рет қаралды 13 М.
Command Line Tricks That Make Me the Coolest Guy in the Office
11:36
Mental Outlaw
Рет қаралды 103 М.
What Kinds of Files Can Be Viruses?
14:08
ThioJoe
Рет қаралды 251 М.
Detect Hackers & Malware on your Computer (literally for free)
16:38
Советы на всё лето 4 @postworkllc
00:23
История одного вокалиста
Рет қаралды 5 МЛН