LQ Poll: What's your favorite Linux terminal trick?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Since I do a butt load of remote shell work, screen is my favorite tool. As for key/code tricks; tab-complete, pipeing, && (command stringing) and arrow-up
When you are using ssh for a remote login and the far end hangs or the far end terminal emulator becomes unpredictable, enter the command: ~. (tilde dot) to close the connection. It preserves your client side terminal session. You can then just hit the up arrow key to invoke ssh again.
I have used the following two aliases for decades, and install as the first thing in any new shell environment:
Code:
alias p='pushd'
alias P='popd'
They make traversing down and up directory hierarchies much more convenient. Use like this:
Code:
erkki-desktop2:.../~$ p sub
~/sub ~
erkki-desktop2:.../sub$ p sub1
~/sub/sub1 ~/sub ~
erkki-desktop2:.../sub1$ P
~/sub ~
erkki-desktop2:.../sub$ p sub2
~/sub/sub2 ~/sub ~
erkki-desktop2:.../sub2$ p sub3
~/sub/sub2/sub3 ~/sub/sub2 ~/sub ~
erkki-desktop2:.../sub3$ P
~/sub/sub2 ~/sub ~
erkki-desktop2:.../sub2$ P
~/sub ~
erkki-desktop2:.../sub$ P
~
erkki-desktop2:.../~$
I did not invent them, I am not sure any more, but they probably originally came from some BSD unix .cshrc .
Ctrl+R ("reverse-i-search"), to pull up previously-used commands from bash history. And pasting selected text into the command line with a middle mouse click.
Probably using curl to send texts. I have a script that acquires my gmail password (uses a hash I created to check that I entered the password correctly). So, I can use that to store my password in a bash variable with no need to store the password in my bash history. Then, I can send a text like this:
Pretty useful. I start jobs all the time (say compiling with make or cp of an extremely large file) that take an extended period of time. So, I start screen. And, I type out whatever command followed by a semi colon. Then, I type myself a text message and start the job. Then (of course) detach from screen and (knowing me) detach from whatever remote machine I'm attached to. And when the job stops, I get a text message.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.