After writing the code to checking the status in ubuntu how can i save that program
You can create a new file by running the below command
nano your_file_name
paste your code and save by Ctrl+X and typing Y when it asks to save the file.
If you are using nano editor, after writing the code you can save it by pressing CTRL + S and then exit from the editor by pressing CTRL + X .
You can also use gedit editor by running the command gedit file_name.
In that case after writing the code press CTRL + S to save the file and click on the cross button shown at the top right corner to exit from the editor.