DEV Community

Cover image for Why you need Terminal

Why you need Terminal

Nathan Robinson on October 12, 2017

The Terminal, also known as the command line or a Terminal emulator, is an essential component of any useful operating system. It is by far one o...
Collapse
 
aurelkurtula profile image
aurel kurtula

I love this.

I remember putting it off for a long time. Now, I too have terminal in the background.

I managed to make a snippet manager with bash, it was so cool. I also added my most used git commands in one mash method. So when I'm working, after the initial setup, I just run gitit "commit message" and bash adds, commits and pushes the code.

I'd love to know a bit more about it though, for example, why is it that now it feels slower that it used to be.

Collapse
 
nrobinson2000 profile image
Nathan Robinson

I have this function in my .bashrc for quickly committing and pushing my changes in a repo.


function update()
{
  cd "$(pwd)"
  git add -A
  #git commit -S -m "$1 at $(date +"%H:%M") of $(date +"%Y-%m-%d")" # Replace the line below with this one for GPG signed commits
  git commit -m "$1 at $(date +"%H:%M") of $(date +"%Y-%m-%d")"
  git push -u origin $(git rev-parse --abbrev-ref HEAD)
}

I can just do update “message” and all changes will be committed using my GPG key, the commit message gets appended with a timestamp, and gets pushed immediately.

I also have this function will lets me do a git pull for all repositories in a directory.

function pull-all()
{
  CWD="$PWD"

  for OUTPUT in $(ls -1 "$CWD")
  do
    if [ -d "$CWD/$OUTPUT/.git" ]; # Only do git pull if it is a repository
    then
      cd "$CWD/$OUTPUT"
      echo "Pulling $OUTPUT..."
      git pull
      echo
    fi
  done
  cd "$CWD"
}

It’s very convinient because I can cd to my central git directory and run pull-all to git pull all the repos.

Collapse
 
aurelkurtula profile image
aurel kurtula

That's a lot more sophisticated than what I have. I didn't even think of adding the time stamp. I'll definitely borrow that :)

I might borrow the pull-all though to be honest I do not understand it at all. Though I use git daily for my private repos, I haven't yet contributed to any open source (which if I'm not mistaken is what pull is mostly used for).

Thread Thread
 
nrobinson2000 profile image
Nathan Robinson

Pull is also used if you are working on a repo on multiple devices (even if they are your own and it’s a private repo).

Thread Thread
 
aurelkurtula profile image
aurel kurtula

Oh yes, but never had to :)

Collapse
 
vinayhegde1990 profile image
Vinay Hegde • Edited

This is a very concise article explaining the importance of the Terminal since most people are usually in favor of the GUI [due to the assumption the CLI is only for hackers ;) ]

One more way to do a Git pull on your multiple Git repos without ever changing to your central git directory is by installing and using gitup. I personally have used it for 8 repos which worked flawlessly.

It's just a one time setup and on every pull, it'll show you all the objects that were updated for each repository right in your terminal (depending on any color scheme you use, this is a very cool thing to have :D ]

Hope this helps, cheers!

Collapse
 
foxwhite profile image
Egor

What's your color theme?

Collapse
 
nrobinson2000 profile image
Nathan Robinson
Collapse
 
ben profile image
Ben Halpern

All anyone ever wants to know 😁

Thread Thread
 
nrobinson2000 profile image
Nathan Robinson

My theme was inspired by a reddit post I saw a while ago.

Collapse
 
poffdeluxe profile image
Poff Poffenberger

Was wondering the same thing

Collapse
 
scheidig profile image
Albrecht Scheidig

I like your engagement. And I also like the direction of your engagement: motivating developers to get used to the shell / terminal.

You could, however, add some more concrete and compelling examples to highlight what the shell is doing for you that other tools cannot do. Or add some neat tricks you are aware of. Developers are always keen on neat tricks :-)

In my day jobs, I have always been a developer using Windows OS. Having a background on linux, I have always looked for solutions to leverage a powerful, bash style command line on windows. I used cygwin for a decade. I built a virtual machine running ubuntu that shares the data partition with the windows host. Currently, I use git bash most of the time, which is fast, lightweight and easy to install on a new box.

Junior (Windows) developers are often not used to the idea to leave the IDE, open a shell, running cryptic commands. But they are willing to learn the advantages. Cryptic commands can be saved in scripts. Scripts can be parameterized to make them available for broader use. Those scripts can be shared using git. A whole new shiny world. A set of tools to make you more efficient. An environment that supports platform independence and tool chain (think of Continuous Integration, automated installation and upgrade etc.)

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I want a shell that works with non-proportional fonts. Somehow I need to convince all the tools authors to stop aligning things with space output though. :/

Collapse
 
nrobinson2000 profile image
Nathan Robinson

If you guys want to help support po-util you can use my link to preorder some of Particle's next generation of IoT boards:
particle.io/mesh/?referral=5XC8JC

Collapse
 
asudigital profile image
Asutosh Sahoo

Love to read this , so much knowledge I gathered..