Productivity for programmers. Terminal tricks.

This is the four and last part of my discovery different tools, tricks and practices for making programmers more effective.

Again. Learn shortcuts

Use all the power of your shell should save a lot of time. Make sense to spend some time learning it. Here is a list of a few most commonly used.

  • Ctrl + L Clears the screen;
  • Ctrl + C Terminate the command;
  • Ctrl + R Search command history backwards;
  • Ctrl + A go to the start of the command line;
  • Ctrl + E go to the end of the command line;
  • Ctrl + K cut from cursor to the end of the command line;
  • Ctrl + U cut from cursor to the start of the command line;
  • Ctrl + W cut from cursor to start of word;
  • Alt + B move backward one word (or go to start of word the cursor is currently on);
  • Alt + F move forward one word (or go to end of word the cursor is currently on);
  • Alt + D delete to end of word starting at cursor;
  • Alt + C capitalize to end of word starting at cursor;
  • Alt + U make uppercase from cursor to end of word;
  • Alt + L make lowercase from cursor to end of word;
  • Alt + T swap current word with previous;
  • !! run last command;
  • !word – run the most recent command that starts with ‘word’;

Never waste time logging again

$ ssh-copy-id user@host

Use better shell tools

ohmyzsh, fzf, du →ncdu, top →htop, cat → bat

Use tmux for remote session and learn shortcuts

tmux attach || tmux new — doing so, you first try to connect to an existing tmux server, if one exists; if there isn’t one yet, create a new one.

Shortcuts I use often:

  • Ctrl+b d — disconnect;
  • Ctrl+b c — create window;
  • Ctrl+b 0…9 — jump to the window;
  • Ctrl+b p — previous window;
  • Ctrl+b n — next window;
  • Ctrl+b l — get back to the last window;
  • Ctrl+b & — close window;

Splitting windows:

  • Ctrl + b% — split the current panel into two, vertically;
  • Ctrl + b ” — split the current panel into two, horizontally (this is a quotation mark, which is near Enter, not Shift + 2);
  • Ctrl + b → ← ↑ ↓ – switch between panels;
  • Ctrl + b x – close the panel (or you can just type exit in the terminal);

Scrolling:

  • Ctrl+b — scrolling mode;
    • PgUp — page up:
    • PgUp, PgDown — page down;
    • q — exit from scrolling mode;

Forgot sudo? Use !!

$ apt install mc
> Unable to acquire the dpkg frontend lock , are you root?
$ sudo !!

Quick navigation

Add this function into your ~/.bashrc or ~/.zshrc file:

function goto {
   value=cat ~/.links/$1
   cd -P "$value";
 }

Put in your ~/.links directory. The name of the file is your alias, the content of the file is the path to your hot directory. Could be created like this:

$ pwd > ~/.links/prj

Then jump into this directory by goto prj. 

Create more useful aliases in your terminal.

Repeatable commands

$ touch newfile
$ chmod +x $_
$ vim $_

Your own watchers

Utility entr allows you to run some script when files are changing:

$ echo my.sql | entr -p psql -f /_

As usually, everybody is welcome to get me your feedback and add something useful to the list.

Site Footer

Sliding Sidebar

About Me

About Me

For whom this blog for?

For those who are interested in modern Internet technologies, IT business, startups, management, quality control, personal effectiveness, motivation. Here I write about what is interesting, about problems I faced and solutions I found. I hope it will be interesting to you either.

What motivates me to write?

The desire to improve, to study deeper topics that interest me. Find people with similar problems and tasks, together look for ways out and solutions.

Feel free to contact if you have anything to say to me

Old Flash site with my artistic works and misuc.