Wednesday 22 September 2010

Basic Unix/Linux commands

In any type of testing (let it be functional or non-functional) some basic Linux/Unix skills could be very beneficial (if test environment is using that Operating System). Testers could connect to the server and perform basic tasks on their own releasing development team from some duties such as:
  • restarting the application server and/or the Operating System
  • accessing server logs to verify that the scripts are not causing server side exceptions not displayed in the browser
  • parsing server logs to calculate application load profile (i.e. number of concurrent users, pauses between requests, etc.)
The most common way to connect to the Unix system is to use SSH client such as Putty. This utility connects to the remote Unix server and allows for unlimited access to the server, provided that the user has sufficient access rights.
Open Putty session


It is considered a bad practise to share Administrator’s (or how it is called in Unix environment root’s) password with everyone and thus you should always use username with limited privileges for the day-to-day tasks.

The basic commands anyone connecting to the Unix server should know could be categorised into few groups.
  • Directory navigation and discovery
    • cd - change current folder to another (e.g. “cd /etc/init.d”)
    • ls - list content of the current folder often used with -lah attribute for additional info about file size, last modification data and permission (e.g. “ls -lah”)
    • pwd - displays current folder (e.g. "pwd")
    • find - search for files is a specified folder (e.g. “find /var/log -name .log”)
    • du - checks file or folder size (e.g. “du -hs /var/log”)
  • Text file processing
    • vi - very popular text editor for Unix operating systems; might be a bit difficult for a non-experienced user. Easier alternatives would be “nano” and “pico”
    • cat - prints file content in the console (e.g. “cat /var/log/messages”)
    • less - text viewer which allows backward navigation (e.g. “less /etc/passwd”); to quit press Ctrl+C
    • echo - prints text passed to the command in the console or sends it to the file (e.g. “echo “Hello World” > /tmp/filename.txt”). Can also be used to clear content of the file (e.g. “echo -n /tmp/zimbra.log”)
    • grep - filters the file or result of other command and prints lines containing search term (e.g. “cat /tmp/server.log |grep error” or “ps aux |grep apache”)
    • sed - command line version of the search and replace utility (e.g. “cat file.txt| sed -e "s/SearchFor/ReplaceWith/g" > ResultFile.txt”)
    • awk - pattern scanning and text processing language. Following example will parse /etc/passwd file using colon as a field delimiter (-F:) and print the content of the second column for each record (e.g. “cat /etc/passwd| awk -F: '{ print $1 }'”)
  • Operating System - Process control
    • ps - list all processes running in the system (e.g. for linux “ps aux” and for unix “ps -ef”)
    • kill - forces the process to quit (e.g. “kill -9 ProcessID”); Process id can be found by executing ps command
    • killall - terminates all processes by the process name (e.g. “killall zimbra”)
    • free - displayes amount of free and used memory in the system (e.g. “free”)
    • top - lists all processes and sort them by CPU usage (e.g. “top”); to quit press Ctrl+C




If the only reason for accessing Unix server is to read/modify files or transfer files between the server and the local workstation it might be a better option to use other tool with graphical user interface (to which Windows users will be more used to) such as WinScp.


WinScp uses SSH protocol (which is the same protocol Putty is using) to connect to the Unix server and transfer files over secure connection to and from the local host.



The tool provides two different connection options (i.e. scp, ftp). FTP will only work if the FTP server is running on the remote server wheres scp will work always as it is using SSH connection for file transfers. Both options are equally secure as all the data is sent over secure SSH channel.



Both tools are free to use and their small size (around few MB) makes them ideal to use out of the memory stick.

50 comments:

  1. Great work. Quite a useful post, I learned some new points here.I wish you luck as you continue to follow that passion.

    Linux Admin Training
    Linux Training

    ReplyDelete
  2. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    Devops training in Chennai
    Devops training in Bangalore
    Devops Online training
    Devops training in Pune

    ReplyDelete
  3. Just stumbled across your blog and was instantly amazed with all the useful information that is on it. Great post, just what i was looking for and i am looking forward to reading your other posts soon!
    java training in chennai | java training in bangalore

    java training in tambaram | java training in velachery

    java training in omr | oracle training in chennai

    ReplyDelete
  4. Great Article...Thanks for sharing the best information.It was so good to read and useful to improve my knowledge as updated one.

    Mobile Apps Training
    Mobile Apps Training in Chennai

    ReplyDelete

  5. Hello! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done an outstanding job.

    AWS Online Training | Online AWS Certification Course - Gangboard
    AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR
    AWS Training in Bangalore |Best AWS Training Institute in BTM ,Marathahalli

    ReplyDelete
  6. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    python online training
    python training in OMR
    python training course in chennai

    ReplyDelete
  7. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
    Best Devops Training in pune

    ReplyDelete
  8. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.

    Java training in Chennai | Java training in Bangalore

    Java online training | Java training in Pune

    ReplyDelete
  9. Well somehow I got to read lots of articles on your blog. It’s amazing how interesting it is for me to visit you very often.

    Data Science course in Indira nagar
    Data Science course in marathahalli
    Data Science Interview questions and answers


    ReplyDelete
  10. Were a gaggle of volunteers as well as starting off a brand new gumption within a community. Your blog furnished us precious details to be effective on. You've got completed any amazing work!
    python training in chennai | python training in chennai | python training in bangalore

    ReplyDelete
  11. Thank you for sharing the article. The data that you provided in the blog is informative and effective. Best Linux Training Institute

    ReplyDelete
  12. Thanks for providing recent updates regarding the concern, I look forward to read more.
    machine learning course malaysia

    ReplyDelete
  13. Excellent post, must say thanks for the information you added to this post. I appreciate your post and looking forward for more.


    Data Science

    ReplyDelete
  14. thanks for sharing such a great article, thank u so much i love it read it three time , keep it up.
    data analytics certification courses in Bangalore
    ExcelR Data science courses in Bangalore

    ReplyDelete
  15. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.Data Science Courses

    ReplyDelete
  16. Thank you for sharing such a nice post!

    Start your journey with Best SAP FICO Course and get hands-on Experience with 100% Placement assistance from experts Trainers @Softgen Infotech Located in BTM Layout Bangalore.

    ReplyDelete



  17. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing the information .Hope more posts from you .I also want to share about best linux admin online training in recent times also and linux training .

    ReplyDelete
  18. Myself so glad to establish your blog entry since it's actually quite instructive. If it's not too much trouble continue composing this sort of web journal and I normally visit this blog. Examine my administrations.  
    Read these Salesforce Admin Certification Topics which are really helpful. I read these Salesforce Admin and Developer Certification Dumps and very much useful for me. I recommend this Salesforce Developer Training and Certification Course for you.  

    ReplyDelete

  19. It is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. It is really explainable very well and i got more information from your blog. Please, continue to give me such valuable posts.


    Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data scientist course in hyderabad with placement

    ReplyDelete
  22. Not long ago, I noted that our local economic development association was doing very little in the way of recruiting new businesses to our area. They had worked hard to get an enterprise zone in place, as well as a Foreign Trade Zone to attract businesses AWS online course

    ReplyDelete
  23. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. data science training in Hyderabad

    ReplyDelete
  24. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. data scientist courses

    ReplyDelete
  25. As mentioned, we are living in times where the worth of data is more than that of a mine of pure gold. And so, understanding what exactly the data contains, data science course syllabus

    ReplyDelete
  26. An inconsistent approach will usually lead to uncertainty, a drop in motivation and inter-team conflict. Trust in the manager is as vital as respect if they are to lead their team effectively Salesforce training in Hyderabad

    ReplyDelete
  27. Actually your exploratory writing capacities has enlivened me to begin my very own Blog Engine blog now. Extremely the blogging is spreading its wings quickly. Your review is a fine case of it www.dynamicmarketing.sg/seo-consultant-singapore

    ReplyDelete
  28. Thanks for the detailed article on this topic. I would like to see more such awesome articles from you.

    ReplyDelete
  29. Гадание на бывшего мужчину является максимально правдивым действием определить грядущее человека. Ранние порядки предсказания грядущего были образованы тысячи лет назад до нашей эры. Естественные проявления или обрядовые жертвоприношения по прошествии длительного времени сформировали конкретное толкование обнаруженного.

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. I really enjoyed this blog. It's an informative topic. I am sure it helps others to solve some problems. For all technological folks I would suggest to learn the concepts of Devops as it is on trends currently and going to be the same in the upcoming future. Thank you.

    ReplyDelete
  32. We at Mytanfarma help you to realize three ultimate goals :
    PROFIT to customer - Managed farmland in Bangalore offers the potential for higher rates of return due to the scope for appreciation in the value of land, tax-free agricultural income, and value enhancement of the land through forestry and plantation crops. Horticultural crops can provide seasonal income, while timber can fetch handsome returns as a long-term benefit.

    ReplyDelete