Home > Article > Operation and Maintenance > How to run .sh file under Linux system
How to run the .sh file under Linux system: first enter the absolute path of the file [/root/datelog.sh]; then cd to the directory of the [datelog.sh] file and execute [./ datelog.sh].
The operating environment of this tutorial: Windows 7 system, Linux 7.3 version, Dell G3 computer.
How to run .sh files under Linux system:
The first method (this method requires chmod to make the file meet the execution conditions (x): chmod u x datelog .sh):
1. In any path, enter the absolute path of the file /root/datelog.sh to execute the file (of course, if permissions allow)
2. cd to the directory of the datelog.sh file, and then execute ./datelog.sh
The second method (this method does not work The file needs to have executable permissions to run):
1. Just add the file name to sh in the file path, sh datelog.sh
2. In any path, sh plus the file path and file name: sh /root/ datelog.sh
Related learning recommendations: linux video tutorial
The above is the detailed content of How to run .sh file under Linux system. For more information, please follow other related articles on the PHP Chinese website!