DEV Community

Cover image for A Guide To Loving Your Terminal

A Guide To Loving Your Terminal

Lazar on August 13, 2019

*Congratulations, you are a proud terminal owner! * When I first switched to Linux, I avoided my terminal like the plague. Now I don't know how I ...
Collapse
 
mitchartemis profile image
Mitch Stanley

Another bonus for the && syntax is that if the first command fails it will not run the second command.

This is useful if the second command relies on the first commands result (Like with your example updating packages).

If they're two separate commands that don't rely on each other then you can use ; instead.

Collapse
 
samuelabreu profile image
Samuel Abreu

Also || is a valuable tool on scripts, to exit or inform an error:

do_something_amazing || echo “nope” && exit 1

Collapse
 
mithil467 profile image
Mithil Poojary

I use that with gcc.
gcc filename.c && ./a.out

If compilation failed, it won't run the program.

Collapse
 
bootcode profile image
Robin Palotai

+1: commit your dotfiles to a repo so it's easy to restore on an other machine.

Eventually I would like to write about the collection of terminal tools I use and love (like grep, sed, tmux, multitail, ncdu, ranger etc). Follow me if you want to read one day.

Collapse
 
skydevht profile image
Holy-Elie Scaïde

I pretty spend my coding life between the terminal and the browser (which is the only things keeping me from going full minimal). I use Neovim as a text editor and even if you can launch commands within it, it' often faster for me to pause it using ctrl-z and resume it afterward with fg. I usually have both Ranger and Neovim open and I can be pretty fast with them (keyboard only). Another thing that helps is using zsh and oh-my-zsh with a few plugins enabled (git, yarn, laravel5, z) which boost my productivity to the roof

Collapse
 
maxdevjs profile image
maxdevjs

Once I found a fancy function to handle ctrl-z behaviour. As seems that you use zsh and in a similar way, here it is:

fancy-ctrl-z () {
  if [[ $#BUFFER -eq 0 ]]; then
    BUFFER="fg"
    zle accept-line
  else
    zle push-input
    zle clear-screen
  fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
Collapse
 
lazar profile image
Lazar

Funny you talk about going full minimal! Same thing with me, the browser is the only one tying me down as well... or else I would just have a full cli system. lol

Collapse
 
vitalcog profile image
Chad Windham

+1 for changing terminal font lol, whenever I set up a computer the first thing I do is change the default size of my terminal (making it much bigger), increase the font size to make things easier to read, and change the font (for the same reason)

Collapse
 
scorp13 profile image
scorp13

A couple of years ago I wrote a small cheat sheet on some terminal commands for myself

Collapse
 
cycolucas profile image
Lvcäs

Amazing post!

Another very useful command is "man"! When you have no idea about all the capabilities of a certain program it shows the manual of it.

Collapse
 
maydev profile image
Mayank Yadav

+1 Set the background color to translucent, so you can see what's happening at the window beneath it.
+1 install 'nautilus', helps you open the terminal from any folder location.

Collapse
 
tuvannguyen profile image
Tu Van Nguyen

Yup, being able to use the terminal is like a super power for productivity. And it's amazing how many other tools you can suddenly use once you master the terminal.

Collapse
 
notsag profile image
Maxime Gaston

Actually, nearly anyone using ohmyzsh with a powerline font theme changed his terminal fonts 😉