Thursday 29 August 2013

Top Most 10 tips on working fast in UNIX or Linux


10 tips for working fast in UNIX
fast unix command tutorial and tipsHave you ever amazed to see someone working very fast in UNIX, firing commands and doing things in mille seconds? Yes I have seen and I have always inspired to learn from those gems of guys. This article or tutorial or whatever you call it I have dedicated to share UNIX command practices I follow to work fast, quick or efficiently in UNIX. I work for financial services industry and my work involves development and support of online stock and futures trading application in Electronic trading, Derivatives etc. all our services runs of UNIX servers so its very important for me to work efficiently and quickly in Linux machine.

This article is in continuation of my earlier article Top 10 basic networking Commands in Unix  and Top 10 most useful CVS command in Unix  and 10 examples of using find command in UNIX .

if you have not read those you can see if you find them interesting and useful. In this UNIX command tutorial I am going to share my experience on how to work quick, fast and efficiently in UNIX.

If your server also resides in UNIX machine and your day 2 day work involves lots of searching and playing around UNIX commands. Below tips are of my years of experience in UNIX which I have summarized as 10 tips to work fast in UNIX :) What I am looking forward is to get some more tips from you guys to enhance my arsenal so please share how you work in UNIX, how you make most of powerful commands and shell utilities provided by UNIX?

Please share your experience by posting comments to make this post useful and get most of it and benefit from each others experience.


1) Use !  For executing last command
This has saved my 30% time on average. It always happens that you fire same UNIX command multiple times within a fraction of seconds, before knowing this trick I used to use up and down arrow for finding my command and then executing them which takes some of my time but after
Knowing this trick I just have to remember command name e.g. !ls will execute your last "ls -lrt" , !vim will open your last file without
Typing full commands. Use it and experience it , It definitely save loads of time and its also useful on shell other than bash where up and down arrow generally doesn't give you previous commands.

For example After doing ls –l stocks.txt if you want to open stocks.txt you can use vi !$ (last argument)

2) use  !! for executing last command
This is an extension of previous tip which is used to execute the very last command you have executed. Since it just involves two keystrokes and that too for same key it’s amazingly fast. This will also works on the shells in which up and down arrow don’t work.This is extremely useful if you are stopping or starting your trading application for debug purpose frequently


3) Use "CRTL+R" for repeating the last matching command
Best out of lot if you remember your last command executed sometime back and just want to find that command with same argument and execute
This is the tip you need to remember. just press "CRTL+R" and type words that you had in your last command and UNIX will find that command for you then just press enter.

All above three tips will save lot of your time if you execute commands frequently and percentage of repetition is quite high. for me
I have saved almost 50-60% time by following above three tips. let me know how it works for you guys.

4) Using history command for getting some of the most frequently used UNIX command
This is the first thing I learn when I started working on UNIX :) This is your most helpful command in UNIX or shell. In most of the
Cases there are certain command like starting, stopping, checking log files, making build or doing release. Which we need to execute very frequently and if you don't remember exact command no need to worry, just do history | grep "keyword" and you will get that command from
UNIX history. There are certain environment variable e.g. HISTSIZE which defines how many command UNIX history can store, so have it big
Enough to save your time and avoid referencing your command booklet now and then.

5) Using regular expression in grep and find.
UNIX command tutorials and tips
grep and find is two best tools UNIX provide to us. almost everybody needs to search something in UNIX e.g. a file , a directory , certain words in file e.g. ERROR or Exception and if you know how to use grep and find with regular expression you will save lot of your time by typing less commands.

For example by knowing about egrep you can fire egrep "ERROR|Exception" *.xml instead of firing two grep command for finding ERROR and Exception individually.

6) Using pipe instead of firing two commands
Just shown above this nice and little tip I guess everybody knows :)

7) Using aliases and defining them in bash profile or bashrc file.
Have you seen some strange commands working in someone's machine and not yours, which might be aliases he would have setup in either his .bashrc or .profile file. Always do such kind of setup for commonly used command. There are lots of usage of .bashrc and .profile file but
One of the most important one is setting up aliases e.g.  "l." which finds all hidden files. "ls" which includes all useful option e.g. -lrtH to show all relevant information.

8) Using pushd, popd , cd - , ~ for moving across directory.
Based on my experience navigation in UNIX shell takes almost 50% times of people and if you are going to write directory path every now and then just forget about working fast. so instead of typing full name use all above tips and make best use of pushd, popd, cd - and cd ~ command. cd - is best if your switching between two directory location in UNIX.

9) Minimize the key strokes or increase the speed of typing.
That I guess you know isn't it the less you type the more fast you work so make use of your last typed command, make use of tab in bash so that let the UNIX bash shell complete your command, use Ctrl+R if the last command you have typed is very long and you want to change just few lines.

10) Try to learn more commands and their options and usage this will reduce thinking time for a particular task and use  ctrl+z and fg and bg to suspend a process. it saves almost 10% time if you are viewing multiple files or log files so instead of every now and then executing vim commands just do Ctrl+Z to suspend it and fg 1 or fg 2 to bring it on foreground.

I hope these examples, tips on UNIX command will help you to do more in less time and enhance your productivity and experience while working in UNIX. This list is by no means complete so please share how you working in UNIX and of course how fast are you working in UNIX?

If you are preparing for any job interview on Investment bank for Trading floor support or any other Trading support role you may find my FIX protocol interview questions and  FIX protocol tutorials series helpful. most of the investment bank support role checks three things UNIX, Perl , SQL and FIX protocol so if you are good on these four you have more chances of landing a  good job in Investment bank.

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Labels

Core Java programming core java interview question Core Java Faq's Servlets coding database jsp-servlet spring Java linux unix interview questions java investment bank Web Services Interview investment bank mysql Senior java developer interviews best practices java collection tutorial RMI SQL Eclipse FIX protocol tutorial tibco J2EE groovy java questions SCJP grails java 5 tutorial jdbc beginner error and exception Design Patterns Java Programming Tutorials fundamentals general object oriented programming xml Java Programs Hibernate Examples Flex JAMon Java xml tutorial logging Jsp Struts 2.0 Sybase and SQL Server debugging java interviews performance FIX Protocol interview questions JUnit testing WebSphere date and time tutorial experienced java IO tutorial java concurrency thread Ejb Freshers Papers IT Management Java Exapmle Java Script SQL and database tutorial examples Scwcd ant tutorials concurrency example and tutorial future state homework java changes java threading tricky Agile Business of IT Development JSTL Java JSON tutorial Java multithreading Tutorials PM Scrum data structure and algorithm java puzzles java tips testing tips windows 8 5 way to create Singleton Object Architect Interview Questions and Answers Architecture Architecure Bluetooth server as swing application that searches bluetooth device in 10 meter circle and show all devices. You can send file to any bluetooth device. C Programming CIO Callable Statement in Java Circular dependency of Objects in Java Comparable Example in Collection Custom annotation in Java Developer Interview Divide and rule example in java Drupal Example of Singleton Pattern FIX protocol ForkJoin Example in Java 7 Get data from dynamic table with Java Script Git HTML and JavaScript Health Hello World TCP Client Server Networking Program Hibernate Basics Hibernate Interview Question Answer J2EE Interview Question And Answers J2ME GUI Program JEE Interview QA JMS interview question Java J2EE Hibernate Spring Struts Interview Question Java System Property Java Threads Manager Portlets Provident Fund Read data from any file in same location and give the required result. Reading Properties File in Java Redpoint Rest WebService Client Rest Webservice Test SAL join with ven diagram SCP UNIX COMMAND SSL Singleton Pattern in Java Spring Bean Initialization methods and their order Spring Interview Questions Struts Struts 2.0 Basics Struts 2.0 Design Pattern Submit Html Form With Java Script On The Fly Unix executable For Java Program XOM DOM SAX XP books computers core java; core java; object oriented programming data structure; java investment bank; design pattern dtd duplicate rows in table get browser name with jquery grails podcast inner class java beginners tutorial java cache java networking tutorial java spring java util; java collections; java questions java.java1.5 linked list mailto function with all browser oracle database oracle duplicate rows orm schema social spring mvc questions struts transaction tricks tweet windows xslt