Linux Tips and Tricks for Developers

Clinton / January 2, 2018 in 

Linux Tips and Tricks for Developers

For lifelong Windows user, being thrust into a linux development environment can be difficult and you feeling inefficient. This was certainly true for me. Over the years, however, I have learned to be more productive in linux to the point where I will never go back to developing on Windows.

To the developer who knows their way around linux but still feels uncomfortable developing full time in it, here are a few linux tips:

Tip 1: Searching Application Logs

If you need to search through your application log but you’re not quite sure what you’re looking for , use less.

$ less -R log/application.log

The less command is ideal for perusing large files. The -R flag is useful for rendering ANSI escape sequences so that ESC[31merrorESC[39m looks more like error.

Searching for strings using less is easy. Just type / followed by your search term and hit enter. You can navigate the search results with the following:

  • n – next match
  • N – previous match

Tip 2: Directory Navigation

Directory navigation can be painful when you have to constantly switch between folders. Luckily there are some easy shortcuts.

If you need to go back to the directory you were just in, cd - will take you there.

Do you think you’ll want to return to the directory you are currently in but are afraid you’ll forget which one that is? Use pushd to go somewhere else instead of cd. The pushdcommand will do two things: push your current directory onto a stack and navigate to a new directory. When you are ready to return to the directory, issue the popd command and voila!

$ cd /some/directory

$ pushd /some/other/directory

$ perform software wizardry

$ popd

$ pwd

 /some/directory

Tip 3: Git tips and tricks

Using git? Of course you are. Using branches? Dang straight. Remember that cd - command for going back to the previous directory? You can do something similar in git.  You can go to the previous branch just by typing git branch -.

If you are not used to developing outside of your favorite IDE, you might be feeling lost without the integrated search capabilities it provided you. Fear not, git can handle that.

$ git grep -in “search term” --and “another term”

Git can search your project for anything in the git history, automatically ignoring all files and directories in your .gitignore file (convenient). Passing in the -i and –n flags will ignore capitalization and display the line number of the results. If you need to narrow your search further, the --and flag will search for an additional term that appears in the same file as the first.

 

Previous

BTI360 Christmas Party 2017

Next

BTI360 Awarded Machine Learning Contract

Close Form

Enjoy our Blog?

Then stay up-to-date with our latest posts delivered right to your inbox.

  • This field is for validation purposes and should be left unchanged.

Or catch us on social media

Stay in Touch

Whether we’re honing our craft, hanging out with our team, or volunteering in the community, we invite you to keep tabs on us.

  • This field is for validation purposes and should be left unchanged.