All these article links should just end up here: http://www.commandlinefu.com/commands/browse you can sort by date, #(votes) and also search The top all-time popular one is: * run last command as root: $ sudo !!
To be fair, that's not even a command; that's a shell expansion that automatically substitutes your previous command in place of the !! before executing it.
Awesome but commonly unknown Linux Commands
61–70 of 88 posts
Re: Awesome but commonly unknown Linux Commands
#62Earlier quoted context omitted.
find -exec is almost always faster and more secure than xargs.
I'd like to hear some justification, cites, or examples for either of these assertions.
http://stackoverflow.com/questions/896808/find-exec-cmd-vs-x... http://www.gnu.org/software/findutils/manual/html_node/find_...
Re: Awesome but commonly unknown Linux Commands
#63All these article links should just end up here: http://www.commandlinefu.com/commands/browse you can sort by date, #(votes) and also search The top all-time popular one is: * run last command as root: $ sudo !!
http://www.catonmat.net/blog/top-ten-one-liners-from-command...
Re: Awesome but commonly unknown Linux Commands
#64If you're running a modern Linux desktop, you should have a "notify-send" command which will cause a message to be displayed by your desktop-environment's pop-up notification system (on Ubuntu, this command is in the libnotify-bin package). I have two scripts I keep around which I call "notify-success" and "notify-failure": notify-success: notify-send --icon=gtk-dialog-info Success! "$*" notify-failure: notify-send -…
make && say "I'm done."Re: Awesome but commonly unknown Linux Commands
#65xargs. Too few people know xargs. Every time I see a "find" with "-exec" in it, my soul cries a little bit. (Yes, sometimes it might be necessary, but in the vast majority of cases not.)
And too few people know that GNU Parallel[1] is most of the time a better xargs than xargs itself. [1]: http://www.gnu.org/s/parallel/
Re: Awesome but commonly unknown Linux Commands
#66Earlier quoted context omitted.
strace is the Daddy of debugging especially when you can attach it to an already existing program using it's PID. I have solved so many permissions errors problems with strace where the application itself just failed without logging anything.
If the application fails, wouldn't it just shut down and the process ends? Meaning that I can't call strace anymore? Do you have suggestions for that usecase? How would I know what the process id is going to be before I start the program?
Re: Awesome but commonly unknown Linux Commands
#67One I use all the time is this: $ pwd /Users/me/Sites/foo $ pushd . $ cd / $ pwd / $ popd $ pwd /Users/me/Sites/foo Or in English: If you're in a directory that you need to leave but you know you'll go back there in a minute, use "pushd ." to save that directory. Then go off and do whatever you need to, and when you need to return to the saved directory, use "popd" to take you straight back there.
You can also use $CDPATH to jump easily between directories e.g. : Imagine you have this folder ~/dev/python/my_awesome_project If you set CDPATH to '.:~/dev/python', you can easily jump to your project just by doing cd my_awesome_project, it doesn't matter where you actually are in your FS! I use it heavily with cd -, you should give it a try!
Re: Awesome but commonly unknown Linux Commands
#68Earlier quoted context omitted.
strace is the Daddy of debugging especially when you can attach it to an already existing program using it's PID. I have solved so many permissions errors problems with strace where the application itself just failed without logging anything.
Similar experience here, except that I've solved similar issues (and far more complicated issues) with DTrace instead of strace. The range of information that DTrace can retrieve about a running application surpasses anything that strace can retrieve. DTrace can retrieve information on a systemic scale, whereas each strace instance operates on a single process. And the overhead is significantly lower with DTrace. For…
Re: Awesome but commonly unknown Linux Commands
#69Earlier quoted context omitted.
And too few people know that GNU Parallel[1] is most of the time a better xargs than xargs itself. [1]: http://www.gnu.org/s/parallel/
How is it different than xargs -P?
Re: Awesome but commonly unknown Linux Commands
#70On Linux I very regularly use 'strace', to see what a program is currently doing (in terms of syscalls), what files were opened/read/written/closed, etc.
I've debugged stalled processes across 3 separate servers with these three tools alone.