Brace expansion to create a backup: cp {file,.bak} reduces to cp file file.bak
cp file{,.bak}
Was it a typo, or is there some feature/special-case I don't know about?251–259 of 259 posts
Brace expansion to create a backup: cp {file,.bak} reduces to cp file file.bak
cp file{,.bak}
Was it a typo, or is there some feature/special-case I don't know about?I want a command that counts files in a tree like du does sizes but without having to pipe find through wc which is crazy for hundred thousand files. Can't they just directly access inodes for high speed counting?
du just uses the fts API, so if you want something directly equivalent (omitting options and error handling) it was only barely too long to post: http://pastie.org/8315296 Compared to the equivalent find, code #1 is much faster in this completely scientific best of several runs: $ time (find OSS/llvm -type f -or -type l | wc -l) real 0m4.681s $ time du -d0 OSS/llvm real 0m4.863s $ time ./fts OSS/llvm real 0m0.559s Os…
history | grep I use this for rsync or rdesktop when I have forgotten the long list of options & directories etc I also use ctrl R at the bash prompt but that only gives me the most recent match.
> I also use ctrl R at the bash prompt but that only gives me the most recent match. // Are you sure, I'm using BASH on Kubuntu and I get previous matches by repeated use of ctrl+R. Actually inspired by a previous post here I made a script "hs" that searches archived history files and shows me all past match lines. Before that I did what you do now.
Brace expansion to create a backup: cp {file,.bak} reduces to cp file file.bak
Brace expansion is great! My understanding, though, is that you'd need to write: cp file{,.bak} Was it a typo, or is there some feature/special-case I don't know about?
Earlier quoted context omitted.
Isn't that the same as ls -1 ?
Mostly, yes, except that ls -1 does not turn off colours, and maybe there are a few more differences.
Your 'ls' must be an alias for the real ls with some options. For example, mine is:
$ type ls
ls is aliased to `ls --color=auto'
A quick way to run the original 'ls' (not the aliased version), just prefix it with backslash: $ \ls ...
Or: $ command ls ...One little known, but very handy tip: At any password prompt, if you knowingly mis-keyed your password, rather than pressing return, getting the "your an idiot" message (often after an annoying 1 - 2 second delay), and having to retype the command, you can actually press ctrl-U, which is the "Clear the line" bash command, and start over typing your password again.
PS if you are a Vim user, you owe it to yourself to try the vim-style keybinds. They make a world of difference.
Command line globbing! For the uninitiated: Let's say my pwd is `/home/projects` and i want to edit `/home/projects/a_huge_sprawling_app/940j_394/lol/flight_controller.rb` `vim **/flight_controller.rb` opens our flight_controller.rb straight away. In terms of effort, this allows you to basically omit a `find -name` when you're in a rush to edit some damn file where the hell is it again damn we need to reevaluate this…
Re: command line globbing with globstar -- is there some way to get it to cache filepaths that are frequently accessed? It's quite slow for me (I usually use aliases for that, which I was contemplating getting rid of). Thanks a lot for wising me up to the new hotness offered by bash 4+ (zsh is also pretty slow for me for some reason, even though people keep telling me to switch to that. Maybe I'm more impatient than…
Earlier quoted context omitted.
tsort is one of my favorites, mostly because it's totally pointless until you need it and then it works exactly right . I love it.
Wow. I just read the man page for tsort and I am none the wiser. tsort takes a list of pairs of node names representing directed arcs in a graph and prints the nodes in topologi-cal order on standard output. It's not often I understand nothing on a man page. But this time, I'm stumped!
info coreutils 'tsort invocation'How can one use a Unix/Linux system without knowing SSH? How to login remotely without it?
To connect to the shell from Windows, you can use the Putty program (google for it), although the shell documentation will almost certainly tell you how to do it.