Command Line and Vim Tips from a Java Programmer

I’m always interested in learning more about useful development tools. In college, most programmers get an intro to the Linux command line environment, but I wanted to share some commands I use daily that I’ve learned since graduation.

Being comfortable on the command line is a great skill to have when a customer is looking over your shoulder on a Webex. They could be watching a software demo or deployment to their environment. It can also be useful when learning a new code base or working with a product with a large, unfamiliar directory structure with lots of logs.

If you’re on Windows, you can use Cygwin to get a Unix-like CLI to make these commands available.

Useful Linux commands

Find

The command find helps you find files by recursively searching subdirectories. Here are some examples:

find .    Prints all files and directories under the current directory.

find . -name '*.log'   Prints all files and directories that end in “.log”.

find /tmp -type f -name '*.log'   Prints only files in the directory “/tmp” that end in “.log”.

find . -type d   Prints only directories.

find . -maxdepth 2     Prints all files and directories under the current directory, and subdirectories (but not sub-subdirectories).

find . -type f -exec ls -la {} \;     The  -exec flag runs a command against each file instead of printing the name. In this example, it will run  ls -la filename  on each file under the current directory. The curly braces take the place of the filename.

Grep

The command grep lets you search text for lines that match a specific string. It can be helpful to add your initials to debug statements in your code and then grep for them to find them in the logs.

grep foo filename  Prints each line in the file “filename” that matches the string “foo”.

grep foo\\\|bar filename Grep supports regular expressions, so this prints each line in the file that matches “foo” or “bar”.

grep -i foo filename  Add -i for case insensitive matching.

grep foo *  Use the shell wildcard, an asterisk, to search all files in the current directory for the string “foo”.

grep -r foo *  Recursively search all files and directories in the current directory for a string.

grep -rnH foo filename  Add -n to print line numbers and -H to print the filename on each line.

find . -type f -name '*.log' -exec grep -nH foo {} \;  Combining find and grep can let you easily search each file that matches a certain name for a string. This will print each line that matches “foo” along with the file name and line number in each file that ends in “.log” under the current directory.

ps -ef | grep processName  The output of any command can be piped to grep, and the lines of STDOUT that match the expression will be printed. For example, you could use this to find the pid of a process with a known name.

cat file.txt | grep -v foo  You can also use -v to print all lines that don’t match an expression.

Ln

The command ln lets you create links. I generally use this to create links in my home directory to quickly cd into long directory paths.

ln -s /some/really/long/path foo  The -s is for symbolic, and the long path is the target. The output of ls -la in this case would be foo -> /some/really/long/path .

Bashrc

The Bashrc is a shell script that gets executed whenever Bash is started in an interactive terminal. It is located in your home directory, ~/.bashrc . It provides a place to edit your $PATH, $PS1, or add aliases and functions to simplify commonly used tasks.

Aliases are a way you can define your own command line commands. Here are a couple useful aliases I’ve added to my .bashrc that have saved a lot of keystrokes on a server where I’ve installed Oracle WebCenter:

After making changes to your .bashrc, you can load them with source ~/.bashrc . Now I can type rpl , short for Read Portal Logs, from anywhere to quickly jump into the WebCenter portal log file.

alias grep=grep --color

This grep alias adds the –color option to all of my grep commands.  All of the above grep commands still work, but now all of the matches will be highlighted.

Vim

Knowing Vim key bindings can be convenient and efficient if you’re already working on the command line. Vim has many built-in shortcuts to make editing files quick and easy.

Run  vim filename.txt  to open a file in Vim. Vim starts in Normal Mode, where most characters have a special meeting, and typing a colon, : , lets you run Vim commands. For example, typing  Shift-G  will jump to the end of the file, and typing :q while in normal mode will quit Vim. Here is a list of useful commands:

:q  Quits Vim

:w  Write the file (save)

:wq  Write and quit

:q!  Quit and ignore warnings that you didn’t write the file

:wq!  Write and quit, ignoring permission warnings

i  Enter Insert Mode where you can edit the file like a normal text editor

a  Enter Insert Mode and place the cursor after the current character

o  Insert a blank line after the current line and enter Insert Mode

[escape]  The escape button exits insert mode

:150  Jump to line 150

shift-G  Jump to the last line

gg  Jump to the first line

/foo  Search for the next occurrence of “foo”. Regex patterns work in the search.

?foo  Search for the previous occurrence of “foo”

n  Go to the next match

N Go to the previous match

*  Search for the next occurrence of the searched word under the cursor

#  Search for the previous occurrence of the searched word under the cursor

w  Jump to the next word

b  Jump to the previous word

``  Jump to the last action

dw  Delete the word starting at the cursor

cw  Delete the word starting at the cursor and enter insert mode

c$  Delete everything from the cursor to the end of the line and enter insert mode

dd  Delete the current line

D  Delete everything from the cursor to the end of the line

u  Undo the last action

ctrl-r  ctrl-r  Redo the last action

d[up]  Delete the current line and the line above it. “[up]” is for the up arrow.

d[down]  Delete the current line and the line below it

d3[down]  Delete the current line and the three lines below it

r[any character]  Replace the character under the cursor with another character

~  Toggle the case (upper or lower) of the character under the cursor

v  Enter Visual Mode. Use the arrow keys to highlight text.

shift-V  Enter Visual Mode and highlight whole lines at a time.

ctrl-v  Enter Visual Mode but highlight blocks of characters.

=  While in Visual Mode, = will auto format highlighted text.

c  While in Visual Mode, c will cut the highlighted text.

y  While in Visual Mode, y will yank (copy) the highlighted text.

p  In Normal Mode, p will paste the text in the buffer (that’s been yanked or cut).

yw  Yank the text from the cursor to the end of the current word.

:sort  Highlight lines in Visual Mode, then use this command to sort them alphabetically.

:s/foo/bar/g  Highlight lines in Visual Mode, then use search and replace to replace all instances of “foo” with “bar”.

:s/^/#/  Highlight lines in Visual Mode, then add # at the start of each line. This is useful to comment out blocks of code.

:s/$/;/ Highlight lines in Visual Mode, then add a semicolon at the end of each line.

:set paste  This will turn off auto indenting. Use it before pasting into Vim from outside the terminal (you’ll want to be in insert mode before you paste).

:set nopaste  Make auto indenting return to normal.

:set nu  Turn on line numbers.

:set nonu  Turn off line numbers.

:r!pwd  Read the output of a command into Vim. In this example, we’ll read in the current directory.

:r!sed -n 5,10p /path/to/file  Read lines 5 through 10 from another file in Vim. This can be a good way to copy and paste between files in the terminal.

:[up|down]  Type a colon and then use the arrow keys to browse through your command history. If you type letters after the colon, it will only go through commands that matched that. (i.e., :se  and then up would help find to “:set paste” quickly).

Vimrc

The Vimrc is a configuration file that Vim loads whenever it starts up, similar to the Bashrc. It is in your home directory.

Here is a basic Vimrc I’d recommend for getting started if you don’t have one already. Run vim ~/.vimrc and paste in the following:

 

Perl

Perl comes installed by default on Linux, so it is worth mentioning that it has some extensive command line capabilities. If you have ever tried to grep for a string that matches a line in a minified Javascript file, you can probably see the benefit of being able to filter out lines longer than 500 characters.

grep -r foo * | perl -nle'print if 500 > length'

Conclusion

I love learning the tools that are available in my development environment, and it is exciting to see how they can help customers as well.

Recently, I was working with a customer and we were running into SSL issues. Java processes can be run with the option  -Djavax.net.ssl.trustStore=/path/to/trustStore.jks  to specify which keystore to use for SSL certificates. It was really easy to run ps -ef | grep trustStore to quickly identify which keystore we needed to import certificates into.

I’ve also been able to use various find and grep commands to search through unfamiliar directories after exporting metadata from Oracle’s MDS Repository.

Even if you aren’t on the command line, I’d encourage everyone to learn something new about their development environment. Feel free to share your favorite Vim and command line tips in the comments!

Further reading

http://www.vim.org/docs.php

https://www.gnu.org/software/bash/manual/bash.html

http://perldoc.perl.org/perlrun.html

Webinar: Quality, Safety, Knowledge Management with Oracle WebCenter Content and ControlCenter

DATE: THURSDAY, DECEMBER 8, 2016
TIME: 10:00 A.M. PST / 1:00 P.M. EST

Join Ryan Companies Vice President of Construction Operations, Mike Ernst, and Fishbowl Solutions Product Manager, Kim Negaard, to learn how Ryan Companies, a leading national construction firm, found knowledge management success with ControlCenter for Oracle WebCenter Content.

In this webinar, you’ll hear first-hand how ControlCenter has been implemented as part of Ryan’s Integrated Project Delivery Process helping them create a robust knowledge management system to promote consistent and effective operations across multiple regional offices. You’ll also learn how ControlCenter’s intuitive, modern user experience enabled Ryan to easily find documents across devices, implement reoccurring review cycles, and control both company-wide and project-specific documents throughout their lifecycle.

Register today.

Register

New to Zoom? Go to zoom.us/test to ensure you can access the webinar.

 

What I Have Learned as an Oracle WebCenter Consultant in My First Three Months at Fishbowl Solutions

This post comes from Fishbowl Solutions’ Associate Software Consultant, Jake Jehlicka.

Finishing college can be an intimidating experience for many. We leave what we know behind to open the gates to brand new experiences. Those of us fortunate enough to gain immediate employment often find ourselves leaving school and plunging headfirst into an entirely new culture a mere few weeks after turning in our last exam. It is exciting, yet frightening, and what can make-or-break the whole experience is the new environment in which you find yourself if. I consider myself one of the lucky ones.

Intern shirt-back

I have been with Fishbowl Solutions for just over three months, and the experience is unlike any that I had encountered in my previous internships, work, or schooling in Duluth. I moved to the Twin Cities within a week of accepting the position. I was terrified, but my fears were very soon laid to rest. Fishbowl welcomed me with open arms, and I have learned an incredible amount in the short time that I have spent here. Here are just a few of the many aspects of Fishbowl and the skills I’ve gained since working here as an associate software consultant.

Culture

One of the things that really jumped out at me right away is how a company’s culture is a critical component to making work enjoyable and sustainable. Right from the outset, I was invited and even encouraged to take part in Fishbowl’s company activities like their summer softball team and happy hours celebrating new employees joining the team. I have seen first-hand how much these activities bring the workplace together in a way that not only makes employees happy, but makes them very approachable when it comes to questions or assistance. The culture here seems to bring everyone together in a way that is unique to Fishbowl, and the work itself sees benefits because of it.

Teamwork

Over the past three months, one thing that I have also learned is the importance of working together. I joined Fishbowl a few weeks after the other trainees in my group, and they were a bit ahead of me in the training program when I started. Not only were they ready and willing to answer any questions that I had, but they also shared their knowledge that they had acquired in such a way that I was able to catch up before our training had completed. Of course the other trainees weren’t the only ones willing to lend their assistance. The team leads have always been there whenever I needed a technical question answered, or even if I just wanted advice in regard to where my own career may be heading.

People Skills

The team leads also taught me that not every skill is something that can be measured. Through my training, we were exposed to other elements outside of the expected technical skills. We were given guidance when it comes to oft-neglected soft skills such as public speaking and client interactions. These sorts of skills are utterly necessary to learn, regardless of which industry you are in. It is thanks to these that I have already had positive experiences working with our clients.

Technical Skills

As a new software consultant at Fishbowl, I have gained a plethora of knowledge about various technologies and applications, especially with Oracle technologies. The training that I received has prepared me for working with technologies like Oracle WebCenter in such a way that I have been able to dive right into projects as soon as I finished. Working with actual systems was nearly a foreign concept after working with small individual projects in college, but I learned enough from my team members to be able to proceed with confidence. The training program at Fishbowl has a very well-defined structure, with an agenda laid out of what I should be working on in any given time period. A large portion of this was working directly with my own installation of the WebCenter content server. I was responsible for setting up, configuring, and creating a custom code for the servers both in a Windows and Linux environment. The training program was very well documented and I always had the tools, information, and assistance that was needed to complete every task.

Once the formal training ended, I was immediately assigned a customer project involving web development using Oracle’s Site Studio Designer. The training had actually covered this application and I was sufficiently prepared to tackle the new endeavor! With that said, every single day at Fishbowl is another day of education; no two projects are identical and there is always something to be learned. For example, I am currently learning Ext JS with Sencha Architect in preparation for a new project!

Although we may never know with absolute certainty what the future has in store for us, I can confidently say that the experiences, skills, knowledge that I have gained while working at Fishbowl Solutions will stay with me for the rest of my life.

Thank you to the entire Fishbowl team for everything they have done for me, and I look forward to growing alongside them!

j_jehlicka

Jake Jehlicka is an Associate Software Consultant at Fishbowl Solutions. Fishbowl Solutions was founded in 1999. Their areas of expertise include Oracle WebCenter, PTC’s Product Development System (PDS), and enterprise search solutions using the Google Search Appliance. Check out our website to learn more about what we do. 

Taxonomy is a Sleeper. The reasons from A to ZZZs that taxonomy hasn’t been a part of your most important projects—but should be!

I’m a taxonomy practitioner at Fishbowl Solutions who has worked with many companies to implement simple to sophisticated document management systems. I’ve noticed over the years the large number of obstacles that have prevented companies from establishing taxonomy frameworks to support effective document management. I won’t review an exhaustive alphabetic list of obstacles, in fact, there are probably far more than 26, but I’ll highlight the top culprits that have turned even the best, most sophisticated companies away from taxonomy.  Don’t fall asleep.  Don’t hit snooze.  Make sure you don’t miss one of the most important parts of a document management software project–taxonomy. Taxonomy is a necessity to deliver effective document management solutions in Oracle WebCenter Content, SharePoint, or any other enterprise content management solution.  You’ll get the most out of the software and your users.

Authority. Who owns taxonomy? Does IT own the taxonomy or a Quality Management Department or all departments own a piece?   Determining decision-makers and authority to sign off on taxonomy frameworks can be difficult.  After all, taxonomies are best when they are enterprise-wide solutions.  Then, users have a familiar context when working with documents for all business purposes.  Don’t let challenges with authority prevent you from establishing taxonomy for your project.  Plan on establishing a governance team to own the taxonomy practice for the current project and in the future.

Bright. Shiny. Object. Taxonomy is not a bright shiny object.  It’s not as fancy as the user interface of the new software.  It doesn’t have the “bells and whistles” that hardware and devices have either.  So, too often document management projects end up focusing on the software and not the necessary taxonomy that makes that software a rock star.  Don’t be blinded.  If you want users to have a great experience, work with documents effectively, and generally adopt your new document management software, you must ensure you define a taxonomy.   Otherwise, your bright shiny object may easily be replaced by the next one as it loses appeal.

Complicated. I often hear from customers that a business taxonomy is complicated.  It can seem insurmountable to sift through existing taxonomy frameworks (or identify new ones), synthesize frameworks, identify new requirements, and really come up with something comprehensive.  Regardless, it’s necessary.  If a taxonomy effort is complicated, think of how complicated managing and searching documents is for your users. Help your users by including taxonomy in your next project to simplify their experience.  It’s the foundation for browsing, searching, contribution, workflows, interface design, and more.

Glamour. Unfortunately, taxonomy is not glamorous.  It’s hard, investigative work.  It entails identifying stakeholders; meeting with stakeholders to really understand documentation, process, and users; generating consensus; and documenting, documenting, documenting.  On top of that, it’s invisible.  Users often don’t even notice taxonomies, especially if they’re good.  But if a taxonomy is non-existent or poorly designed, your users will notice the taxonomy for all the wrong reasons—unintuitive naming, missing categories, illogical hierarchies, and more.  Even though taxonomy is not glamorous, it demands an investment to ensure your project is successful, at launch and thereafter.

Time. It’s common to hear in projects that there is just not enough time.  Customers may say “We need to complete X with the project by date Y.”  Or, “The management team really needs to see something.”  Frequently, the most important milestones for projects are software-related, causing taxonomy to lose focus.  The good thing about taxonomy is that projects can work concurrently on the software build out as they work on taxonomy frameworks.  You can do both and do them well.  Resist the urge to scope out taxonomy in your next project and consider creative ways to plan in taxonomy.

What? Yes, taxonomy has been around for a long time, but still often in projects I see that it’s just something that people are not aware of.  It’s existed for years in the biological and library sciences fields and has had application in IT and many other fields, but often it is just not understood for document management projects.  If you’re not familiar with taxonomy, see my previous blog post “Taxonomy isn’t just for frogs anymore.” and consider hiring a reputable company that can guide you through the practice for your next project.

ZZZs. It’s often perceived as a boring practice with tasks that are in the weeds, but some of us do love it.  Actually, we even find it rewarding to solve the puzzle of the perfect categorization that works for the project and the customer.  If you’re new to taxonomy, you may find that you like it too.  If not, find a resource for your project who has a passion for taxonomy because a good taxonomy is so important to successful document management projects.

smileyeyesIt’s time to have your eyes wide open. If you’re considering a document management software or improvement project, consider how important the underlying taxonomy is for your project and plan taxonomy analysis and development as a required effort.  Your users will appreciate it and your business will see increased software utilization.  Remember the old adage, “Technology cannot solve your business problems?”  It can’t.  But technology + taxonomy can.

 

 

This blog is one in a series discussing taxonomy topics.  Watch for the next blog coming soon.

 

Carrie McCollor is a Business Solutions Architect at Fishbowl Solutions. Fishbowl Solutions was founded in 1999. Their areas of expertise include Oracle WebCenter, PTC’s Product Development System (PDS), and enterprise search solutions using the Google Search Appliance. Check out our site to learn more about what we do.

 

Taxonomy isn’t just for frogs anymore. What taxonomy means in document management.

 

taxonomyfrogTaxonomy can be a nebulous term. It has existed for years, having probably its most common roots in the sciences, but has blossomed to apply its practices to a plethora of other fields.  The wide application of taxonomy shows how useful and effective it is, yet its meaning can be unclear due to its diversity.  We identify with taxonomy in library sciences with the Dewey Decimal System and we identify with taxonomy in the scientific use when we talk about animals (Kingdom: Animalia; Phylum: Chordata; Class: Amphibia; Clade: Salientia; Order: Anura (frog)).  These are familiar uses to us.  We learned of them early on in school.  We’ve seen them around for years—even if we didn’t identify them as taxonomies.  But what is taxonomy when we talk about subjects, like documents and data, that aren’t so tangible?  As a Business Solutions Architect at Fishbowl Solutions, I encounter this question quite a bit when working on Oracle WebCenter Content document management projects with customers.

The historical Greek term taxonomy means “arrangement law.”  Taxonomy is the practice in which things, in this case documents, are arranged and classified to provide order for users.  When it comes to documents, we give this order by identifying field names, field values, and business rules and requirements for tagging documents with these fields.  These fields then describe the document so that we can order the document, know more about it, and do more with it.

Here’s an example:lilypadtax

  • Document Type: Policy
  • Document Status: Active
  • Document Owner: Administrator
  • Lifecycle: Approved
  • Folder: HR
  • Sub-Folder: Employee Policies
  • And so on…

Defining a taxonomy for documents provides a host of business and user benefits for document management, such as:

  • A classification and context for documents. It tells users how a document is classified and where it “fits in” with other documents. It gives the document a name and a place. When a document is named and placed, it enables easier searching and browsing for users to find documents, as well as an understanding of the relationship of one document to another. Users know where it will be and how to get it.
  • A simplified experience. When we have order, we reduce clutter and chaos. No more abandoned or lost documents. Everything has a place. This simplifies and improves the user experience and can reduce frustration as well. Another bonus: document management and cleanup is a simple effort. Documents out of order are easy to identify and can be put in place. Documents that are ordered can be easily retrieved, for instance for an archiving process, and managed.frogelement
  • An arrangement that makes sense for the business. Using taxonomy in a document management system like Oracle’s WebCenter Content allows a company to define its own arrangement for storing and managing documents that resonates with users. Implementing a taxonomy that is familiar to users will make the document management system exponentially more usable and easier to adopt. No more guessing or interpreting arrangement or terminology—users know what to expect, terms are common, they are in their element!
  • A scalable framework. Utilizing a defined and maintained taxonomy will allow users to adopt the common taxonomy as they use the document management system, but will also allow for business growth as new scope (documents, processes, capabilities, etc.) is added. Adding in a new department with new documents? Got it. Your scalable taxonomy can be reused or built upon. Using a comprehensive taxonomy that is scalable allows for an enterprise approach to document management where customizations and one-offs are minimized, allowing for a common experience for users across the business.
  • A fully-enabled document management system. Lastly, defining a taxonomy will allow for full utilization of your OracleWebCenter Content, or other, document management system.   Defining a taxonomy and integrating it with your document management system will enable building out:
    • logical folder structures,
    • effective browse and search capabilities,
    • detailed profiles and filters,
    • advanced security,
    • sophisticated user interfaces and more.

Clearly, a taxonomy is the solution to providing necessary order and classification to documents. It creates a common arrangement and vocabulary to empower your users, and your document management system, to work the best for you.  Now hop to it!

This blog is the first in a series discussing taxonomy topics.  Watch for the next blog entitled “Taxonomy is a Sleeper. The reasons from A to ZZZs that taxonomy hasn’t been a part of your most important projects—but should be!”

Carrie McCollor is a Business Solutions Architect at Fishbowl Solutions. Fishbowl Solutions was founded in 1999. Their areas of expertise include Oracle WebCenter, PTC’s Product Development System (PDS), and enterprise search solutions using the Google Search Appliance. Check out our site to learn more about what we do.