Awesome but commonly unknown Linux Commands
anchor.com.au
Awesome but commonly unknown Linux Commands
1–10 of 88 posts
Re: Awesome but commonly unknown Linux Commands
#2Re: Awesome but commonly unknown Linux Commands
#3On 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.
Re: Awesome but commonly unknown Linux Commands
#4$ 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.
Re: Awesome but commonly unknown Linux Commands
#5One 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.
Re: Awesome but commonly unknown Linux Commands
#6One 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 `cd -` to return to the previous directory.
Re: Awesome but commonly unknown Linux Commands
#7One 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.
For interactive use zsh has an option called autopushd that automatically pushes directories you `cd` to. I never remember to use pushd so it's a nice convenience.
Re: Awesome but commonly unknown Linux Commands
#8Re: Awesome but commonly unknown Linux Commands
#9Re: Awesome but commonly unknown Linux Commands
#10On 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.
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.