I think the move of Kali Linux from bash to zsh is sane. I sometimes have to use the default shell of Linux distribution, especially on servers, and my main pain points with bash are:
- The history is editable by default. If I move to a previous history line and change it, the old line disappears. Hitting Ctrl-c will remove it from the history.
- If I use simultaneous shells (screen, tmux, or several ssh connections), the history saved will be the one of the last shell to quit. The bash config `histappend` should be the default, IMO.
- Most of the time, I search the history by the beginning of the command I just typed, which zsh maps to alt-p and which bash does not map by default. I rarely use the ctrl-r search.
- No way to pause a command and view the man. With zsh, `git clone<alt-h>` will display `man git-clone`, then return to the incomplete command line.
- No way to set a command aside. E.g. if I realise while typing that I'm not in the right directory, `git clone<alt-q>cd src<return>`.
> - The history is editable by default. If I move to a previous history line and change it, the old line disappears.
Press M-r to revert back to the original command.
> - No way to set a command aside. E.g. if I realise while typing that I'm not in the right directory, `git clone<alt-q>cd src<return>`.
Press M-# to comment out the current command and go to a new prompt, then up to get the commented command back, and M-3 M-# to uncomment it and run it (any number works, but 3 is the same key as #).
I don't think bash really fits the type of program to have interactive tutorials. If you are serious about your command-line-fu its worth giving the manual a good read.
My favorite by far is '\e.' or 'M-.' which inserts the last arg from your previous command. Discovering this led me down the bash rabbit-hole of finding new commands, creating my own and really enjoying the bash shell. Did you know you can execute arbitrary code as one of these commands? I had one that ran 'docker ps' so I could list my containers in the middle of typing a command.
> E.g. if I realise while typing that I'm not in the right directory, `git clone<alt-q>cd src<return>`.
With bash I’d just Ctrl+a and type “cd src ;” and then press ctrl+e and continue typing what I was typing.
I got so used to doing it that way, that even after switching to zsh I still do it this way.
The disadvantage of my way of doing it is if you typo the path. But I tab complete pretty much always, so in practice I don’t have the problem of typoing directory names without noticing.
I probably should learn those zsh ways of doing things. Will try to remember to do it the zsh way next time I need to do something like the things you mentioned.
This may be an old fashioned way to do it, but I set aside a command by using ^A (or Home) and the entering : and space:
$ : Command that has an error
I can then cd to the right directory, or fix whatever other problem I had, then use up-arrow to get back to the command, remove the : and space and run it.
The : (no op) command is fairly obscure and some of the other suggestions here are probably better.
I tried using ZSH. My first experience was using a bunch of plugins like zsh spaceship and having the shell slow to a complete halt.
I then used "stock zsh" and running commands was fine except some autocompletes like git-autocomplete were terribly slow and, for example, did not support `git switch`. This broke my workflow and it was easier to just go back to bash than to figure out how zsh works. I found that autocomplete in zsh is a lot more opaque than in bash. I'm sure there are ways to fix it. My way was to switch to bash.
Actually, maybe it's more the fact that at a prominent tech company:
* zsh is the default shell on a large proportion of servers that have read-only /home, so you can't easily change to your preferred shell
* a training guide that many new developers follows states incorrectly that:
> If you are using Bash and you have the option of using ZSH, you should switch to it. ZSH has additional auto-complete and history features that Bash doesn’t have (but don't worry - those features will not be relevant to this tutorial.)
oh-my-zsh seems to be recommended by a lot of developers in this company, even though:
* the default mechanism to install is curl|sh (there is no Homebrew package) on developer machines which have privileged access to a lot of resources
* installing it via its recommended installation procedure on dev machines would violate company policies, whereas installing bash-completion wouldn't
Pause command - I usually hit home, insert a # then enter then man then get the command back and continue. Or tmux it. Didn't realise zsh had that shortcut.
I usually append \, hit enter, then ctrl-c. Run the new command, then up arrow, backspace, enter. You can get closer to the zsh workflow with ctrl-z instead, but that doesn't work if the new command is cd.
Do you actually use zsh? C-o and M-q and M-a and M-h and all the others are really nice, and as far as I know bash has nothing similar (correct me if I'm wrong). You don't NEED any of these niceties but they're very nice.
I always thought Kali wasn't really for daily use. Not a vehicle for every day driving around town, more like a secondary vehicle you only use for work. HiDPI, tool icons, and gnome themes make it seem otherwise. Sure, these things are nice whether you're using it for work or play, but I wonder. Is anybody running kali as their daily driver?
You definitely shouldn't use it as a daily. However, Offensive Security is trying to make it a smooth experience given that quite a bit of time is spent using it for penetration tests, CTFs, etc in addition to "competition" from ParrotOS. Most folks that I know would switch to it anyway so having it be the default makes it easier.
Can you elaborate why someone shouldn't use it as a daily driver?
I have used Linux for a decade now and I just got a friend interested in it and his pick was Kali because he was interested in learning about security stuff.
I took a quick look at it and saw that it was debian based and XFCE is my favourite desktop environment so I figured he'd be alright with it.
It used to be that Kali would start a ton of services at boot and open those ports up to the LAN interface. Stuff like Postgresql that you probably don't want to expose any wider than localhost.
It also defaulted to running as a root user for everything, but they recently changed that.
Hmm I don't remember that ever being true. Items like Postgress would listen on localhost only. No services outside of DHCP were even enabled by default going all the way back to BackTrack.
This is not recommended. It's a specific tool for a specific purpose. I seem to recall a while back that it even had some default security options disabled on the system to allow for all the crazy stuff it does. It's not meant to be a replacement for a Linux Mint or Ubuntu desktop system.
Run it on a second laptop, on a USB stick, or in a virtual machine (that you cede access to the networking hardware).
The stackexchange sites get questions like "hey, I am using Kali because all the cool hackers use it, but my Wifi hardware doesn't work, and I cannot install my favorite browsers, what should I do?" from absolute newbies about every week or so.
Update for being one of the few non-zsh questions.
IMO there are the young script kiddie types that have it on their main laptop to be cool, but yeah I don't see people using it except for work purposes.
I can’t find the article and relevant study right now, but people actually perform better when they are using aesthetically pleasing gear. That would include software.
People who don't use Kali comment on whether move from one shell to another was right for the Kali users. This drive by commenting is sadly omnipresent in the open source world. OpenBSD uses CVS? They should use git. XServer? Why not Wayland? Oh, libsdl is using Mercurial, but they should totally use git. And on, and on.
umm as a pen tester the move from bash to zsh was the most exciting thing about this update. w ^ to find the wfuzz command I did 2 days ago and didn't take notes on the output is useful as hell.
I have to say this is the most disappointed I've been with a comment section in a while. Not that the comments are awful or in bad faith, it's just not got any of the topics I was hoping to read about.
> Q.) Why did you make the switch? What’s wrong with bash? A.) You can do a lot of advanced things with bash, and customize it to do even more, but ZSH allows you to do even more. This was one really large selling point.
AFAICT this is the entire motivation provided. Since they start with stating that it's a very large change, It would be useful to flesh out the motivation a bit. For instance, some concrete examples of those "even more" things that you can do with zsh but not with bash would go a long way.
I usually hate magic too, but I have to say this is one of the cases where I like it.
It's convenient without any danger attached to it since you're just switching directory and not actually executing something against this "unknown" path.
Opt-in bash extensions can do basically whatever people complain bash can't do. Though to be honest I don't use it that much over the last, say, 5 years. If I know a deep directory tree that well, I can just type it explicitly and/or tab complete it without losing much time. If I don't know it that well, FZF is quite nice.
* https://overthewire.org Similar to HTS, but you don't need an account. The subject matter covered is also slightly different.
* https://0x00sec.org/ A forum dedicated to security. There's a lot of script kiddies, but also some gold.
* https://www.hackerone.com/ What better way to learn then practice on live targets? That being said, I would do some of the others first.
...
I do a lot of learning through reading, so books:
* Network Security Assessment by Chris McNab. I have second edition, which is a good and instructive read, but quite outdated.
* Real-World Bug Hunting by Peter Yaworski. Web security 101. Good read, and fairly useful.
* Advanced Penetration Testing by Wil Allsop. Outdated, but interesting. You will never use flash again after reading this.
* Social Engineering, The Science of Human Hacking by Christopher Hadnagy. This is a very interesting read. Also, one of the few that can't go out of date.
...
This should be enough to get you started. There's a couple more books I can think of, but they tend to be more specialized into certain fields of security and less approachable/generally applicable. If you want these recommendations as well, feel free to email me, my email's in my bio.
I did the OSCP (the course was called Pentesting with Kali Linux [PWK]) back in 2017. Costly, but the resources were top notch. A pdf with several hundred pages covering everything from basic Linux commands to modifying existing exploit code to suit your use case. Metasploit was included but the course was not Metasploit heavy. Writing your own remote exploit backend forces you to really understand the mechanics so it felt a bit old school in a good way.
Bundled with this I also got several (i.e many) hours of recorded and narrated video to accompany the pdf.
The best part though is the lab network. During the course I had access to a huge number of virtual machines to scan and exploit. The courseware really encourages you to experiment and evolve. The exam, if you want to try it, is an all out practical pentest from start to finish and 24h to complete. A comprehensive report covering the entire pentest is mandatory.
All in all the OSCP was totally worth the $ IMHO.
I do however recommend that total beginners should start with the free resources and other great sites like overthewire. Get your feet REALLY wet before you pay the $ and lab days start ticking.
That's a funky prompt they're showing there. Since it came by default on macOS, I'm using zsh. But to be honest, my Linux box still remains on bash. The differences, to my usage, are minimal.
Fun fact: That's a legacy openstep thing. I was using an x86 version of openstep in a VM just for fun a few months back and it had a 1994 copy of zsh on it. I also remember using it on OS X server 1.0 in around 1999.
I have an actual nextstation in my parents garage. I wonder if it's on that...
OS X used tcsh as the default shell way back. Later it used bash 3.x as the default up until Catalina. As of Catalina zsh is the default for new users (and the version of zsh that ships with macOS is relatively up to date).
Alright. I never claimed it was the default shell... That was obviously csh, everyone knows that. It's a bsdism. FreeBSD's default was tcsh essentially until I stopped using it maybe 15 years ago.
Zsh was placed onto the hard drive of the computer by the operating system installation cd and was an available executable program that could be invoked from the terminal.
Having watched a bunch of videos of people who bought NeXT computers recently, I can confirm that the shell they saw when running Terminal.app was csh. It would be a hell of a coincindence if all of them had happened to change from the default to csh.
It was an old bash 2.x which was still GPLv2. Zsh being MIT licensed posed no licensing issues for inclusion into MacOS. I switched to zsh on Snow Leopard and above and never looked back. Didn't use the fancy stuff much and still use bash on Linux.
No there's no confusion. Maybe you thought I meant it was the default shell, I didn't. It's simply installed with everything else. The list is sh, csh, and zsh.
The executable is on the machine. An operating system can have more than a single shell executable. Do you want me to post the binary? Screen shots? Maybe turn on an ssh hole? Perhaps send the man page? I can do all of this.
You can log in remotely and run it if you so desire.
I might be able to coerce VNC even although I'd probably need up port it to openstep (I've ported vnc before). Maybe there's a virtual box way of doing it as well
Nobody is accusing you of anything. I understood that the phrase "Fun fact: That's a legacy openstep thing" referred to the previous comment indicating that (at some point in time) MacOS defaulted to zsh. It was just a misunderstanding.
That's not what I meant. I meant it shipped with zsh, which was really unusual. Here's a screenshot I just took (http://9ol.es/ostep.png) ... I've installed bash on there. It didn't ship with bash.
Still my OS of choice for my first-ever generation Samsung Chromebook (exynos). Unfortunately, they stopped providing images - does anyone know if the build scripts still work for exynos based chromebook? (Or if other distros do?)
Less hassle. Plus if you are part of the community you get a better view on what tools are getting more prominent and what fixes or updates are being released.
I'm sure nobody who uses Kali needs it to exist, but that doesn't mean it doesn't add value.
It is meant to be run in a VM. Spin it up, log in as root, and go to work. It keeps your pentest machine separate from your daily driver - which you want to do for a myriad of reasons, not least of which is keeping your personal computer off a network that is actively being attacked.
The only real (non-cosmetic) feature missing in bash that zsh has is process substitution using files. In bash you can use <() to capture the output of a pipeline into a filename, but it is implemented as a non-seekable pipe. In zsh, you have that, but you also have =() that gives you a real, temporary file. It is extremely useful in the rare cases when it is needed.
- The history is editable by default. If I move to a previous history line and change it, the old line disappears. Hitting Ctrl-c will remove it from the history.
- If I use simultaneous shells (screen, tmux, or several ssh connections), the history saved will be the one of the last shell to quit. The bash config `histappend` should be the default, IMO.
- Most of the time, I search the history by the beginning of the command I just typed, which zsh maps to alt-p and which bash does not map by default. I rarely use the ctrl-r search.
- No way to pause a command and view the man. With zsh, `git clone<alt-h>` will display `man git-clone`, then return to the incomplete command line.
- No way to set a command aside. E.g. if I realise while typing that I'm not in the right directory, `git clone<alt-q>cd src<return>`.