Powered by Blogger.

Saturday, March 15, 2014

Basic Unix commands useful for Testing

In this post we will discuss about some basic unix commands which are useful for Testing. Also you can check out my previous posts on:

- Defect Management and Testing Management by using Quality Center(QC)

- Automated Performance Testing and its Parameters

- How to do Web Application Testing?

Basic Commands:
1. $logname: Displays the current user name.

2. $pwd: Displays current working directory.

3. $clear: Clear the screen

4. $exit: logout from the current user.

5. $date: Displays system date and time.

6. $Who am i: Displays current username,terminal number,date and time at which you logged into the system.

7. $who: To display the information about all the users who have logged into the system currently.
    i.e ech user login name,terminal number,date and time that person logged in.

8. $finger: Displays complete information about all the users who are logged in.

9. $cal: Displays previous month,current month and next month calender.

10. $cal year: Displays the given year calender.

11. $cal month year: Displays the given month calender only.

12. #init: To change system run levels.
      i. #init 0: To shut down the system
     ii. #init 1: To bring the system to single user mode.
    iii. #init 2: To bring the system to multi user mode with no resource shared.
     iv. #init 3: To bring the system multi user mode with source shared.
     v. #init 6: Halt and reboot the system to the default run level.

13. $banner "demo": It prints a message in large letters.

Create files:
There are two commands to create files: touch and cat

1. $Touch filename: it creates zero byte file size.
Note: Touch does not allow us to store anything in a file.It is used for to create several empty files quickly.

2. $cat> filename
     i.eg. $cat> demo:To create a file.
     ii.eg. $cat>>demo: To append data to the file.
     iii.eg. $cat file1 file2 file3 > file4
The above command would create file4 which contains contents of file1 followed by file2 and followed by  that of file3. i.e it concatenates file1,file2 and file3 contents and redirects to file4. If file4 already  contains something it would be over written.

3. $cat< filename (or)$cat filename:To open a file.

Removing files:
rm command is used to remove a file.
- $rm filename: It removes the file.
- $rm -i filename:It asks confirmation before deleting the file.
- $rm file1 file2 file3: It removes three files.
- $rm*:It removes all files in current directory.