Basic Operations#
clash for windows: Github Release
After downloading, unzip and run ./cfw
in the current directory.
However, this requires repeating the step every time the computer is restarted, which is a bit inconvenient, and a terminal window will continue to be displayed after startup.
Screen Background Operations#
Syntax
screen [-AmRvx -ls -wipe][-d ][-h ][-r ][-s ][-S ]
Parameter description:
-A adjust the size of all windows to fit the current terminal.
-d detach the specified screen session.
-h set the number of lines in the scrollback buffer.
-m force the creation of a new screen session, even if one is already running.
-r resume a detached screen session.
-R attempt to resume a detached screen session. If one does not exist, create a new screen session.
-s specify the shell to be executed when a new window is created.
-S specify the name of the screen session.
-v display version information.
-x attach to a previously detached screen session.
-ls or --list display all currently active screen sessions.
-wipe check all screen sessions and remove those that are no longer available.
Simple demonstration:#
screen -S screenname
This will create a screen named "screenname". You can then close the terminal or use Ctrl+d to detach it. If you enter "exit", the screen will be terminated directly.
`screen -ls`
List all currently active screens.
Note: If there are no running programs in the created screen, it will be automatically released after being detached.
"6160, 5945" can be considered equivalent to "test, clash".
Attached means it is already open in another terminal window,
Detached means it is not open.
Actual Operation#
Now let's write a script to start a new screen and run it in the background.
screen_name="clash"
screen -dmS $screen_name
cmd="sh /home/seele/Documents/clash.sh"
screen -X -S $screen_name -p 0 -X stuff "$cmd"
screen -x -S $screen_name -p 0 -X stuff '\r'
"\r" is used to input a carriage return. Otherwise, screen will only input the previous line without executing it. If combined into one line, it will only add a newline to the previous line without running it.
clash.sh is the script to start clash, as follows:
cd /home/seele/Documents/'Clash for Windows-0.18.1-x64-linux'/ && ./cfw
Finally, by setting an alias or running the screen.sh script at startup, Clash can be launched more conveniently.
Note:#
This method is not considered a simple operation in scenarios where Clash needs to be restarted multiple times because the clash screen in screen does not automatically close. Ultimately, Appimage is still the best way to handle this type of software. Looking forward to official support.