Earlier quoted context omitted.
I can't remember ever encountered a unix-like system without "vi" installed. I've used (and set up) machines running FreeBSD, DragonflyBSD, OSX, Ubuntu, Debian, RHEL, ... Plenty of those didn't have emacs, especially on first boot, when you're most likely to need to modify network configuration files in order to get online to install new packages in the first place... Edit: By "vi" I mean that somewhere in the path t…
> I can't remember ever encountered a unix-like system without "vi" installed. Default Ubuntu install.
The Art of Command Line
71–80 of 134 posts
Re: The Art of Command Line
#72> To locate a file by name in the current directory, find -iname something . (or similar). To find a file anywhere by name, use locate something (but bear in mind updatedb my not have indexed recently created files). I think this will glob unless you escape the asterisks. Also on my system (debian 8) I need to put the directory to search first, or not at all: find . -iname \ something\ find -iname \ something\ edit:…
The majority of times, this is the case. At least one exception is when the shell pattern does not match one or more files in the directory which find(1) is executed. However, this can be "surprising" so it's best practice to either use escapes or ensure interpolation is disabled via single quotes (in Bourne shell syntax).
> Also on my system (debian 8) I need to put the directory to search first...
FWIW, you can specify more than one directory if desired. The primaries will be applied to the results of each.
Re: The Art of Command Line
#73Re: The Art of Command Line
#74Unix tools are very powerful, but they are not as intuitive as I would like. It would be nice if we can have an httpie for process management, one for text manipulation, another for system stats, and so on.
Re: The Art of Command Line
#75So this is tangentially related by why do people seem to push Vi? Nano is a perfectly serviceable editor. If I need to do extensive editing I always end up loading it into Atom, Sublime or some other editor anyway. I've never really had to use a console editor for more than 10s of lines.
set -o emacs
Will give command line editing bindings compatible with Emacs (which is also the default editing keys in MS-Windows and many IDE's BTW).
HTH
Re: The Art of Command Line
#76> To locate a file by name in the current directory, find -iname something . (or similar). To find a file anywhere by name, use locate something (but bear in mind updatedb my not have indexed recently created files). I think this will glob unless you escape the asterisks. Also on my system (debian 8) I need to put the directory to search first, or not at all: find . -iname \ something\ find -iname \ something\ edit:…
> I think this will glob unless you escape the asterisks. The majority of times, this is the case. At least one exception is when the shell pattern does not match one or more files in the directory which find(1) is executed. However, this can be "surprising" so it's best practice to either use escapes or ensure interpolation is disabled via single quotes (in Bourne shell syntax). > Also on my system (debian 8) I need…
Thankfully zsh has the NULLGLOB option which will do the right thing and expand to an empty list, of the zero matching files.
Re: The Art of Command Line
#77If you learn bash, and you learn vi, then the next most glorious addition is: set -o vi Then you have vi keys in your shell. And it is marvelous.
which goes against his childish comment on emacs:
> Learn Vim (vi). There's really no competition for random Linux editing (even if you use Emacs, a big IDE, or a modern hipster editor most of the time).
Re: The Art of Command Line
#78> To disable slow i18n routines and use traditional byte-based sort order, use export LC_ALL=C (in fact, consider putting this in your ~/.bashrc). Do not. Having a non-utf8 locale means you won't be able to handle utf-8 sanely ("that's why it's faster") and it will break at the most inexplicable times. Any non-latin1 character appearing in your prompt or command line with this will mess its spacing up for example. Do…
I have the following set in my .cshrc: setenv LC_ALL en_US.UTF-8 setenv LC_COLLATE C # use the ASCII sort order What have I broken, and how badly?
Re: The Art of Command Line
#79There's no reason to learn vi if you know Emacs. If you claim that Emacs isn't installed everywhere, guess what: Neither is vi. If you want an "installed everywhere" editor, learn ed. If you're willing to take an editor with you (or otherwise make sure a specific editor is everywhere you are), there's no reason it has to be vi.
Re: The Art of Command Line
#80> StrictHostKeyChecking=no And welcome to MITM haven. This is awful advice if you care about the first S in SSH.
What would be good is an interactive confirmation when a host fingerprint has changed, instead of a flatout abortion and having to edit your `known_host` file. I have to SSH into hundreds/thousands of VM that reuse the same IPs/FQDN sometimes, and the strict host checking is a major PITA. I haven't turned it off tho, I prefer the pain to MITM.