What a ridiculous fixed header. It's taking up 2/3 of my phone's screen.
Favorite Unix Commands
91–100 of 135 posts
Re: Favorite Unix Commands
#92mount -t overlayfs -o lowerdir=$HOME,upperdir=/tmp/tmpHOME overlayfs $HOME
What is the purpose of this?
If you'd do that for / , your own system would start behaving, like a system booted from LiveCD. And, after reboot, would return to the origanal state.
Overlayfs is pretty cool actually. Allows you to overlay a lower directory with some other upper directory and mount the result somewhere. All the changes that you are making in the mounted directory would be visible to you, and would be stored in the upper directory.
In the example above, after running this command, content of your $HOME would stop changing. But you still will be able to change it, with all the changed content going into tmpHome.
Re: Favorite Unix Commands
#93Re: Favorite Unix Commands
#94Please comment if you have a favorite not on this list.
slRe: Favorite Unix Commands
#95I have this in my .bashrc: function lc() { if [[ "$#" -gt 1 ]]; then for DIR in "$@"; do echo -n "$DIR - " ; ls -AU1 $DIR | wc -l ; done ; else ls -AU1 "$@" | wc -l ; fi; } So, "lc /dir" will count the number of files in /dir and "lc /dir/*" will count the files in subdirectories of /dir. This is useful if you're working in an environment where you may have thousands of files in a directory, and a regular "ls -l" wil…
Here's an idea: always pipe ls throug a pager! If it's less than a page, it would just print the results (you have to set some flags on less that I don't remember). If it's more, then press d or /term-to-search :)
less -F
Won't page if less than one screenful. zsh users can also do:
(less than character)Re: Favorite Unix Commands
#96Earlier quoted context omitted.
If you are searching inside code specifically, you may like 'ack'. It does the same thing grep does, except it has preset 'excludes', is recursive by default, and the output is a bit prettier.
Or even 'ag' (the silver searcher). Like ack, but "better". https://github.com/ggreer/the_silver_searcher
It is not a drop-in replacement for ack. e.g. there are some basic usages it does not support -- iirc counts (ag -c pattern).
Re: Favorite Unix Commands
#97Re: Favorite Unix Commands
#98Earlier quoted context omitted.
What is the purpose of this?
Very useful, if you want to make a checkpoint (possibly for /), break things and then get back to the original state. If you'd do that for / , your own system would start behaving, like a system booted from LiveCD. And, after reboot, would return to the origanal state. Overlayfs is pretty cool actually. Allows you to overlay a lower directory with some other upper directory and mount the result somewhere. All the cha…
Re: Favorite Unix Commands
#99zsh's file globbing is awesome. Some simple ones:
*(.) - only files
*(/) - only dirs
*(.m0) - files modified today
*(.om[1,15]) - 15 recently modified filesRe: Favorite Unix Commands
#100$ find . -name \*~ -delete