Many times a bunch of programs opens automatically, and we can’t close them anyways. Again, sometimes, after working on a particular program, we fail when we try to close it. In such situations, closing programs through terminal can be a great option. If you can’t complete a program and now want to know how to approach it through the airport, you are absolutely at the right place.
This content is all about closing a program through the terminal quickly. Keep scrolling to reveal the process given below.
Closing a Program in Terminal
Turning off a program in the terminal is also known as the “Kill a program” action. Here is how you can kill/close a program in the Windows terminal below. Check it out.
- Go to the desktop screen of your computer. Navigate to the “Activities” tab on the top left corner, and it will give you a search option.
- Type “Terminal” on that search bar and open the “Terminal” interface.
- Now, type “top” on that terminal interface to find every process working currently on your computer.
- Here, you can find the “PID” number and other details of all the files you want to close.
- To move to the next option from the “Top” command, press the “Ctrl+C” keys on your keyboard.
- Now, type the “ps -ef|grep -i” command on your terminal accurately.
- Right beside the “ps -ef|grep -i” command, type the program name you want to close. Suppose you are completing the Firefox application. Then type “ps -ef|grep -i firefox.”
- Now, press the “Enter” key on your keyboard. You will see a list of Firefox program details.
- Next, type “Kill -9 PID number” in the terminal. You can find the “PID” number from the firefox files information you have just opened up. Write the number very carefully.
- Now, press the “Enter Button,” and the program will exit immediately.
- Click on the “X” button of the terminal to go to the home screen.
Closing Multiple Programs in Terminal
Suppose you have 4-5 programs opened on your computer, and you need to close them all. For your convenience, we will reveal how you can complete several programs at a time in the terminal. Follow the instructions given below for a successful result.
- Follow step 1- step 6 of the first method we explained above and follow the steps below.
- Type the “ps -ef|grep -i” command and add the first program name you want to close. For example, type “ps -ef|grep -I chrome” and press the “Enter” button.
- Now, type “Kill -9 PID number of Chrome” and press the “Enter” key again.
- Now, again type the same command and the second program name you want to close. For example, type “ps -ef|grep -I opera” and tap on the “Enter” key.
- Again, type “Kill -9 Opera PID Number” and tap on the “Enter” button.
- Go on writing the same command with different program names and PID numbers. All the programs will be closed immediately through the terminal when you press the “Enter” key.
Summary: Exit a program in terminal
- If you don't have any unsaved files, type “exit” and hit enter.
- If you do have unsaved files, you can use the keyboard shortcut ctrl+z. This will temporarily close the instance of the program.
- Type “close” and hit enter. This will save all the files that are open in that instance of the program.
- Type “exit” and hit enter to close the window.