Skip to main content

Useful software testing commands on the Linux platform

Useful information which every software tester should know while testing any application on Linux or Ubuntu platform. To test any application based on the Linux platform one should be aware of the terminal and basic commands to test the application.

What is Terminal?

Terminal often known as shell, console, or prompt. We called it a Text interface for your system/computer.

How to start Terminal on Linux / Ubuntu Platform?

Navigate to any folder structure for which one has to open the terminal. Right, Click and select the option “Open in Terminal”. Another keyboard shortcut key is “Ctrl+Alt+T”. Or Click on the activities item and search for words “shell”, “terminal”, “prompt”. On search system will display Terminal Icon. By selecting that icon Terminal opens.

How to Create Folder and Files?

Users can create folders or files in any directory if he is having sufficient permission. But as a beginner, it is recommended to create this in /tmp folder.

To create a directory from the command line

mkdir testDir

To create multiple directories from the command line.

mkdir testDir1 testDir2 testDir3

mkdir command accepts a minimum of one argument. by providing only text without providing any path then the system creates that directory in the current path/directory only.

To create a directory at a specific location an argument needs to provide a path.

mkdir /tmp/testDir1

How to change the current working directory?

To change the current working directory path Linux provides the command “cd” with or without argument. This is one of the most commonly used commands.

for example, if the user wants to work in /tmp/dir1 directory and his current working directory is /root then by writing the command cd /tmp/dir1

How to get the path of a current working directory?

By using the command “pwd” the system gives information about the current working directory.

How to see a list of files and directories?

Using the “ls” command system displays all files and directories in the current path.

To view files or contents from different directories then use

ls <directory path>

example
ls /etc/logs/

By pressing tab, system complete the command or display a different option when the user starts typing and press the tab. Also while typing directory path and user press tab the system displays child content for selection.

How to get help from unix command? Where to read documents for Linux / ubuntu command?

If the user has to explore more about specific command then type

“man” <command name>

man ls

By reading man pages for specific commands user can understand options available for the command. Don’t get boar by reading man pages. It will help to do the job fast.

How to see what different commands are available?

type “help” and press enter. System will display list of available commands.

How to see single-line description for command?

user whatis command in below format

whatis <commandName>

This will display a limited description of the command.

How to see background process?

Use of “ps” command displays a list of running processes.

How to terminate the process?

To kill any background process use “kill” command. kill along with -9 option and PID.

First, identify the PID of the process which needs to kill using the ps command. then write

kill -9 <PID>

mention PID number.

How to start, stop, restart mysql process?

sudo service mysqld start

sudo service mysqld start

sudo service mysqld restart

How to find any file from directory?

By using find commands with different parameter user can find files from the current working directory, subdirectory or other directories (by mentioning path). for example, if the user wants to find file abc.txt in the current working directory and subdirectory then use the below command.

find . -name abc.txt

If the user wants to find the file from a specific directory then use this command

find /pathOfDirectory -name abc.txt

How to find files which contain specific text or words?

using the grep command user can find the file which contains a specific word. Using the grep command user can search text from multiple files as well. here is the use of the grep command.

grep textToFind * —–this will find textTofind in all directory

grep textToFind fileName —- this command will find textToFind in specific file.

How to take screenshots? Which software is useful to take screenshots on the ubuntu or Linux platform?

Install Flameshot on ubuntu. This is really helpful to take screenshots and highlight the necessary portion.

How to install Flameshot?

Use this command for installing Flameshot.

sudo apt install flameshot

Where to check system logs?

In /var/log directory users can find logs. using tail command user can have watched on generating logs. Using the grep command user can find any specific error in the log file which may not be observed while doing User interface Testing.

Overall there are other necessary commands also available which are useful while doing testing.