The special bash command I'm most often asked about by shoulder surfers is !$. It substitutes the last argument in the previous command into the current one. For example: $ ls /some/long/path/somewhere/looking/around/ $ cd !$ cd /some/long/path/somewhere/looking/around/
Unix tricks
51–60 of 232 posts
Re: Unix tricks
#52 ProxyCommand ssh -T host1 'nc %h %p'
you can use ProxyCommand ssh -W %h:%p host1
which uses ssh itself and therefor also works on machines where netcat isn't installed.Re: Unix tricks
#53Re: Unix tricks
#54ctrl-z - stops a program
bg - sends the stopped program to the background
fg - gets the program back to the foreground (interactive mode)
very useful in editor sessions or when you want to get rid of the endless download/scp that is blocking your terminal
Re: Unix tricks
#55 'tar cz folder/ | ssh server "tar xz"'
Can be pulled off with two flags to scp - and you get to see progress as a benefit! scp -Cr folder server:dest/Re: Unix tricks
#56Weird, I've been using vi/elvis/vim/MacVim as my primary editor since 1984 and I hate vi key bindings for shell; I always use the emacs bindings.
Re: Unix tricks
#57If I may add a trick: ctrl-z - stops a program bg - sends the stopped program to the background fg - gets the program back to the foreground (interactive mode) very useful in editor sessions or when you want to get rid of the endless download/scp that is blocking your terminal
Re: Unix tricks
#58Hung SSH session (such as wifi out of range)?
Type Return-Tilde-Period
Re: Unix tricks
#59Re: Unix tricks
#60Whut? ctrl-r? How have I missed that? No more 'history|grep foo' for me!