How to view or open an existing shell script in unix? After viewing the contents how to close the file without modifying its content. Is there a way to view the file in notepad?
CodePudding user response:
To open the file
Use vi: vi script.sh
- Quit without saving: Escape -> Type
:q
-> Enter - Save and quit: Escape -> Type
:wq
-> Enter
To view the content without opening
Use cat: cat script.sh
CodePudding user response:
To view the content of the script file:
cat your_script_file.bash
To open it in a text editor, it depends on your distribution but it could be: mousepad
, gedit
, kedit
, etc. for the graphical editor, or vi
, emacs
, nano
etc. for the CLI text editors.